Tempo ramps - fix huge marker height mark, remove unused var.

This commit is contained in:
nick_m 2016-05-24 06:49:52 +10:00
parent 5d5fba0cfb
commit 1927a707c5
2 changed files with 4 additions and 6 deletions

View 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));
}
}
}

View 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);