winamp/Src/Plugins/DSP/dsp_sps/function.bin

110 lines
3.1 KiB
Plaintext
Raw Normal View History

2024-09-24 13:54:57 +01:00
Functions available from code:
abs(value)
= returns the absolute value of 'value'
sin(value)
= returns the sine of the radian angle 'value'
cos(value)
= returns the cosine of the radian angle 'value'
tan(value)
= returns the tangent of the radian angle 'value'
asin(value)
= returns the arcsine (in radians) of 'value'
acos(value)
= returns the arccosine (in radians) of 'value'
atan(value)
= returns the arctangent (in radians) of 'value'
atan2(value,value2)
= returns the arctangent (in radians) of 'value'/'value2'
sqr(value)
= returns the square of 'value'
sqrt(value)
= returns the square root of 'value'
invsqrt(value)
= returns the reciprocal of the square root of 'value' (1/sqrt(value))
(uses a fast approximation, may not always = 1/sqrt(value) :)
pow(value,value2)
= returns 'value' to the power of 'value2'
exp(value)
= returns e to the power of 'value'
log(value)
= returns the log in base e of 'value'
log10(value)
= returns the log in base 10 of 'value'
floor(value)
= returns the largest integer less than or equal to 'value'
ceil(value)
= returns the smallest integer greater than or equal to 'value'
sign(value)
= returns the sign of 'value' (-1.0 or 1.0, or 0.0 or -0.0)
min(value,value2)
= returns the smallest of 'value' and 'value2'
max(var,var2)
= returns the greatest of 'value' and 'value2'
sigmoid(value,value2)
= returns sigmoid function value of x='value' ('value2'=constraint)
rand(value)
= returns a random integer between 0 and 'value'
band(value,value2)
= returns a boolean AND of 'value' and 'value2'
bor(value,value2)
= returns a boolean OR of 'value' and 'value2'
bnot(value)
= returns a boolean NOT of 'value'
if(condition,valtrue,valfalse)
= returns 'valtrue' if 'condition' is nonzero, returns 'valfalse' otherwise.
new in AVS 2.8+: only one of valtrue/valfalse is evaluated, depending on condition
assign(dest, source)
= if 'dest' is a variable, assigns the value of 'source' to it. returns the value of 'source'.
a little trick: assign(if(v,a,b),1.0); is like if V is true, a=1.0, otherwise b=1.0. :)
exec2(parm1, parm2)
= evaluates parm1, then parm2, and returns the value of parm2.
exec3(parm1, parm2, parm3)
= evaluates parm1, then parm2, parm3, and returns the value of parm3.
equal(value,value2)
= returns 1.0 if 'value' is equal to 'value2', otherwise returns 0.0
above(value,value2)
= returns 1.0 if 'value' is greater than 'value2', otherwise returns 0.0
below(value,value2)
= returns 1.0 if 'value' is less than 'value2', otherwise returns 0.0
megabuf(index)
= can be used to get or set an item from the 1 million item temp buffer
to get, use: val=megabuf(index);
to set, use: assign(megabuf(index),val);
loop(count, statement)
= executes <statement> <count> times. count is evaluated once and clamped
to 0..4096. best used with exec2() and exec3() and assign(). Note that
the return value of loop() is undefined and should not be used.