summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authornick_m <mainsbridge@gmail.com>2016-06-12 02:46:13 +1000
committernick_m <mainsbridge@gmail.com>2016-06-12 02:46:13 +1000
commit24f64b3ea7386ace6d584503fe1397eb4f611dfe (patch)
treeac125d61129d2a005c6e02e5dfdb70dc74976359 /libs
parente973e39f06c81fc301c8b059c5240cc17c6671ad (diff)
Make exact beat calculation of tempi a bit less cumbersome. Move tempi on an audio basis for non-musical snap.
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/tempo.cc18
1 files changed, 15 insertions, 3 deletions
diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc
index 15323751b4..0ed5a01459 100644
--- a/libs/ardour/tempo.cc
+++ b/libs/ardour/tempo.cc
@@ -2531,6 +2531,14 @@ void
TempoMap::gui_move_tempo (TempoSection* ts, const framepos_t& frame, const int& sub_num)
{
Metrics future_map;
+ bool was_musical = ts->position_lock_style() == MusicTime;
+
+ if (sub_num == 0 && was_musical) {
+ /* if we're not snapping to music,
+ AudioTime and MusicTime may be treated identically.
+ */
+ ts->set_position_lock_style (AudioTime);
+ }
if (ts->position_lock_style() == MusicTime) {
{
@@ -2539,16 +2547,16 @@ TempoMap::gui_move_tempo (TempoSection* ts, const framepos_t& frame, const int&
TempoSection* tempo_copy = copy_metrics_and_point (_metrics, future_map, ts);
double beat = beat_at_frame_locked (future_map, frame);
- if (sub_num > 0) {
+ if (sub_num > 1) {
beat = floor (beat) + (floor (((beat - floor (beat)) * (double) sub_num) + 0.5) / sub_num);
- } else if (sub_num == -2) {
+ } else if (sub_num == 1) {
/* snap to beat */
beat = floor (beat + 0.5);
}
double pulse = pulse_at_beat_locked (future_map, beat);
- if (sub_num == -3) {
+ if (sub_num == -1) {
/* snap to bar */
pulse = floor (pulse + 0.5);
}
@@ -2571,6 +2579,10 @@ TempoMap::gui_move_tempo (TempoSection* ts, const framepos_t& frame, const int&
}
}
+ if (sub_num == 0 && was_musical) {
+ ts->set_position_lock_style (MusicTime);
+ }
+
Metrics::const_iterator d = future_map.begin();
while (d != future_map.end()) {
delete (*d);