Tempo ramps - fix huge marker height mark, remove unused var.
authornick_m <mainsbridge@gmail.com>
Mon, 23 May 2016 20:49:52 +0000 (06:49 +1000)
committernick_m <mainsbridge@gmail.com>
Fri, 27 May 2016 13:38:17 +0000 (23:38 +1000)
gtk2_ardour/editor_tempodisplay.cc
gtk2_ardour/tempo_curve.cc

index e0af960d40ac86ff92b7cbae8d6145cce6371286..c100fbd4c729706f3e2bd8a8b83acc341f9638d4 100644 (file)
@@ -129,7 +129,7 @@ Editor::draw_metric_marks (const Metrics& metrics)
                TempoMarker* tempo_marker;
 
                if ((tempo_marker = dynamic_cast<TempoMarker*> (*x)) != 0) {
-                       tempo_marker->update_height_mark ((tempo_marker->tempo().beats_per_minute() - min_tempo) / (max_tempo - min_tempo));
+                       tempo_marker->update_height_mark ((tempo_marker->tempo().beats_per_minute() - min_tempo) / max (10.0, max_tempo - min_tempo));
                }
        }
 }
index 9e0969056929a304bbd800b88657abed194b0cbc..b3968e33aa122461eea2307a8d01daf57f57128b 100644 (file)
@@ -110,13 +110,13 @@ TempoCurve::the_item() const
 void
 TempoCurve::set_position (framepos_t frame, framepos_t end_frame)
 {
+       const double tempo_delta = max (10.0, _max_tempo - _min_tempo);
+
        unit_position = editor.sample_to_pixel (frame);
        group->set_x_position (unit_position);
        frame_position = frame;
        _end_frame = end_frame;
 
-       const double tempo_delta = max (10.0, _max_tempo - _min_tempo);
-       double max_y = 0.0;
 
        points->clear();
 
@@ -127,8 +127,6 @@ TempoCurve::set_position (framepos_t frame, framepos_t end_frame)
                const double tempo_at = _tempo.tempo_at_frame (frame, editor.session()->frame_rate()) * _tempo.note_type();
                const double y_pos =  (curve_height) - (((tempo_at - _min_tempo) / (tempo_delta)) * curve_height);
 
-               max_y = y_pos;
-
                points->push_back (ArdourCanvas::Duple (0.0, y_pos));
                points->push_back (ArdourCanvas::Duple (ArdourCanvas::COORD_MAX - 5.0, y_pos));
 
@@ -142,9 +140,9 @@ TempoCurve::set_position (framepos_t frame, framepos_t end_frame)
 
                        points->push_back (ArdourCanvas::Duple (editor.sample_to_pixel (current_frame - frame), y_pos));
 
-                       max_y = max (y_pos, max_y);
                        current_frame += frame_step;
                }
+
                const double tempo_at = _tempo.tempo_at_frame (end_frame, editor.session()->frame_rate()) * _tempo.note_type();
                const double y_pos = (curve_height) - (((tempo_at - _min_tempo) / (tempo_delta)) * curve_height);