SNEX UI Parameters
-
idk what's going on with this example, but to get SNEX parameters working:
click the 3 dots -> "Add Parameter", give it a name and range of values, then in the SNEX script
//declare a variable the parameter will control float myVar = 0.0; template <int P> void setParameter(double v) { if (P ==0) // the index of our parameter { myVar = v; } }
you can inspect the variable changing by opening the data table (eye icon)
-
@Straticah I‘m afraid you need a basic understanding of C++ in order to write C++ code :)
In your example you‘re redeclaring a variable within the same scope.
-
@Christoph-Hart Which variable is redeclared? I don't see it? He has scopes around each parameter.
-
@tobante
scriptnode::parameter p
, line 69 -
But this is legal:
{ // scope a int p = 42; // ... } { // scope b int p = 43; // ... }
-
@tobante Yes but this isn't:
int p = 41; { } int p = 42;
-
@Christoph-Hart I'm still confused.
- Function: L59 -L75 (contains 2 nested scopes)
- Scope A: L60 -L65 (contains 1st p)
- Scope B: L68 -L74 (contains 2nd p)
Indentation is a little misleading, but it is valid.
-
@Christoph-Hart I agree that your example is invalid, but that's not what @Straticah has in his example. The error probably is that he uses
d
for the parameter he calleddata
. Not sure why the compiler flags line 58. Maybe it's always beginning of function. -
-
haha, now I see it too. That is a contender for worst code formatting ever...
-
@Christoph-Hart I was so confused, because I gave @Straticah the code from your GitHub repo. :)