mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 06:44:57 +01:00
tempo display: during ressaociate markers, update tempo curves as well
This commit is contained in:
parent
9e75235912
commit
320a20cbab
3 changed files with 23 additions and 13 deletions
|
|
@ -62,19 +62,19 @@ TempoCurve::TempoCurve (PublicEditor& ed, ArdourCanvas::Item& parent, guint32 rg
|
|||
, _color (rgba)
|
||||
, _min_tempo (temp.note_types_per_minute())
|
||||
, _max_tempo (temp.note_types_per_minute())
|
||||
, _tempo (temp)
|
||||
, _tempo (&temp)
|
||||
, _start_text (0)
|
||||
, _end_text (0)
|
||||
{
|
||||
/* XXX x arg for Duple should probably be marker width, passed in from owner */
|
||||
group = new ArdourCanvas::Container (&parent, ArdourCanvas::Duple (marker_width, 1));
|
||||
#ifdef CANVAS_DEBUG
|
||||
group->name = string_compose ("TempoCurve::group for %1", _tempo.note_types_per_minute());
|
||||
group->name = string_compose ("TempoCurve::group for %1", _tempo->note_types_per_minute());
|
||||
#endif
|
||||
|
||||
_curve = new ArdourCanvas::FramedCurve (group);
|
||||
#ifdef CANVAS_DEBUG
|
||||
_curve->name = string_compose ("TempoCurve::curve for %1", _tempo.note_types_per_minute());
|
||||
_curve->name = string_compose ("TempoCurve::curve for %1", _tempo->note_types_per_minute());
|
||||
#endif
|
||||
_curve->set_points_per_segment (3);
|
||||
_curve->set (points);
|
||||
|
|
@ -86,9 +86,9 @@ TempoCurve::TempoCurve (PublicEditor& ed, ArdourCanvas::Item& parent, guint32 rg
|
|||
_start_text->set_color (RGBA_TO_UINT (255,255,255,255));
|
||||
_end_text->set_color (RGBA_TO_UINT (255,255,255,255));
|
||||
char buf[10];
|
||||
snprintf (buf, sizeof (buf), "%.3f/%d", _tempo.note_types_per_minute(), _tempo.note_type());
|
||||
snprintf (buf, sizeof (buf), "%.3f/%d", _tempo->note_types_per_minute(), _tempo->note_type());
|
||||
_start_text->set (buf);
|
||||
snprintf (buf, sizeof (buf), "%.3f", _tempo.end_note_types_per_minute());
|
||||
snprintf (buf, sizeof (buf), "%.3f", _tempo->end_note_types_per_minute());
|
||||
_end_text->set (buf);
|
||||
|
||||
set_color_rgba (rgba);
|
||||
|
|
@ -131,9 +131,9 @@ TempoCurve::set_duration (samplecnt_t duration)
|
|||
|
||||
ArdourCanvas::Coord duration_pixels = editor.sample_to_pixel (duration);
|
||||
|
||||
if (!_tempo.ramped()) {
|
||||
if (!_tempo->ramped()) {
|
||||
|
||||
const double tempo_at = _tempo.note_types_per_minute();
|
||||
const double tempo_at = _tempo->note_types_per_minute();
|
||||
const double y_pos = (curve_height) - (((tempo_at - _min_tempo) / (_max_tempo - _min_tempo)) * curve_height);
|
||||
|
||||
points.push_back (ArdourCanvas::Duple (0.0, y_pos));
|
||||
|
|
@ -145,7 +145,7 @@ TempoCurve::set_duration (samplecnt_t duration)
|
|||
samplepos_t current_sample = 0;
|
||||
|
||||
while (current_sample < duration) {
|
||||
const double tempo_at = _tempo.note_types_per_minute_at_DOUBLE (timepos_t (current_sample));
|
||||
const double tempo_at = _tempo->note_types_per_minute_at_DOUBLE (timepos_t (current_sample));
|
||||
const double y_pos = std::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_sample), std::min (y_pos, curve_height)));
|
||||
|
|
@ -153,7 +153,7 @@ TempoCurve::set_duration (samplecnt_t duration)
|
|||
current_sample += sample_step;
|
||||
}
|
||||
|
||||
const double tempo_at = _tempo.note_types_per_minute();
|
||||
const double tempo_at = _tempo->note_types_per_minute();
|
||||
const double y_pos = std::max ((curve_height) - (((tempo_at - _min_tempo) / (_max_tempo - _min_tempo)) * curve_height), 0.0);
|
||||
|
||||
points.push_back (ArdourCanvas::Duple (duration_pixels, std::min (y_pos, curve_height)));
|
||||
|
|
@ -163,10 +163,12 @@ TempoCurve::set_duration (samplecnt_t duration)
|
|||
|
||||
char buf[10];
|
||||
|
||||
snprintf (buf, sizeof (buf), "%.3f/%d", _tempo.note_types_per_minute(), _tempo.note_type());
|
||||
snprintf (buf, sizeof (buf), "%.3f/%d", _tempo->note_types_per_minute(), _tempo->note_type());
|
||||
_start_text->set (buf);
|
||||
snprintf (buf, sizeof (buf), "%.3f", _tempo.end_note_types_per_minute());
|
||||
std::cerr << "new start text " << buf << std::endl;
|
||||
snprintf (buf, sizeof (buf), "%.3f", _tempo->end_note_types_per_minute());
|
||||
_end_text->set (buf);
|
||||
std::cerr << "new end text " << buf << std::endl;
|
||||
|
||||
const double ui_scale = UIConfiguration::instance ().get_ui_scale ();
|
||||
|
||||
|
|
@ -210,3 +212,9 @@ TempoCurve::set_color_rgba (uint32_t c)
|
|||
_curve->set_outline_color (_color);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
TempoCurve::reset_point (TempoPoint const & tp)
|
||||
{
|
||||
_tempo = &tp;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue