diff options
| author | Gary Scavone <gary@music.mcgill.ca> | 2014-07-15 15:29:41 -0400 |
|---|---|---|
| committer | Gary Scavone <gary@music.mcgill.ca> | 2014-07-15 15:29:41 -0400 |
| commit | 770b57260dc7607b75776e8bee7e059aa06435dc (patch) | |
| tree | 19ffa71f541bc6dc35ce75eebd478bfc4109b883 /RtMidi.cpp | |
| parent | ce21fe6205e42063f74443a12558f447ed0a5959 (diff) | |
Reverted OS-X sendMessage function for sysex messages > 1024 bytes, as the MIDIReceived() function does not work for such.
Diffstat (limited to 'RtMidi.cpp')
| -rw-r--r-- | RtMidi.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
@@ -991,10 +991,10 @@ void MidiOutCore :: openVirtualPort( std::string portName ) // Not necessary if we don't treat sysex messages any differently than // normal messages ... see below. -//static void sysexCompletionProc( MIDISysexSendRequest *sreq ) -//{ -// free( sreq ); -//} +static void sysexCompletionProc( MIDISysexSendRequest *sreq ) +{ + free( sreq ); +} void MidiOutCore :: sendMessage( std::vector<unsigned char> *message ) { @@ -1013,12 +1013,16 @@ void MidiOutCore :: sendMessage( std::vector<unsigned char> *message ) CoreMidiData *data = static_cast<CoreMidiData *> (apiData_); OSStatus result; - /* - // I don't think this code is necessary. We can send sysex - // messages through the normal mechanism. In addition, this avoids - // the problem of virtual ports not receiving sysex messages. + ///* + // It would be nice if the following "special-case" code for sysex + // messages longer than 1024 bytes wasn't necessary. In fact, we + // can send sysex messages through the normal messaging mechanism. + // However, that does not work for messages greater than 1024 + // bytes. From a previous note, there may be a problem of virtual + // ports not receiving sysex messages when using this section of + // code. - if ( message->at(0) == 0xF0 ) { + if ( message->at(0) == 0xF0 && nBytes > 1022 ) { // Apple's fantastic API requires us to free the allocated data in // the completion callback but trashes the pointer and size before @@ -1049,12 +1053,12 @@ void MidiOutCore :: sendMessage( std::vector<unsigned char> *message ) } return; } - else if ( nBytes > 3 ) { + else if ( message->at(0) != 0xF0 && nBytes > 3 ) { errorString_ = "MidiOutCore::sendMessage: message format problem ... not sysex but > 3 bytes?"; error( RtMidiError::WARNING, errorString_ ); return; } - */ + //*/ MIDIPacketList packetList; MIDIPacket *packet = MIDIPacketListInit( &packetList ); |
