From: Jeff W. <jww...@ya...> - 2004-08-27 01:33:58
|
Hiroo, After taking care of family business last night I was finally able to find some time to work on a simple fix for the SysexWiget.sendSysex method. I'm guessing this is probably pretty close to what you had in mind. The SysexMessage handles sysex only and ShortMessage handles everything else. Also--the current version sends 0xF0 0xF7 even if the InvalidMidiDataException occurs. I assumed that it shouldn't send anything when the exception occurs so I moved driver.send(m) inside the try block. Now nothing will get sent on an exception. protected void sendSysex(SysexSender s, int v) { if (s != null) { // do it only if there is a sysex-sender available s.channel = (byte) device.getDeviceID(); byte[] sysex = s.generate(v); try { MidiMessage m; if (sysex[0] == (byte)0xF0) { m = new SysexMessage(); ((SysexMessage)m).setMessage(sysex, sysex.length); } else { m = new ShortMessage(); ((ShortMessage)m).setMessage(sysex[0], sysex[1], sysex[2]); } driver.send(m); } catch (InvalidMidiDataException e) { ErrorMsg.reportStatus(e); } } } I haven't done extensive testing with it but I used my Midi Monitor program to watch the MIDI datastream. I tested with the Bass Pod and I also loaded up the Yamaha TX81z and tested with that one. The Pod sends CC messages and the Yamaha sends sysex, just like they're supposed to. If you have any suggestions let me know, or else feel free to make changes yourself if you feel so inclined. I don't have write access to the CVS repository yet (I just sent you another email requesting it), so if you want to go ahead and patch this in yourself, feel free. Otherwise I can put in a commit later. Thanks, Jeff _______________________________ Do you Yahoo!? Express yourself with Y! Messenger! Free. Download now. http://messenger.yahoo.com |