Mercurial > hg > svcore
diff data/fileio/MIDIFileWriter.cpp @ 1007:ba404199345f tonioni
Merge from default branch
author | Chris Cannam |
---|---|
date | Mon, 10 Nov 2014 09:19:49 +0000 |
parents | 0d3d1ec7dfde |
children | cc27f35aa75c |
line wrap: on
line diff
--- a/data/fileio/MIDIFileWriter.cpp Tue Sep 09 16:36:21 2014 +0100 +++ b/data/fileio/MIDIFileWriter.cpp Mon Nov 10 09:19:49 2014 +0000 @@ -317,7 +317,6 @@ m_numberOfTracks = 1; int track = 0; - int midiChannel = 0; MIDIEvent *event; @@ -349,10 +348,14 @@ int duration = i->duration; int pitch = i->midiPitch; int velocity = i->velocity; + int channel = i->channel; if (pitch < 0) pitch = 0; if (pitch > 127) pitch = 127; + if (channel < 0) channel = 0; + if (channel > 15) channel = 0; + // Convert frame to MIDI time double seconds = double(frame) / double(m_sampleRate); @@ -370,13 +373,13 @@ // in place). event = new MIDIEvent(midiTime, - MIDI_NOTE_ON | midiChannel, + MIDI_NOTE_ON | channel, pitch, velocity); m_midiComposition[track].push_back(event); event = new MIDIEvent(endTime, - MIDI_NOTE_OFF | midiChannel, + MIDI_NOTE_OFF | channel, pitch, 127); // loudest silence you can muster