1
0

general.bin 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. SPS allows you to program signal processing using simple expressions.
  2. Many aspects of SPS code are similar to C (including comments).
  3. You can create new variables just by using them, and you can read
  4. and write predefined variables (of which each effect has its own)
  5. to interact with the effect. Note that variables are all floating
  6. point numbers (no strings), and the maximum length of a variable's
  7. name is 8 characters (anything longer will be ignored).
  8. So, to create a variable, you can simply use it, for example:
  9. x = 5;
  10. You can also use a variety of operators and math functions to
  11. modify variables, see the Operators and Functions tabs above.
  12. Code can include C and C++ style comments:
  13. // using the doubleslash comments until the end of the line
  14. /* using the classic C comments
  15. comment a block of text */
  16. You can combine operators and functions into expressions, such
  17. as:
  18. x = 5 * cos(y) / 32.0; // this does some leetness right here
  19. You can use multiple expressions by seperating them with one or
  20. more semicolons, for example:
  21. x = x * 17.0; x = x / 5; y = pow(x,3.0);
  22. It is worth noting that extra whitespace (spaces, newlines) is
  23. ignored, so if you need to space things out for clarity, you can.
  24. Variables that are predefined for your effect to use:
  25. nch: number of channels of PCM stream (1 or 2)
  26. srate: samplerate of stream (i.e. 44100)
  27. slider1, slider2, slider3, slider4: the four sliders. Each has a range of 0.0..1.0
  28. trig1, trig2, trig3, trig4: the four trigger buttons. These should be reset to 0.0
  29. by your code when you've caught the trigger
  30. Variables that your per-sample code can modify to apply its effect:
  31. spl0 = left/mono channel sample, -1.0..1.0
  32. spl1 = right channel sample, if nch == 2, -1.0..1.0
  33. skip = set this to > 0 to drop the current sample and not output it
  34. (this effectively can be used to speed up the output
  35. repeat = set this to > 0 to process this sample again after
  36. outputting (this effectively can be used to slow down
  37. the output. Note that the most you can slow down the
  38. output due to Winamp architecture limitations is by 50%)
  39. Now to the important part, how to actually make meaningful effects:
  40. A simple volume control might be:
  41. spl0 = spl0*slider1; spl1=spl1*slider1;
  42. To slow down the output to half speed:
  43. tmp=bnot(tmp); repeat=tmp;
  44. To speed up the output to double speed:
  45. tmp=bnot(tmp); skip=tmp;
  46. To swap left and right channels:
  47. tmp=spl0; spl0=spl1; spl1=tmp;
  48. etc�