Tempo ramps - fix various tempo dragging issues.
authornick_m <mainsbridge@gmail.com>
Sun, 1 May 2016 20:12:33 +0000 (06:12 +1000)
committernick_m <mainsbridge@gmail.com>
Fri, 27 May 2016 13:38:16 +0000 (23:38 +1000)
gtk2_ardour/editor_drag.cc
libs/ardour/ardour/tempo.h
libs/ardour/tempo.cc

index d3f7a3c4bd0b995c2fd0594192c6d223a7de0d96..fe67b71dd258d0d916140752323538ed6e8b6466 100644 (file)
@@ -3206,7 +3206,6 @@ MeterMarkerDrag::motion (GdkEvent* event, bool first_move)
                        _editor->session()->tempo_map().gui_dilate_tempo (_real_section, pf);
                } else if (bbt.bars > _real_section->bbt().bars) {
                        const double pulse = _real_section->pulse() + (prev_m.note_divisor() / prev_m.divisions_per_bar());
-                       //const double pulse = _real_section->pulse() + (_real_section->note_divisor() / _real_section->divisions_per_bar());
                        _editor->session()->tempo_map().gui_move_meter (_real_section, pulse);
                } else if (bbt.bars < _real_section->bbt().bars) {
                        const double pulse = _real_section->pulse() - (prev_m.note_divisor() / prev_m.divisions_per_bar());
index e6f07a3772f3cf2c6000f7cb50de1742075324ca..eb6eeb3a50b4d67620dc25596702ad2ae12e4484 100644 (file)
@@ -393,7 +393,8 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
        void replace_tempo (const TempoSection&, const Tempo&, const framepos_t& frame, TempoSection::Type type);
 
        void gui_move_tempo_frame (TempoSection*, const framepos_t& frame);
-       void gui_move_tempo_beat (TempoSection*, const double& frame);
+       void gui_move_tempo_beat (TempoSection*, const double& beat);
+       void gui_move_tempo_pulse (TempoSection*, const double& pulse);
        void gui_move_meter (MeterSection*, const framepos_t& frame);
        void gui_move_meter (MeterSection*, const double& pulse);
        bool gui_change_tempo (TempoSection*, const Tempo& bpm);
index 674afe2ce90160903b2c718f31812d5a508ac1e5..7af7545b76a6f50623920adccec85e7864ac990c 100644 (file)
@@ -2400,7 +2400,7 @@ TempoMap::predict_tempo_frame (TempoSection* section, const BBT_Time& bbt)
        if (solve_map (future_map, tempo_copy, pulse_at_beat_locked (future_map, beat))) {
                ret = tempo_copy->frame();
        } else {
-               ret = frame_at_beat_locked (_metrics, beat);
+               ret = section->frame();
        }
 
        Metrics::const_iterator d = future_map.begin();
@@ -2422,7 +2422,7 @@ TempoMap::predict_tempo_pulse (TempoSection* section, const framepos_t& frame)
        if (solve_map (future_map, tempo_copy, frame)) {
                ret = tempo_copy->pulse();
        } else {
-               ret = pulse_at_frame_locked (_metrics, frame);
+               ret = section->pulse();
        }
 
        Metrics::const_iterator d = future_map.begin();
@@ -2477,6 +2477,28 @@ TempoMap::gui_move_tempo_beat (TempoSection* ts, const double& beat)
        MetricPositionChanged (); // Emit Signal
 }
 
+void
+TempoMap::gui_move_tempo_pulse (TempoSection* ts, const double& pulse)
+{
+       Metrics future_map;
+       {
+               Glib::Threads::RWLock::WriterLock lm (lock);
+               TempoSection* tempo_copy = copy_metrics_and_point (_metrics, future_map, ts);
+               if (solve_map (future_map, tempo_copy, pulse)) {
+                       solve_map (_metrics, ts, pulse);
+                       recompute_meters (_metrics);
+               }
+       }
+
+       Metrics::const_iterator d = future_map.begin();
+       while (d != future_map.end()) {
+               delete (*d);
+               ++d;
+       }
+
+       MetricPositionChanged (); // Emit Signal
+}
+
 void
 TempoMap::gui_move_meter (MeterSection* ms, const framepos_t&  frame)
 {