Getting an Array of ScriptNode Parameter IDs?
-
Does anyone know how to get an array of parameter IDs for a ScriptNode Network (e.g. ScriptNode Synth)?
Instead of keeping track of all the parameter names, I want search by string for a parameter, and if it exists, change the parameter value.
Thanks!
-
@clevername27 Assuming it works like a regular effect you can use
Effect.getNumAttributes()to loop over all the parameters, and useEffect.getAttribute()orEffect.getAttributeId()as needed. -
@d-healey It does, thank you!
The only part I can't seem to get is using
getAttributeIndex()to search by string for the corresponding parameter ID. When I pass in a parameter name, the returned index is always -1. This implies that there's some way to format the parameter name that I'm not doing? -
@clevername27 It's case sensitive if that makes a difference. You could also do a comparison with
Effect.getAttributeId(i) == mySearchString -
@d-healey Thank you, yes the comparison will work. For some reason,
getAttribute()works with the string I pass, but notgetAttributeIndex(). In any case, I've got all my answers, and thank you as always.