From: Jeff W. <jww...@ya...> - 2005-02-14 00:56:25
|
Just a note Mac OSX signal errors. I tried Plumstone but was unable to get it working. However I did some experimentation with CAProvider yesterday and discovered a couple of modifications to the core.MidiUtil.java class that will at least cut down on the frequency of signal errors. First of all, I was having a lot of problems with the Behringer FCB1010. This device only has one type of patch with a length of 2352. Since it's a fairly large patch and since I wasn't getting as many signal errors as with the other devices, I suspected that the problem might be some kind of a timing issue. First, I changed the value of BUFSIZE from 0 to 256 which causes the MIDI data to be sent in multiple blocks of 256 bytes. Then I added a 100 millisecond delay at the end of the send(Receiver rcv, MidiMessage msg) method. The whole thing looks like this: /** * MIDI Output buffer size. If set to '0', Whole Sysex data is * sent in one packet. Set '0' unless you have problem. */ private static final int BUFSIZE = 256; /** * Send a <code>MidiMessage</code>. If BUFSIZE is non-zero, data * size will be limited to the size. */ public static void send(Receiver rcv, MidiMessage msg) throws MidiUnavailableException, InvalidMidiDataException { int size = msg.getLength(); if (BUFSIZE == 0 || size <= BUFSIZE) { rcv.send(msg, -1); log("XMIT: ", msg); } else { // divide large System Exclusive Message into multiple // small messages. byte[] sysex = msg.getMessage(); byte[] tmpArray = new byte[BUFSIZE + 1]; for (int i = 0; size > 0; i += BUFSIZE, size -= BUFSIZE) { int s = Math.min(size, BUFSIZE); if (i == 0) { System.arraycopy(sysex, i, tmpArray, 0, s); ((SysexMessage) msg).setMessage(tmpArray, s); } else { tmpArray[0] = (byte) SysexMessage.SPECIAL_SYSTEM_EXCLUSIVE; System.arraycopy(sysex, i, tmpArray, 1, s); ((SysexMessage) msg).setMessage(tmpArray, ++s); } rcv.send(msg, -1); log("XMIT: ", msg); try { Thread.sleep (100); } catch (Exception e) {} } } } I realize this is only a temporary workaround. While it doesn't totally eliminate signal errors I'm getting way fewer of them than I was getting. I have only made these changes to my local copy and I don't plan on committing the changes, since they would only apply to Mac users and would only be a temporary workaround at best. But for any of you who are Mac users and don't want to use Plumstone, this might be another alternative. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |