summaryrefslogtreecommitdiff
path: root/libs/ardour/midi_model.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-06-22 19:59:46 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-06-22 19:59:46 +0000
commit8aa0b2966e498d2017bdc5f23dd51529ad0999d4 (patch)
treebe235acfd3f679ad7db4dfa85db249faafcbdd7d /libs/ardour/midi_model.cc
parent260c1c1a1360dac54c09baed692e7debb2d95125 (diff)
ignore unpaired noteoff's when writing part of a MidiModel to a new source. in reality, there should be no unpaired noteoffs, but this is still an important fix
git-svn-id: svn://localhost/ardour2/branches/3.0@9757 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/midi_model.cc')
-rw-r--r--libs/ardour/midi_model.cc25
1 files changed, 4 insertions, 21 deletions
diff --git a/libs/ardour/midi_model.cc b/libs/ardour/midi_model.cc
index b6500563ba..ce357dcd36 100644
--- a/libs/ardour/midi_model.cc
+++ b/libs/ardour/midi_model.cc
@@ -1415,7 +1415,6 @@ MidiModel::write_section_to (boost::shared_ptr<MidiSource> source, Evoral::Music
{
ReadLock lock(read_lock());
MidiStateTracker mst;
- Evoral::MusicalTime extra_note_on_time = end_time;
const bool old_percussive = percussive();
set_percussive(false);
@@ -1442,36 +1441,20 @@ MidiModel::write_section_to (boost::shared_ptr<MidiSource> source, Evoral::Music
if (mev->is_note_off()) {
if (!mst.active (mev->note(), mev->channel())) {
-
- /* add a note-on at the start of the range we're writing
- to the file. velocity is just an arbitary reasonable value.
+ /* the matching note-on was outside the
+ time range we were given, so just
+ ignore this note-off.
*/
-
- Evoral::MIDIEvent<Evoral::MusicalTime> on (mev->event_type(), extra_note_on_time, 3, 0, true);
- on.set_type (mev->type());
- on.set_note (mev->note());
- on.set_channel (mev->channel());
- on.set_velocity (mev->velocity());
-
- cerr << "Add note on for odd note off, note = " << (int) on.note() << endl;
- source->append_event_unlocked_beats (on);
- mst.add (on.note(), on.channel());
- mst.dump (cerr);
- extra_note_on_time += 1.0/128.0;
+ continue;
}
- cerr << "MIDI Note off (note = " << (int) mev->note() << endl;
source->append_event_unlocked_beats (*i);
mst.remove (mev->note(), mev->channel());
- mst.dump (cerr);
} else if (mev->is_note_on()) {
- cerr << "MIDI Note on (note = " << (int) mev->note() << endl;
mst.add (mev->note(), mev->channel());
source->append_event_unlocked_beats(*i);
- mst.dump (cerr);
} else {
- cerr << "MIDI other event type\n";
source->append_event_unlocked_beats(*i);
}
}