tempo display: during ressaociate markers, update tempo curves as well
This commit is contained in:
parent
9e75235912
commit
320a20cbab
@ -127,6 +127,7 @@ Editor::reassociate_metric_marker (TempoMap::SharedPtr const & tmap, TempoMap::M
|
||||
} else if ((tp = dynamic_cast<Temporal::TempoPoint*>(*m)) != 0) {
|
||||
if (tm->tempo() == *tp) {
|
||||
tm->reset_tempo (*tp);
|
||||
tm->curve().reset_point (*tp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -55,7 +55,8 @@ public:
|
||||
void hide ();
|
||||
void show ();
|
||||
|
||||
Temporal::TempoPoint const & tempo () const { return _tempo; }
|
||||
Temporal::TempoPoint const & tempo () const { return *_tempo; }
|
||||
void reset_point (Temporal::TempoPoint const &);
|
||||
|
||||
void set_max_tempo (const double& max) { _max_tempo = max; }
|
||||
void set_min_tempo (const double& min) { _min_tempo = min; }
|
||||
@ -83,7 +84,7 @@ private:
|
||||
double _min_tempo;
|
||||
double _max_tempo;
|
||||
|
||||
Temporal::TempoPoint const & _tempo;
|
||||
Temporal::TempoPoint const * _tempo;
|
||||
ArdourCanvas::Text* _start_text;
|
||||
ArdourCanvas::Text* _end_text;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user