I think it's customary to wait on a midi event instead of regular pauses,
like:
min => now;
while( min.recv( msg ) )
(...)
Check out the midi section in the docs:
http://chuck.cs.princeton.edu/doc/language/event.html#midi
On Thu, Oct 23, 2014 at 3:59 AM, Peter Lutek
On 2014-10-22 13:12, Moisés Gabriel Cachay Tello wrote:
In order to advance 'now' and make it eventually equal or higher than 'later' you should put inside your loop something like:
now + 5::second => time later; while(now < later) { ... 1::second => now; }
ok, so now it works sometimes, but other times ChucK crashes, with this error: chuck: pthread_mutex_lock.c:62: __pthread_mutex_lock: Assertion `mutex->__data.__owner == 0' failed.
any clues?
here's the code, as it stands:
/////////
// set up MIDI MidiIn min; MidiOut mout; MidiMsg msgin; MidiMsg msgout;
// connect to port 1 and print result <<<"","">>>; <<<"MIDI-in then MIDI-out:","">>>; <<< min.open(1),"" >>>; <<< mout.open(1),"" >>>; <<<"","">>>;
dur beat;
now + 30::second => time later; while( now < later ){ if( min.recv(msgin) ){ ( msgin.data3 + 10 ) * 50::ms => beat; <<<beat>>>; } 50::ms => now; } <<<"done">>>;
//////////
thanks for any help... cheers!
.pltk.
-- Peter Lutek improvising musician in Toronto, Canada http://peterlutek.com _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
-- Release me, insect, or I will destroy the Cosmos!