diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2012-01-07 02:44:41 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2012-01-07 02:44:41 +0000 |
commit | ba00aba51c779f2cd16dffb52808d3930c2f1eaf (patch) | |
tree | 933d96e9af18e1da9fd66b100f7ad7f5d9671cfc /libs | |
parent | 6a154f9de62fe35a1ec090e509b9138f1eb60994 (diff) |
fix positioning of grid line after a non-beat aligned tempo change
git-svn-id: svn://localhost/ardour2/branches/3.0@11182 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/tempo.cc | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc index 1247f1e806..363930ac80 100644 --- a/libs/ardour/tempo.cc +++ b/libs/ardour/tempo.cc @@ -951,8 +951,20 @@ TempoMap::_extend_map (TempoSection* tempo, MeterSection* meter, tempo->set_frame (bar_start_frame + llrint ((ts->bar_offset() * meter->divisions_per_bar() * 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); + /* advance to the location of + * the new (adjusted) beat. do + * this by figuring out the + * offset within the beat that + * would have been there + * without the tempo + * change. then stretch the + * beat accordingly. + */ + + double offset_within_old_beat = (tempo->frame() - current_frame) / beat_frames; + + current_frame += (offset_within_old_beat * beat_frames) + ((1.0 - offset_within_old_beat) * next_beat_frames); + /* next metric doesn't have to * match this precisely to * merit a reloop ... |