How to add multiple parameters to snex_node in ScriptFX
-
Hello, I am fairly new to HISE and I've been messing with the snex_nodes recently. I can't seem to find any other forums or post talking about the setParameter() helper function.
I got the method for setting parameters from another forum post talking about soft saturation implementation and the nice fellow who posted provided his code to try out. This is where the
if (P == 0) thresh = (float)t;
initially came from. He used this method and it works, but only with 1 parameter. I've got 3 user tweaked params that I want to implement, but I don't understand what syntax or structuring I need in order to accomplish this. Perhaps a slider pack or table might be better suited for multiple parameter inputs? The setExternalData() helper function seems to have more of its functionality explained in the documentation. Then the issue is if those types of inputs can be controlled by a global script parameter.
The HISE documentation doesn't provide much of the help I'm looking for either. I does state that the parameter index is written as a template argument, leading me to think I could treat it as an argument to set the correct parameter value based on the order I created them (P == 0 means "Threshold", P == 1 means "Attack", and so on). I'm not sure if I'm missing something or don't understand how the snex_node functions are supposed to be used. Thanks for any help apologies if it's a simple fix, I appreciate any tips and tricks for snex scripting!
-
@blackbneard You're almost there, the only thing you did wrong was using more function arguments than necesssary.
setParameter()
always requires a single argument that contains the parameter value and all the branching is done with the template constant like you assumed.template <int P> void setParameter(double value) { if(P == 0) thresh = (float)value; if(P == 1) attack = (float)value; if(P == 2) release = (float)value; }