[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[sc-dev] Re: [sc-users] MIDI event handler threads
While working on the MIDI helpfile, I found an issue with this: there's
no clearly defined way to stop a responder. You can stop the routine,
of course, but you still have the MIDIEvent in the MIDIIn classvars, so
its conditions still have to be evaluated even after the routine is
gone. Very untidy.
I guess the user can do something like:
onRoutine = fork { |ev| loop { ev = MIDIIn.waitNoteOn; } };
onEvent = MIDIIn.noteOnList.last;
...
onRoutine.stop; MIDIIn.noteOnList.remove(onEvent);
... but that's a bit hacky, isn't it?
Can the MIDIEvent perhaps detect when the routine has ended and remove
itself? Just thinking out loud...
hjh
On Thursday, Dec 2, 2004, at 04:28 US/Eastern, James McCartney wrote:
You can now fork a thread to wait for MIDI events.
This allows you to write MIDI event handlers as loops.
The old classvar functions continue to work, nothing should be broken
by this.
____________________________________
H. James Harkins /// dewdrop_world
http://www.dewdrop-world.net
"If attacked by a lion, thrust your arm down his throat.
This takes some practice." -- Cyril Connolly