// // A variable delay program // // Currently, the mouse buttons do the following: // // left: start recording a loop // right: stop recording the loop and start playing it back // middle: stop doing anything // // Loops can't be more than 40 seconds // // if you have multiple mice, and it's finding the wrong one, try // changing the '0 => int device' line to 1 or 2 or something // adc => LiSa l => dac; 40::second => l.duration; 1 => l.loop; 0 => int device; int base; Hid hi; HidMsg msg; if( !hi.openMouse( device ) ) me.exit(); <<< "mouse '" + hi.name() + "' ready...", "" >>>; while( true ) { // wait on event hi => now; // loop over messages while( hi.recv( msg ) ) { if( msg.isButtonDown() ) { msg.which => base; if (base == 0) { <<<"recording">>>; 0 => l.play; 1 => l.record; l.playPos() => l.loopStart; l.playPos() => l.recPos; } else if (base == 1) { <<<"looping">>>; l.recPos() => l.loopEnd; l.recPos() => l.playPos; 0 => l.record; 1 => l.play; } else if (base == 2) { <<<"stopped">>>; 0 => l.record; 0 => l.play; } } } }