The core of JSFX is custom code written in a simple language (called EEL2), which has many similarities to C. Code is written in one or more of the numerous code sections. Some basic features of this language are:
z=x[y]; x[y]=z;You may use brackets to index into memory that is local to your effect. Your effect has approximately 8 million (8,388,608) slots of memory and you may access them either with fixed offsets (i.e. 16811) or with variables (myBuffer). The sum of the value to the left of the brackets and the value within the brackets is used to index memory. If a value in the brackets is omitted then only the value to the left of the brackets is used.
z=gmem[y]; gmem[y]=z;If 'gmem' is specified as the left parameter to the brackets, then the global shared buffer is used, which is approximately 1 million (1,048,576) slots that are shared across all instances of all JSFX effects.
options:gmem=someUniquelyNamedSpacewhich will make gmem refer to a larger shared buffer, accessible by any plugin that uses
options:gmem=<the same name>. So, if you have a single plug-in, or a few plug-ins that access the shared namespace, they can communicate without having to worry about other plug-ins. This option also increases the size of gmem to be 8 million entries (from the default 1 million). -- REAPER 4.6+
x % 5 ? ( f += 1; x *= 1.5; ) : ( f=max(3,f); x=0; );
z = ( a = 5; b = 3; a+b; ); // z will be set to 8, for example
a < 5 ? b = 6; // if a is less than 5, set b to 6 a < 5 ? b = 6 : c = 7; // if a is less than 5, set b to 6, otherwise set c to 7 a < 5 ? ( // if a is less than 5, set b to 6 and c to 7 b = 6; c = 7; );
(a < 5 ? b : c) = 8; // if a is less than 5, set b to 8, otherwise set c to 8
loop(32, r += b; b = var * 1.5; );Evaluates the first parameter once in order to determine a loop count. If the loop count is less than 1, the second parameter is not evaluated.
while( a += b; b *= 1.5; a < 1000; // as long as a is below 1000, we go again. );Evaluates the first parameter until the last statement in the code block evaluates to zero.
while ( a < 1000 ) ( a += b; b *= 1.5; );Evaluates the parameter, and if nonzero, evaluates the following code block, and repeats. This is similar to a C style while() construct.