OSC: reset select strip on bank change or select for non-existing stripable.
[ardour.git] / gtk2_ardour / tempo_curve.cc
index cac512c0b2b34ca3b74b55eade3608fc26b5357b..b8fb661919b2b450bbcfe6bd2647ad4ae927c25d 100644 (file)
@@ -133,17 +133,17 @@ TempoCurve::set_position (framepos_t frame, framepos_t end_frame)
 
                while (current_frame < (end_frame - frame_step)) {
                        const double tempo_at = _tempo.tempo_at_frame (current_frame, editor.session()->frame_rate()) * _tempo.note_type();
-                       const double y_pos = (curve_height) - (((tempo_at - _min_tempo) / (_max_tempo - _min_tempo)) * curve_height);
+                       const double y_pos = max ((curve_height) - (((tempo_at - _min_tempo) / (_max_tempo - _min_tempo)) * curve_height), 0.0);
 
-                       points->push_back (ArdourCanvas::Duple (editor.sample_to_pixel (current_frame - frame), y_pos));
+                       points->push_back (ArdourCanvas::Duple (editor.sample_to_pixel (current_frame - frame), min (y_pos, curve_height)));
 
                        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) / (_max_tempo - _min_tempo)) * curve_height);
+               const double y_pos = max ((curve_height) - (((tempo_at - _min_tempo) / (_max_tempo - _min_tempo)) * curve_height), 0.0);
 
-               points->push_back (ArdourCanvas::Duple (editor.sample_to_pixel ((end_frame - 1) - frame), y_pos));
+               points->push_back (ArdourCanvas::Duple (editor.sample_to_pixel ((end_frame - 1) - frame), min (y_pos, curve_height)));
        }
 
        _curve->set (*points);