Erik,
    My previous answer was sent before I saw some additional email. In 
the Win32 MME MIDI API, MIDI data is sent in packets to the driver with 
increasing timestamps. In principle, the driver could accept data out of 
order, but it makes sense to create a design where the device driver can 
process data incrementally with a constant time and space per MIDI 
message. Any attempt to do more than this in PortMidi would end up 
looking like the Python code you sent -- another thread, scheduling at 
the application layer, and some difficult questions about thread 
priority, latency, and overhead. It's also possible to do this without 
adding a thread -- just structure the application to do things in time 
order. E.g. if you're reading a sequence of notes and trying to send 
note-on and note-off messages, put the note-off messages in a priority 
queue and read them out in time order. To deal with note-ons, put a 
"read the next note and send note-on/note-off messages" event in the 
priority queue for the next note in the sequence.
    -Roger

_______________________________________________
media_api mailing list
media_api@create.ucsb.edu
http://lists.create.ucsb.edu/mailman/listinfo/media_api

Reply via email to