[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-dev] Re: [sc-users] MIDI event handler threads






On Dec 11, 2004, at 12:31 PM, James Harkins wrote:

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...

not really. perhaps threads should have a cleanup function. This would also handle the Pfx problem. Two indications for its need in one day - seems like destiny..