diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2012-01-06 22:36:00 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2012-01-06 22:36:00 +0000 |
commit | 161c33a84fc504042b6e68e06866ce09623dde6d (patch) | |
tree | 4009d931d5395150d50587fc2d9f467dca1f8276 /libs | |
parent | 28df3238c224c4c9a5dd855b1c4219d44969f5d2 (diff) |
adjust computation of non-beat aligned tempo change, and let TempoMap::dump() be used "wherever"
git-svn-id: svn://localhost/ardour2/branches/3.0@11178 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/tempo.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc index b00fffb3e0..5e694b1541 100644 --- a/libs/ardour/tempo.cc +++ b/libs/ardour/tempo.cc @@ -936,8 +936,13 @@ TempoMap::_extend_map (TempoSection* tempo, MeterSection* meter, /* back up to previous beat */ current_frame -= beat_frames; + /* set tempo section location based on offset from last beat */ - tempo->set_frame (current_frame + (ts->bar_offset() * beat_frames)); + + double bar_offset_in_beats = (ts->bar_offset() * meter->divisions_per_bar()) - 1; + bar_offset_in_beats -= current.beats; + tempo->set_frame (current_frame + (bar_offset_in_beats * beat_frames)); + /* advance to the location of the new (adjusted) beat */ current_frame += (ts->bar_offset() * beat_frames) + ((1.0 - ts->bar_offset()) * next_beat_frames); /* next metric doesn't have to @@ -1602,7 +1607,7 @@ TempoMap::set_state (const XMLNode& node, int /*version*/) void TempoMap::dump (std::ostream& o) const { - Glib::RWLock::ReaderLock lm (lock); + Glib::RWLock::ReaderLock lm (lock, Glib::TRY_LOCK); const MeterSection* m; const TempoSection* t; |