CoreMIDI SysEx & MIDIMonitor
CoreMIDI SysEx & MIDIMonitor
- Subject: CoreMIDI SysEx & MIDIMonitor
- From: "David A. Hoatson" <email@hidden>
- Date: Wed, 30 Aug 2006 10:10:21 -0700
- Organization: Lynx Studio Technology, Inc.
Hello,
I have been trying to create an application that can send
and receive MIDI SysEx messages using various MIDI hardware (USB or Firewire
MIDI ports).
I seem to be able to send SysEx messages without problem
(I can see the messages coming from my app into a Windows box running MIDIOx and
they look fine). When I try to receive SysEx messages they are either
broken up into 3 or 4 byte packets (using a Roland UM1 and the Roland driver),
or they don't come in at all (using a Firewire device based on the BridgeCo
DM1500 and the standard Apple driver). Sometimes the 3 or 4 byte packets
seem to get 'stuck' in the MIDI driver as I'll see the first part of the SysEx
message, then the rest of it doesn't come in until more bytes are written
out.
I figured I was going insane since the code works just
fine for everything else... until...
I launched MIDIMonitor - and while MIDIMonitor is running
(but not even displaying any info in the MIDIMonitor window) instantly my code
starts receiving full MIDI SysEx message (not broken into 3 or 4 byte packets)
and the Firewire I/F starts working perfectly.
My code for setting up the MIDI couldn't be simpler
(right from Echo.cpp):
Status = MIDIClientCreate( CFSTR("MyMidiClient"), NULL,
NULL, &m_Client );
Status = MIDIInputPortCreate( m_Client,
CFSTR("MyInputPort"), ReadProc, (void *)this, &m_InputPort );
Status =
MIDIOutputPortCreate( m_Client, CFSTR("MyOutputPort"), &m_OutputPort
);
... I find the source I want to use, then...
Status = MIDIPortConnectSource( m_InputPort,
SourceEndpointRef, (void *)pByteQueue );
... and here is the ReadProc ...
void ReadProc( const MIDIPacketList *pPacketList,
void *readProcRefCon, void *srcConnRefCon )
{
CByteQueue *pByteQueue = (CByteQueue
*)srcConnRefCon;
MIDIPacket *pCurrentPacket = (MIDIPacket
*)(&pPacketList->packet[0]);
for( int i=0; i<(int)pPacketList->numPackets;
i++ )
{
pByteQueue->Add(
(PBYTE)&pCurrentPacket->data, pCurrentPacket->length
);
pCurrentPacket =
MIDIPacketNext(pCurrentPacket);
}
}
Any clues as to what might be going on with my poor -
simple - code? What magic does MIDIMonitor endow?
This is on a G5 with 10.4.7 & Xcode 2.4.
Thank you,
David A. Hoatson
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden