Re: sending sysex as more fragments
Re: sending sysex as more fragments
- Subject: Re: sending sysex as more fragments
- From: Doug Wyatt <email@hidden>
- Date: Fri, 5 Apr 2002 13:01:29 -0800
This could be a driver bug. The USB MIDI encoding has a special case
for unterminated sysex fragments of less than 3 bytes. Our sample
driver code had a bug where it didn't handle this case properly, but I
believe it was fixed as of the December developer CD.
I don't know offhand how the Java wrappers are translating into calls to
MIDIPacketListAdd, but there was also a bug there involving sysex -- but
it shouldn't hit you if you are only putting one packet in a packetlist.
It might be worth writing a simple console app to create a virtual
destination and dump input to the console, then have your Java app send
to the virtual destination. You should be able to verify that you are
receiving what you are sending, and if you are, that indicates that the
MIDI API's are working correctly and that the next place to look is the
driver.
Doug
On Friday, April 5, 2002, at 06:01 , Petr Antos wrote:
Hi all,
I need to send sysex message fragmented to more
small byte streams with some delay inserted between them.
How can I do this ?????
I have tested almost all I can, but without any success.
In CoreAudioAPI reference there is written that MIDIPacket
can contain "SYSEX OR PORTION OF IT". When I am
trying to send for ex. "F0 01 02", this is sent OK (and my
MIDIMAN MIDISPORT 1x1 driver trace messages says
that we are in sysex with new current status byte ...).
BUT when I am trying to send next MIDIPacket containing "03 04 05",
then only first 2 bytes are sent and all subsequent "databyte" packets
are not sent at all ........
I have unsuccessfuly tested Send and SysexSendRequest methods ....
Below is my code in Java which obtains general JavaSound MidiMessage
structure where sysex fragments are denoted by "special system
exclusive"
"status" byte, which is skipped, of course .... I need this
functionality
because
I need to insert some delay while sending sysex and because I need to
implement my own platform independent asynchronous/queued nonrealtime
message send / receive library. In fact, library for now perfectly works
with
JavaSound and underlying WireProvider (JS midiports implementation for
Win32).
Thanks a lot
Petr
----------------------------------------------------------------------------
-------
protected final void put(MidiMessage msg)
{
try
{
byte[] data = msg.getMessage(); // JavaSound data structure -
sysex
fragments have 0xF7 as "status" !!!!!!!!
int offset = (data[0]==(byte)0xF7) ? 1 : 0;
MIDIData mididata = MIDIData.newMIDIRawData(data.length - offset);
Debug.print("*** PUT: ");
for(int j=offset; j<data.length; j++) { Debug.print($H(data[j] &
0xFF)+" "); mididata.addRawData(data[j]); };
Debug.println("");
MIDIPacketList packetlist = new MIDIPacketList(0, mididata);
out.send(dst, packetlist);
// MIDISysexSendRequest request = new MIDISysexSendRequest(dst,
mididata);
// request.send(null);
// do {} while (request.getBytesToSend()>0);
// do {} while (!request.isComplete());
// delay for asure to see the MIDISPORT 1x1 OUT LED blink :-)
Thread.sleep(1000); // SMALL TEST MESSAGES ONLY !!!!!! (we are in
separate thread !!!)
}
catch (Exception e) { Debug.println("*** PUT exception "); }
}
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.
--
Doug Wyatt
work: email@hidden (CoreAudio)
personal: email@hidden
http://www.sonosphere.com
"When you discard arrogance, complexity, and a few other things that get
in
the way, sooner or later you will discover that simple, childlike, and
mysterious secret known to those of the Uncarved Block: Life is Fun."
-- The Tao of Pooh
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.