summaryrefslogtreecommitdiff
path: root/libs/ardour/smf_source.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2011-12-10 13:48:50 +0000
committerCarl Hetherington <carl@carlh.net>2011-12-10 13:48:50 +0000
commit2a9ceb74c4f8ec316c639722c371e5bcb78de548 (patch)
treea7bf7e6c96aab8aaad050d4ead9a383071710985 /libs/ardour/smf_source.cc
parent1390a1510da934ab7b7d10560f16fe6daf01b355 (diff)
Compute delta time correctly when appending events; the converter must be used to convert a source time, not a delta time, otherwise tempo / meter changes are not correctly accounted for.
git-svn-id: svn://localhost/ardour2/branches/3.0@10963 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/smf_source.cc')
-rw-r--r--libs/ardour/smf_source.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/libs/ardour/smf_source.cc b/libs/ardour/smf_source.cc
index b33fb16f48..52377ee915 100644
--- a/libs/ardour/smf_source.cc
+++ b/libs/ardour/smf_source.cc
@@ -369,9 +369,9 @@ SMFSource::append_event_unlocked_frames (const Evoral::Event<framepos_t>& ev, fr
_length_beats = max(_length_beats, ev_time_beats);
- const framepos_t delta_time_frames = ev.time() - _last_ev_time_frames;
- const double delta_time_beats = converter.from(delta_time_frames);
- const uint32_t delta_time_ticks = (uint32_t)(lrint(delta_time_beats * (double)ppqn()));
+ const Evoral::MusicalTime last_time_beats = converter.from (_last_ev_time_frames);
+ const Evoral::MusicalTime delta_time_beats = ev_time_beats - last_time_beats;
+ const uint32_t delta_time_ticks = (uint32_t)(lrint(delta_time_beats * (double)ppqn()));
Evoral::SMF::append_event_delta(delta_time_ticks, ev.size(), ev.buffer(), event_id);
_last_ev_time_frames = ev.time();