sending sysex as more fragments
sending sysex as more fragments
- Subject: sending sysex as more fragments
- From: Petr Antos <email@hidden>
- Date: Fri, 5 Apr 2002 16:01:24 +0200
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.