mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-19 05:06:31 +01:00
remove unnecessary rounding from MidiSource::midi_read()
- we already have start_beats, so don't try to recalculate something similar for the position comparison.
This commit is contained in:
parent
20d02c4c68
commit
ce3ae4cdc9
1 changed files with 4 additions and 6 deletions
|
|
@ -199,8 +199,7 @@ MidiSource::midi_read (const Lock& lm,
|
||||||
const double start_beats) const
|
const double start_beats) const
|
||||||
{
|
{
|
||||||
//BeatsFramesConverter converter(_session.tempo_map(), source_start);
|
//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;
|
const double start_qn = (pulse * 4.0) - start_beats;
|
||||||
|
|
||||||
DEBUG_TRACE (DEBUG::MidiSourceIO,
|
DEBUG_TRACE (DEBUG::MidiSourceIO,
|
||||||
|
|
@ -257,7 +256,7 @@ MidiSource::midi_read (const Lock& lm,
|
||||||
* some way (maybe keep an iterator per playlist).
|
* some way (maybe keep an iterator per playlist).
|
||||||
*/
|
*/
|
||||||
for (i = _model->begin(); i != _model->end(); ++i) {
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -275,10 +274,9 @@ MidiSource::midi_read (const Lock& lm,
|
||||||
|
|
||||||
// Offset by source start to convert event time to session time
|
// 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);
|
framepos_t time_frames = _session.tempo_map().frame_at_quarter_note (i->time().to_double() + start_qn);
|
||||||
|
|
||||||
if (time_frames < (start + source_start)) {
|
|
||||||
|
|
||||||
|
if (time_frames < start + source_start) {
|
||||||
/* event too early */
|
/* event too early */
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue