SndBuf bufa; SndBuf bufb => dac; 0 => int metronomeswitch; int mnomeID; 500 => int BPM; while( true ) { checkbuttons(); 1::samp => now; } fun void checkbuttons() { Hid hi; HidMsg msg; if(!hi.openKeyboard( 0 ) ) me.exit(); hi => now; while( hi.recv ( msg ) ) { if( msg.isButtonDown() ) { if( msg.which == 16 ) { if( metronomeswitch == 0 ) { spork ~ metronome(); 1 => metronomeswitch; } else { Machine.remove( mnomeID ); 0 => metronomeswitch; } } } } } fun void metronome() { Hid hi; HidMsg msg; int x; me.id() => mnomeID; if(!hi.openMouse( 0 ) ) me.exit(); hi => now; while( true ) { while( hi.recv( msg ) ) { if( msg.isMouseMotion() ) { if( msg.deltaX ) { msg.deltaX => x; if( 0 < x + BPM ) { if( x + BPM < 1500 ) { x + BPM => BPM; <<< "BPM =", ( 60 / ( BPM / 1000 ) ) >>>; } } else { <<< "BPM =", ( 60 / ( BPM / 1000 ) ) >>>; } } } } BPM::ms => now; } }