// Dishwasher // copyright 2009 Les Hall // This software is protected by the GNU General Public License // parameters 10 => int n; 1000::ms => dur t; // patch DelayA dly[n]; Gain input, output; // // interconnection for (int i; i dly[(i+1)%n]; } adc => input => dly[0]; input => PitShift pitshift => input; dly[0] => Dyno dyno => output => dac; dly[n-1] => blackhole; // // patch parameters for (int i; i dly[i].max => dly[i].delay; } 1 => pitshift.mix; 0.8 => pitshift.shift; dyno.limit(); // controller controller uhid; // time loop while (true) { t => now; } class controller { // parameters 0 => int joystick_device; // initialize HID Hid hid; HidMsg hidmsg; if (!hid.openJoystick (joystick_device) ) { <<<"Controller not found at device", joystick_device>>>; } else { <<<"Controller '" + hid.name() + "' ready.", "">>>; } // launch time loop spork ~ time_loop(); // time loop fun void time_loop() { while (true) { hid => now; while (hid.recv (hidmsg) ) { if (hidmsg.isAxisMotion() ) { if (hidmsg.which == 0) { for (int i; i dly[i].delay; } } if (hidmsg.which == 1) { 2 * hidmsg.axisPosition => pitshift.shift; } if (hidmsg.which == 2) { 4 * hidmsg.axisPosition => adc.gain; } if (hidmsg.which == 3) { 4 * hidmsg.axisPosition => dac.gain; } if (hidmsg.which == 4) { for (int i; i dly[i].gain; } } } if (hidmsg.isButtonUp() ) { if (hidmsg.which == 0) { for (int i; i dac; } } if (hidmsg.which == 1) { for (int i; i input; } } } if (hidmsg.isButtonDown() ) { if (hidmsg.which == 0) { for (int i; i