function.bin 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. Functions available from code:
  2. abs(value)
  3. = returns the absolute value of 'value'
  4. sin(value)
  5. = returns the sine of the radian angle 'value'
  6. cos(value)
  7. = returns the cosine of the radian angle 'value'
  8. tan(value)
  9. = returns the tangent of the radian angle 'value'
  10. asin(value)
  11. = returns the arcsine (in radians) of 'value'
  12. acos(value)
  13. = returns the arccosine (in radians) of 'value'
  14. atan(value)
  15. = returns the arctangent (in radians) of 'value'
  16. atan2(value,value2)
  17. = returns the arctangent (in radians) of 'value'/'value2'
  18. sqr(value)
  19. = returns the square of 'value'
  20. sqrt(value)
  21. = returns the square root of 'value'
  22. invsqrt(value)
  23. = returns the reciprocal of the square root of 'value' (1/sqrt(value))
  24. (uses a fast approximation, may not always = 1/sqrt(value) :)
  25. pow(value,value2)
  26. = returns 'value' to the power of 'value2'
  27. exp(value)
  28. = returns e to the power of 'value'
  29. log(value)
  30. = returns the log in base e of 'value'
  31. log10(value)
  32. = returns the log in base 10 of 'value'
  33. floor(value)
  34. = returns the largest integer less than or equal to 'value'
  35. ceil(value)
  36. = returns the smallest integer greater than or equal to 'value'
  37. sign(value)
  38. = returns the sign of 'value' (-1.0 or 1.0, or 0.0 or -0.0)
  39. min(value,value2)
  40. = returns the smallest of 'value' and 'value2'
  41. max(var,var2)
  42. = returns the greatest of 'value' and 'value2'
  43. sigmoid(value,value2)
  44. = returns sigmoid function value of x='value' ('value2'=constraint)
  45. rand(value)
  46. = returns a random integer between 0 and 'value'
  47. band(value,value2)
  48. = returns a boolean AND of 'value' and 'value2'
  49. bor(value,value2)
  50. = returns a boolean OR of 'value' and 'value2'
  51. bnot(value)
  52. = returns a boolean NOT of 'value'
  53. if(condition,valtrue,valfalse)
  54. = returns 'valtrue' if 'condition' is nonzero, returns 'valfalse' otherwise.
  55. new in AVS 2.8+: only one of valtrue/valfalse is evaluated, depending on condition
  56. assign(dest, source)
  57. = if 'dest' is a variable, assigns the value of 'source' to it. returns the value of 'source'.
  58. a little trick: assign(if(v,a,b),1.0); is like if V is true, a=1.0, otherwise b=1.0. :)
  59. exec2(parm1, parm2)
  60. = evaluates parm1, then parm2, and returns the value of parm2.
  61. exec3(parm1, parm2, parm3)
  62. = evaluates parm1, then parm2, parm3, and returns the value of parm3.
  63. equal(value,value2)
  64. = returns 1.0 if 'value' is equal to 'value2', otherwise returns 0.0
  65. above(value,value2)
  66. = returns 1.0 if 'value' is greater than 'value2', otherwise returns 0.0
  67. below(value,value2)
  68. = returns 1.0 if 'value' is less than 'value2', otherwise returns 0.0
  69. megabuf(index)
  70. = can be used to get or set an item from the 1 million item temp buffer
  71. to get, use: val=megabuf(index);
  72. to set, use: assign(megabuf(index),val);
  73. loop(count, statement)
  74. = executes <statement> <count> times. count is evaluated once and clamped
  75. to 0..4096. best used with exec2() and exec3() and assign(). Note that
  76. the return value of loop() is undefined and should not be used.�