void MidiJackDevice::recordEvent(MidiRecordEvent& event)/*{{{*/ { if (audio->isPlaying()) event.setLoopNum(audio->loopCount()); if (midiInputTrace) { printf("Jack MidiInput: "); event.dump(); } int typ = event.type(); if (_port != -1) { //call our midimonitor with the data, it can then decide what to do monitorEvent(event); } // // process midi event input filtering and // transformation // processMidiInputTransformPlugins(event); if (filterEvent(event, midiRecordType, false)) return; if (!applyMidiInputTransformation(event)) { if (midiInputTrace) printf(" midi input transformation: event filtered\n"); return; } // // transfer noteOn events to gui for step recording and keyboard // remote control // if (typ == ME_NOTEON) { int pv = ((event.dataA() & 0xff) << 8) + (event.dataB() & 0xff); song->putEvent(pv); } //This was not sending noteoff events at all sometimes causing strange endless note in step rec else if(typ == ME_NOTEOFF) { int pv = ((event.dataA() & 0xff) << 8) + (0x00); song->putEvent(pv); } // Do not bother recording if it is NOT actually being used by a port. // Because from this point on, process handles things, by selected port. if (_port == -1) return; // Split the events up into channel fifos. Special 'channel' number 17 for sysex events. unsigned int ch = (typ == ME_SYSEX) ? kMaxMidiChannels : event.channel(); if (_recordFifo[ch].put(MidiPlayEvent(event))) printf("MidiJackDevice::recordEvent: fifo channel %d overflow\n", ch); }/*}}}*/
void MidiDevice::recordEvent(MidiRecordEvent& event) { if(MusEGlobal::audio->isPlaying()) event.setLoopNum(MusEGlobal::audio->loopCount()); if (MusEGlobal::midiInputTrace) { fprintf(stderr, "MidiInput: "); dumpMPEvent(&event); } int typ = event.type(); if(_port != -1) { int idin = MusEGlobal::midiPorts[_port].syncInfo().idIn(); //--------------------------------------------------- // filter some SYSEX events //--------------------------------------------------- if (typ == ME_SYSEX) { const unsigned char* p = event.data(); int n = event.len(); if (n >= 4) { if ((p[0] == 0x7f) && ((p[1] == 0x7f) || (idin == 0x7f) || (p[1] == idin))) { if (p[2] == 0x06) { MusEGlobal::midiSyncContainer.mmcInput(_port, p, n); return; } if (p[2] == 0x01) { MusEGlobal::midiSyncContainer.mtcInputFull(_port, p, n); return; } } else if (p[0] == 0x7e) { MusEGlobal::midiSyncContainer.nonRealtimeSystemSysex(_port, p, n); return; } } } else // Trigger general activity indicator detector. Sysex has no channel, don't trigger. MusEGlobal::midiPorts[_port].syncInfo().trigActDetect(event.channel()); } // // process midi event input filtering and // transformation // processMidiInputTransformPlugins(event); if (filterEvent(event, MusEGlobal::midiRecordType, false)) return; if (!applyMidiInputTransformation(event)) { if (MusEGlobal::midiInputTrace) fprintf(stderr, " midi input transformation: event filtered\n"); return; } // // transfer noteOn and Off events to gui for step recording and keyboard // remote control (changed by flo93: added noteOff-events) // if (typ == ME_NOTEON) { int pv = ((event.dataA() & 0xff)<<8) + (event.dataB() & 0xff); MusEGlobal::song->putEvent(pv); } else if (typ == ME_NOTEOFF) { int pv = ((event.dataA() & 0xff)<<8) + (0x00); //send an event with velo=0 MusEGlobal::song->putEvent(pv); } // Do not bother recording if it is NOT actually being used by a port. // Because from this point on, process handles things, by selected port. if(_port == -1) return; // Split the events up into channel fifos. Special 'channel' number 17 for sysex events. unsigned int ch = (typ == ME_SYSEX)? MusECore::MUSE_MIDI_CHANNELS : event.channel(); if(_recordFifo[ch].put(event)) fprintf(stderr, "MidiDevice::recordEvent: fifo channel %d overflow\n", ch); }