From ce3ae4cdc97df0cd0a412fa527764b89d9731e69 Mon Sep 17 00:00:00 2001 From: nick_m Date: Tue, 25 Oct 2016 04:14:14 +1100 Subject: [PATCH] remove unnecessary rounding from MidiSource::midi_read() - we already have start_beats, so don't try to recalculate something similar for the position comparison. --- libs/ardour/midi_source.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/libs/ardour/midi_source.cc b/libs/ardour/midi_source.cc index a770a2c290..a8491e06a1 100644 --- a/libs/ardour/midi_source.cc +++ b/libs/ardour/midi_source.cc @@ -199,8 +199,7 @@ MidiSource::midi_read (const Lock& lm, const double start_beats) const { //BeatsFramesConverter converter(_session.tempo_map(), source_start); - const int32_t tpb = Timecode::BBT_Time::ticks_per_beat; - const double pulse_tick_res = floor ((pulse * 4.0 * tpb) + 0.5) / tpb; + const double start_qn = (pulse * 4.0) - start_beats; DEBUG_TRACE (DEBUG::MidiSourceIO, @@ -257,7 +256,7 @@ MidiSource::midi_read (const Lock& lm, * some way (maybe keep an iterator per playlist). */ for (i = _model->begin(); i != _model->end(); ++i) { - if (floor (((i->time().to_double() + start_qn) * tpb) + 0.5) / tpb >= pulse_tick_res) { + if (i->time().to_double() >= start_beats) { break; } } @@ -275,10 +274,9 @@ MidiSource::midi_read (const Lock& lm, // Offset by source start to convert event time to session time - framecnt_t time_frames = _session.tempo_map().frame_at_quarter_note (i->time().to_double() + start_qn); - - if (time_frames < (start + source_start)) { + framepos_t time_frames = _session.tempo_map().frame_at_quarter_note (i->time().to_double() + start_qn); + if (time_frames < start + source_start) { /* event too early */ continue;