My compliments to the community. Maybe someone will be able to tell what am I wrong?
Why is the result of the function MidiMessageSequence::extractMidiChannelMessages extract the wrong& Not events for the specified MIDI channel, but any midi-events for any midi channel...
int midiTracksCount = MIDIFile.getNumTracks(); if (midiTracksCount == 1) //for MIDI format 0; { MidiMessageSequence* TrackSequence = MIDIFile.getTrack(0); MidiMessageSequence mmSeq = MidiMessageSequence(); int midiChan = 1; TrackSequence->extractMidiChannelMessages( midiChan, mmSeq, true); ExportToXmlFile(midiChan, &mmSeq); // TEST FUNCTION FOR RESULT PREVIEW }
Result:
<?xml version="1.0" encoding="UTF-8"?> <MIDI_EVENTS> <PROGRAMM_CHANGE ProgChangeNum="0" InstrName="Acoustic Grand Piano"/> <PROGRAMM_CHANGE ProgChangeNum="35" InstrName="Fretless Bass"/> <PROGRAMM_CHANGE ProgChangeNum="18" InstrName="Rock Organ"/> <PROGRAMM_CHANGE ProgChangeNum="80" InstrName="Lead 1 (square)"/> <PROGRAMM_CHANGE ProgChangeNum="60" InstrName="French Horn"/> <PROGRAMM_CHANGE ProgChangeNum="56" InstrName="Trumpet"/> <PROGRAMM_CHANGE ProgChangeNum="59" InstrName="Muted Trumpet"/> <PROGRAMM_CHANGE ProgChangeNum="60" InstrName="French Horn"/> <PROGRAMM_CHANGE ProgChangeNum="25" InstrName="Acoustic Guitar (steel)"/> <PROGRAMM_CHANGE ProgChangeNum="29" InstrName="Overdriven Guitar"/> <PROGRAMM_CHANGE ProgChangeNum="25" InstrName="Acoustic Guitar (steel)"/> <PROGRAMM_CHANGE ProgChangeNum="29" InstrName="Overdriven Guitar"/> <PROGRAMM_CHANGE ProgChangeNum="64" InstrName="Soprano Sax"/> <NOTE_ON noteOnKey="63" noteOnPos="384" noteOnVel="68" MidiChan="1"/> <NOTE_ON noteOnKey="60" noteOnPos="384" noteOnVel="65" MidiChan="1"/> <NOTE_ON noteOnKey="67" noteOnPos="384" noteOnVel="76" MidiChan="1"/> <NOTE_ON noteOnKey="36" noteOnPos="384" noteOnVel="116" MidiChan="2"/> <NOTE_ON noteOnKey="72" noteOnPos="384" noteOnVel="70" MidiChan="3"/> <NOTE_ON noteOnKey="60" noteOnPos="384" noteOnVel="65" MidiChan="9"/> <NOTE_ON noteOnKey="36" noteOnPos="384" noteOnVel="96" MidiChan="10"/> <NOTE_ON noteOnKey="69" noteOnPos="384" noteOnVel="47" MidChan="10"/> <NOTE_ON noteOnKey="42" noteOnPos="384" noteOnVel="86" MidiChan="10"/> <NOTE_ON noteOnKey="60" noteOnPos="384" noteOnVel="109" MidiChan="11"/> <NOTE_OFF noteOffKey="42" noteOffPos="389" noteOffVel="0" MidiChan="10"/> <NOTE_OFF noteOffKey="69" noteOffPos="389" noteOffVel="0" MidiChan="10"/> <NOTE_OFF noteOffKey="36" noteOffPos="389" noteOffVel="0" MidiChan="10"/> <NOTE_ON noteOnKey="69" noteOnPos="408" noteOnVel="27" MidiChan="10"/> <NOTE_OFF noteOffKey="67" noteOffPos="412" noteOffVel="0" MidiChan="1"/> <NOTE_OFF noteOffKey="63" noteOffPos="412" noteOffVel="0" MidiChan="1"/> <NOTE_OFF noteOffKey="69" noteOffPos="413" noteOffVel="0" MidiChan="10"/> <NOTE_OFF noteOffKey="60" noteOffPos="414" noteOffVel="0" MidiChan="1"/> <NOTE_ON noteOnKey="60" noteOnPos="430" noteOnVel="55" MidiChan="1"/> <NOTE_ON noteOnKey="63" noteOnPos="432" noteOnVel="56" MidiChan="9"/> <NOTE_ON noteOnKey="70" noteOnPos="432" noteOnVel="85" MidiChan="10"/> <NOTE_ON noteOnKey="62" noteOnPos="432" noteOnVel="75" MidiChan="11"/> <NOTE_OFF noteOffKey="60" noteOffPos="434" noteOffVel="0" MidiChan="11"/> etc...