void MidiTrack::readTrackData(istream & input) { long totalTicks = 0; while (!input.eof()) { VariableLengthInt delta(input); totalTicks += delta.getValue(); MidiEvent * E = MidiEvent::parseEvent(totalTicks, delta.getValue(), input); if (E == NULL) { cout << "Event skipped!"; continue; } if (VERBOSE) { cout << E->toString().c_str(); } // Not adding the EndOfTrack event here allows the track to be edited // after being read in from file. if (E->getType() == MetaEvent::END_OF_TRACK) { break; } mEvents.push_back(E); } }
void MidiBindingDialog::onMidiEvent(RtMidiInDevice& src, MidiEvent evt) { // display info ui->lblSrcDev->setText( src.getName().c_str() ); ui->lblSrcEvt->setText( evt.getTypeString().c_str() ); ui->lblSrcChan->setText( std::to_string(evt.getChannel()).c_str() ); ui->lblSrcData->setText( ("d1=" + std::to_string(evt.getData1()) + " d2=" + std::to_string(evt.getData2())).c_str() ); // setup bindings source if (!binding) {return;} binding->src.srcName = src.getName(); binding->src.type = evt.getType(); binding->src.channel = evt.getChannel(); binding->src.d1 = evt.getData1(); }