You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
776B

  1. // Simplest possible script using all variables, demonstrating buffering
  2. // by Andrew Belt
  3. config.frameDivider = 1
  4. config.bufferSize = 32
  5. function process(block) {
  6. // Loop through each column
  7. for (let i = 0; i < 6; i++) {
  8. // Get gain knob
  9. let gain = block.knobs[i]
  10. // Set gain light (red = 0)
  11. block.lights[i][0] = gain
  12. // Check mute switch
  13. if (block.switches[i]) {
  14. // Mute output
  15. gain = 0
  16. // Enable mute light (red = 0)
  17. block.switchLights[i][0] = 1
  18. }
  19. else {
  20. // Disable mute light
  21. block.switchLights[i][0] = 0
  22. }
  23. // Iterate input/output buffer
  24. for (let j = 0; j < block.bufferSize; j++) {
  25. // Get input
  26. let x = block.inputs[i][j]
  27. // Apply gain to input
  28. let y = x * gain
  29. // Set output
  30. block.outputs[i][j] = y
  31. }
  32. }
  33. }