void PGMidiDevice::PGMidiInputCallback::handleIncomingMidiMessage(MidiInput *source, const MidiMessage &msg) { Logger::getCurrentLogger()->writeToLog("midiin: recv message:"); string dbg = ToHexString(msg.getRawData(), msg.getRawDataSize()); Logger::getCurrentLogger()->writeToLog(dbg); // currently, G1 should only send SysEx to app if (!msg.isSysEx()) return; const uint8 *buf = msg.getSysExData(); int size = msg.getSysExDataSize(); if (!PGSysExParser::IsPGSysEx(buf, size)) return; switch (PGSysExParser::GetOpMsb(buf, size)) { case REPLY_GRP: OwnerMidiDevice->MidiMessageBox.NotifyReply(msg); break; case ACK_GRP: case NAK_GRP: OwnerMidiDevice->MidiMessageBox.NotifyAck(msg); break; default: break; } }
void Gsp1101::handleIncomingMidiMessage(MidiInput *source, MidiMessage const& message) { MemoryBlock mb (message.getRawData(), message.getRawDataSize()); Logger::outputDebugString("\nMidiInput = " + asHex(mb)); juce::uint8 const* msgBuff = message.getSysExData(); if (!msgBuff) { lastMidiInput_M.setSize(0); return; } lastMidiInput_M = MemoryBlock(message.getSysExData(), message.getSysExDataSize()); // A sysx ACK is: // F0 00 00 10 XX XX XX 7E 00 (procedure) (checksum) F7 if (msgBuff[6] == 0x7e) {} // A sysx NACK is: // F0 00 00 10 XX XX XX 7F 00 (procedure) (err code) (checksum) F7 else if (msgBuff[6] == 0x7f) { deviceReady_M = false; // NACK error codes: #define SYSX_INVALID_CHECKSUM 7 #define MERR_OVERRUN 10 #define MIDI_PROC_FAILED 12 switch (msgBuff[9]) { case SYSX_INVALID_CHECKSUM: case MERR_OVERRUN: case MIDI_PROC_FAILED: default: break; } //Logger::outputDebugString("MidiInput error = " + String(msgBuff[9])); } else {} }