fix some inactive tempi bugs
authornick_m <mainsbridge@gmail.com>
Fri, 6 Jan 2017 14:12:09 +0000 (01:12 +1100)
committernick_m <mainsbridge@gmail.com>
Fri, 6 Jan 2017 14:12:09 +0000 (01:12 +1100)
- no tempo curve for inactive tempi

- inactive and meter-locked tempi cannot be deleted.

gtk2_ardour/editor_tempodisplay.cc
libs/ardour/tempo.cc

index e98959ba9d6d3114660b2b499cd26074c505a287..0d19f7228a8749fa2555c7e8ae7c594dd8f75563 100644 (file)
@@ -141,6 +141,13 @@ Editor::draw_metric_marks (const Metrics& metrics)
                (*x)->set_min_tempo (min_tempo);
                ++tmp;
                if (tmp != tempo_curves.end()) {
+
+                       if (!(*x)->tempo().active()) {
+                               (*x)->hide();
+                       } else {
+                               (*x)->show();
+                       }
+
                        (*x)->set_position ((*x)->tempo().frame(), (*tmp)->tempo().frame());
                } else {
                        (*x)->set_position ((*x)->tempo().frame(), UINT32_MAX);
@@ -243,6 +250,13 @@ Editor::marker_position_changed ()
                (*x)->set_min_tempo (min_tempo);
                ++tmp;
                if (tmp != tempo_curves.end()) {
+
+                       if (!(*x)->tempo().active()) {
+                               (*x)->hide();
+                       } else {
+                               (*x)->show();
+                       }
+
                        (*x)->set_position ((*x)->tempo().frame(), (*tmp)->tempo().frame());
                } else {
                        (*x)->set_position ((*x)->tempo().frame(), UINT32_MAX);
@@ -441,7 +455,7 @@ Editor::remove_tempo_marker (ArdourCanvas::Item* item)
                abort(); /*NOTREACHED*/
        }
 
-       if (!tempo_marker->tempo().initial()) {
+       if (!tempo_marker->tempo().locked_to_meter() && tempo_marker->tempo().active()) {
                Glib::signal_idle().connect (sigc::bind (sigc::mem_fun(*this, &Editor::real_remove_tempo_marker), &tempo_marker->tempo()));
        }
 }
index eadfe873a5218cd9bb90e2c286008992bf941b99..a7d976a9f8443470c72f0ed7215e9a2d0f6b2498 100644 (file)
@@ -743,6 +743,8 @@ TempoMap::TempoMap (framecnt_t fr)
        MeterSection *m = new MeterSection (0.0, 0.0, 0.0, start, _default_meter.divisions_per_bar(), _default_meter.note_divisor(), AudioTime, fr);
 
        t->set_initial (true);
+       t->set_locked_to_meter (true);
+
        m->set_initial (true);
 
        /* note: frame time is correct (zero) for both of these */
@@ -2609,13 +2611,12 @@ TempoMap::set_active_tempi (const Metrics& metrics, const framepos_t& frame)
                TempoSection* t;
                if ((*i)->is_tempo()) {
                        t = static_cast<TempoSection*> (*i);
-                       if (t->initial()) {
+                       if (t->locked_to_meter()) {
                                t->set_active (true);
-                               continue;
                        } else if (t->position_lock_style() == AudioTime) {
-                               if (t->active () && t->frame() < frame) {
+                               if (t->frame() < frame) {
                                        t->set_active (false);
-                                       t->set_pulse (0.0);
+                                       t->set_pulse (-1.0);
                                } else if (t->frame() > frame) {
                                        t->set_active (true);
                                } else if (t->frame() == frame) {
@@ -2806,7 +2807,7 @@ TempoMap::solve_map_minute (Metrics& imaginary, MeterSection* section, const dou
 
        if (section->initial()) {
                /* lock the first tempo to our first meter */
-               if (!set_active_tempi (imaginary, section->frame_at_minute (minute))) {
+               if (!set_active_tempi (imaginary, frame_at_minute (minute))) {
                        return false;
                }
        }