From: Joe E. <jo...@em...> - 2005-10-10 22:02:13
|
Joachim Backhaus wrote: >How does the XML format look like? >Can you post an example? > > Yeah. I'll try to post it later today. >>2 - I've also changed the way sysex messages are delivered to the >>drivers. I think that this new design is much better and more >>flexible.... but, again, my *implementation* of it might have >>some bugs. >> >> > >Can you explain the changes a bit deeper? > > Well, I'll explain the problem I had to solve, first. I was writing a bank-driver for a device and it turned out that I had to request a bank from the device by requesting each of the individual patches individually. This presented timing issues because, if I requested the next patch before the last one was done sending, the patch data could get interrupted, etc. So, I needed to do something in my bank driver like: for(int i=0; i<patches; i++) { send( /* sysex bytes to request patch # i */ ); sleep( some number of milliseconds ); } This isn't a good solution, because the sleep time has to be made long enough to accomodate the worst-case scenario. So, it ended up resulting in some long waits while I received a bank. The reason for all of this seems to be due to how SysexGetDialog works. It sends the sysex request, and then starts polling MidiUtil to keep track of the bytes received. Then, when the user presses "Done", then SysexGetDialog tries to deliver the sysex message(s) to the driver. In my opinion, there are three problems with this: 1 - The driver doesn't get updates as sysex data is coming in (to allow the driver to send the request for the next patch immediately after the last one came in). 2 - Polling is wasteful. 3 - An additional problem is that MidiUtil only seems to make *sysex* messages available to the rest of the parts of JSL... stripping out all other midi messages. This limits the usefulness of MidiMonitor. What I did was change MidiUtil so that any other class could ask to be notified when any complete midi message was received. This way, multiple parts of JSL (SysexGetDialog, MidiMonitor, individual drivers, etc) could request to be notified when a message was received. Additionally, each "listener" could specify a filter (much like how java.io.FilenameFilter works) which would let them specify which messages they were notified of (which would allow MidiMonitor to give the user checkboxes to enable/disable note-on/off, CC, PC, etc. messages. Because this makes the midi message delivery within JSL more efficient and flexible, I was able to do things like giving the individual synth drivers access to a progress bar in SysexGetDialog, so that it could accurate represent how much of the patch/bank request was complete. - Joe |