From 1927a707c560cfe2a9963fb0fb75d65f5720256d Mon Sep 17 00:00:00 2001 From: nick_m Date: Tue, 24 May 2016 06:49:52 +1000 Subject: Tempo ramps - fix huge marker height mark, remove unused var. --- gtk2_ardour/editor_tempodisplay.cc | 2 +- gtk2_ardour/tempo_curve.cc | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc index e0af960d40..c100fbd4c7 100644 --- a/gtk2_ardour/editor_tempodisplay.cc +++ b/gtk2_ardour/editor_tempodisplay.cc @@ -129,7 +129,7 @@ Editor::draw_metric_marks (const Metrics& metrics) TempoMarker* tempo_marker; if ((tempo_marker = dynamic_cast (*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)); } } } diff --git a/gtk2_ardour/tempo_curve.cc b/gtk2_ardour/tempo_curve.cc index 9e09690569..b3968e33aa 100644 --- a/gtk2_ardour/tempo_curve.cc +++ b/gtk2_ardour/tempo_curve.cc @@ -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); -- cgit v1.2.3