diff options
author | nick_m <mainsbridge@gmail.com> | 2016-11-06 05:14:20 +1100 |
---|---|---|
committer | nick_m <mainsbridge@gmail.com> | 2016-11-11 03:37:08 +1100 |
commit | 33e95a15778e7fe87c204b0c4f2db039f857b523 (patch) | |
tree | 90678ea8fdf2a8a9532d808fd2efbf5775e5290e /gtk2_ardour | |
parent | e52f90357e79dac10da2bee0e27d51e8b07d5b83 (diff) |
rename Tempo _beats_per_minute to _note_types_per_minute, provide pulse helpers.
- adds quarter_notes_per_minute(), note_divisions_per_minute (double)
pulses_per_minute() and frames_per_quarter_note()
- this should be a no-op except for the use of tempo by
the vst callback which definitely uses quarter notes per minute.
- the XML node for TempoSection named 'beats-per-minute'
has been renamed.
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/audio_clock.cc | 3 | ||||
-rw-r--r-- | gtk2_ardour/automation_controller.cc | 2 | ||||
-rw-r--r-- | gtk2_ardour/editor_drag.cc | 12 | ||||
-rw-r--r-- | gtk2_ardour/editor_markers.cc | 4 | ||||
-rw-r--r-- | gtk2_ardour/editor_tempodisplay.cc | 24 | ||||
-rw-r--r-- | gtk2_ardour/tempo_curve.cc | 14 | ||||
-rw-r--r-- | gtk2_ardour/tempo_dialog.cc | 4 | ||||
-rw-r--r-- | gtk2_ardour/tempo_lines.cc | 4 |
8 files changed, 37 insertions, 30 deletions
diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc index 0c05cfd7f9..a657916b6d 100644 --- a/gtk2_ardour/audio_clock.cc +++ b/gtk2_ardour/audio_clock.cc @@ -1316,7 +1316,8 @@ AudioClock::set_bbt (framepos_t when, framecnt_t offset, bool /*force*/) TempoMetric m (_session->tempo_map().metric_at (pos)); - sprintf (buf, "%-5.3f", _session->tempo_map().tempo_at_frame (pos).beats_per_minute()); + sprintf (buf, "%-5.3f/%f", _session->tempo_map().tempo_at_frame (pos).note_types_per_minute(), m.tempo().note_type()); + /* XXX this doesn't fit inside the container. */ _left_layout->set_markup (string_compose ("<span size=\"%1\">" TXTSPAN "%3</span> <span foreground=\"green\">%2</span></span>", INFO_FONT_SIZE, buf, _("Tempo"))); diff --git a/gtk2_ardour/automation_controller.cc b/gtk2_ardour/automation_controller.cc index 03054fa98b..7411155551 100644 --- a/gtk2_ardour/automation_controller.cc +++ b/gtk2_ardour/automation_controller.cc @@ -274,7 +274,7 @@ AutomationController::set_freq_beats(double beats) const ARDOUR::Session& session = _controllable->session(); const framepos_t pos = session.transport_frame(); const ARDOUR::Tempo& tempo = session.tempo_map().tempo_at_frame (pos); - const double bpm = tempo.beats_per_minute(); + const double bpm = tempo.note_types_per_minute(); const double bps = bpm / 60.0; const double freq = bps / beats; _controllable->set_value(clamp(freq, desc.lower, desc.upper), Controllable::NoGroup); diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 864b5a1bdc..20d28f9c05 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -3279,7 +3279,7 @@ TempoMarkerDrag::TempoMarkerDrag (Editor* e, ArdourCanvas::Item* i, bool c) _marker = reinterpret_cast<TempoMarker*> (_item->get_data ("marker")); _real_section = &_marker->tempo(); _movable = _real_section->movable(); - _grab_bpm = _real_section->beats_per_minute(); + _grab_bpm = _real_section->note_types_per_minute(); assert (_marker); } @@ -3312,7 +3312,7 @@ TempoMarkerDrag::motion (GdkEvent* event, bool first_move) // mvc drag - create a dummy marker to catch events, hide it. char name[64]; - snprintf (name, sizeof (name), "%.2f", _marker->tempo().beats_per_minute()); + snprintf (name, sizeof (name), "%.2f", _marker->tempo().note_types_per_minute()); TempoSection section (_marker->tempo()); @@ -3443,8 +3443,8 @@ BBTRulerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor) _tempo = const_cast<TempoSection*> (&map.tempo_section_at_frame (raw_grab_frame())); ostringstream sstr; - sstr << "^" << fixed << setprecision(3) << map.tempo_at_frame (adjusted_current_frame (event)).beats_per_minute() << "\n"; - sstr << "<" << fixed << setprecision(3) << _tempo->beats_per_minute(); + sstr << "^" << fixed << setprecision(3) << map.tempo_at_frame (adjusted_current_frame (event)).note_types_per_minute() << "\n"; + sstr << "<" << fixed << setprecision(3) << _tempo->note_types_per_minute(); show_verbose_cursor_text (sstr.str()); finished (event, false); } @@ -3497,8 +3497,8 @@ BBTRulerDrag::motion (GdkEvent* event, bool first_move) _editor->session()->tempo_map().gui_dilate_tempo (_tempo, map.frame_at_quarter_note (_grab_qn), pf); } ostringstream sstr; - sstr << "^" << fixed << setprecision(3) << map.tempo_at_frame (pf).beats_per_minute() << "\n"; - sstr << "<" << fixed << setprecision(3) << _tempo->beats_per_minute(); + sstr << "^" << fixed << setprecision(3) << map.tempo_at_frame (pf).note_types_per_minute() << "\n"; + sstr << "<" << fixed << setprecision(3) << _tempo->note_types_per_minute(); show_verbose_cursor_text (sstr.str()); } diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc index 351ba31126..6751f6424f 100644 --- a/gtk2_ardour/editor_markers.cc +++ b/gtk2_ardour/editor_markers.cc @@ -1404,7 +1404,7 @@ Editor::toggle_marker_lock_style () } else if (tm) { TempoSection* tsp = &tm->tempo(); - const Tempo tempo (tsp->beats_per_minute()); + const Tempo tempo (tsp->note_types_per_minute(), tsp->note_type()); const double pulse = tsp->pulse(); const framepos_t frame = tsp->frame(); const TempoSection::Type type = tsp->type(); @@ -1431,7 +1431,7 @@ Editor::toggle_tempo_type () if (tm) { TempoSection* tsp = &tm->tempo(); - const Tempo tempo (tsp->beats_per_minute(), tsp->note_type()); + const Tempo tempo (tsp->note_types_per_minute(), tsp->note_type()); const double pulse = tsp->pulse(); const framepos_t frame = tsp->frame(); const TempoSection::Type type = (tsp->type() == TempoSection::Ramp) ? TempoSection::Constant : TempoSection::Ramp; diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc index 27578e329a..873bec3307 100644 --- a/gtk2_ardour/editor_tempodisplay.cc +++ b/gtk2_ardour/editor_tempodisplay.cc @@ -100,13 +100,13 @@ Editor::draw_metric_marks (const Metrics& metrics) } } else if ((ts = dynamic_cast<const TempoSection*>(*i)) != 0) { if (UIConfiguration::instance().get_allow_non_quarter_pulse()) { - snprintf (buf, sizeof (buf), "%.3f/%.0f", ts->beats_per_minute(), ts->note_type()); + snprintf (buf, sizeof (buf), "%.3f/%.0f", ts->note_types_per_minute(), ts->note_type()); } else { - snprintf (buf, sizeof (buf), "%.3f", ts->beats_per_minute()); + snprintf (buf, sizeof (buf), "%.3f", ts->note_types_per_minute()); } - max_tempo = max (max_tempo, ts->beats_per_minute()); - min_tempo = min (min_tempo, ts->beats_per_minute()); + max_tempo = max (max_tempo, ts->note_types_per_minute()); + min_tempo = min (min_tempo, ts->note_types_per_minute()); tempo_curves.push_back (new TempoCurve (*this, *tempo_group, UIConfiguration::instance().color ("tempo curve"), *(const_cast<TempoSection*>(ts)), ts->frame(), false)); @@ -147,7 +147,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 (10.0, max_tempo - min_tempo)); + tempo_marker->update_height_mark ((tempo_marker->tempo().note_types_per_minute() - min_tempo) / max (10.0, max_tempo - min_tempo)); } } } @@ -208,11 +208,17 @@ Editor::marker_position_changed () if ((ts = &tempo_marker->tempo()) != 0) { tempo_marker->set_position (ts->frame ()); char buf[64]; - snprintf (buf, sizeof (buf), "%.3f", ts->beats_per_minute()); + + if (UIConfiguration::instance().get_allow_non_quarter_pulse()) { + snprintf (buf, sizeof (buf), "%.3f/%.0f", ts->note_types_per_minute(), ts->note_type()); + } else { + snprintf (buf, sizeof (buf), "%.3f", ts->note_types_per_minute()); + } + tempo_marker->set_name (buf); - max_tempo = max (max_tempo, ts->beats_per_minute()); - min_tempo = min (min_tempo, ts->beats_per_minute()); + max_tempo = max (max_tempo, ts->note_types_per_minute()); + min_tempo = min (min_tempo, ts->note_types_per_minute()); } } if ((meter_marker = dynamic_cast<MeterMarker*> (*x)) != 0) { @@ -248,7 +254,7 @@ Editor::marker_position_changed () for (Marks::iterator x = metric_marks.begin(); x != metric_marks.end(); ++x) { 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 (max_tempo - min_tempo, 10.0)); + tempo_marker->update_height_mark ((tempo_marker->tempo().note_types_per_minute() - min_tempo) / max (max_tempo - min_tempo, 10.0)); } } diff --git a/gtk2_ardour/tempo_curve.cc b/gtk2_ardour/tempo_curve.cc index 7330e8c129..c9c14e4102 100644 --- a/gtk2_ardour/tempo_curve.cc +++ b/gtk2_ardour/tempo_curve.cc @@ -26,7 +26,7 @@ void TempoCurve::setup_sizes(const double timebar_height) { curve_height = floor (timebar_height) - 2.5; } - +/* ignores Tempo note type - only note_types_per_minute is potentially curved */ TempoCurve::TempoCurve (PublicEditor& ed, ArdourCanvas::Container& parent, guint32 rgba, ARDOUR::TempoSection& temp, framepos_t frame, bool handle_events) : editor (ed) @@ -34,8 +34,8 @@ TempoCurve::TempoCurve (PublicEditor& ed, ArdourCanvas::Container& parent, guint , _curve (0) , _shown (false) , _color (rgba) - , _min_tempo (temp.beats_per_minute()) - , _max_tempo (temp.beats_per_minute()) + , _min_tempo (temp.note_types_per_minute()) + , _max_tempo (temp.note_types_per_minute()) , _tempo (temp) { @@ -44,12 +44,12 @@ TempoCurve::TempoCurve (PublicEditor& ed, ArdourCanvas::Container& parent, guint group = new ArdourCanvas::Container (&parent, ArdourCanvas::Duple (unit_position, 1)); #ifdef CANVAS_DEBUG - group->name = string_compose ("TempoCurve::group for %1", _tempo.beats_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.beats_per_minute()); + _curve->name = string_compose ("TempoCurve::curve for %1", _tempo.note_types_per_minute()); #endif _curve->set_points_per_segment (3); points = new ArdourCanvas::Points (); @@ -113,14 +113,14 @@ TempoCurve::set_position (framepos_t frame, framepos_t end_frame) points->push_back (ArdourCanvas::Duple (0.0, curve_height)); if (end_frame == (framepos_t) UINT32_MAX) { - const double tempo_at = _tempo.beats_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)); points->push_back (ArdourCanvas::Duple (ArdourCanvas::COORD_MAX - 5.0, y_pos)); } else if (_tempo.type() == ARDOUR::TempoSection::Constant) { - const double tempo_at = _tempo.beats_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)); diff --git a/gtk2_ardour/tempo_dialog.cc b/gtk2_ardour/tempo_dialog.cc index 436acfaa67..c28dfaf219 100644 --- a/gtk2_ardour/tempo_dialog.cc +++ b/gtk2_ardour/tempo_dialog.cc @@ -48,7 +48,7 @@ TempoDialog::TempoDialog (TempoMap& map, framepos_t frame, const string&) Tempo tempo (map.tempo_at_frame (frame)); Timecode::BBT_Time when (map.bbt_at_frame (frame)); - init (when, tempo.beats_per_minute(), tempo.note_type(), TempoSection::Constant, true, MusicTime); + init (when, tempo.note_types_per_minute(), tempo.note_type(), TempoSection::Constant, true, MusicTime); } TempoDialog::TempoDialog (TempoMap& map, TempoSection& section, const string&) @@ -63,7 +63,7 @@ TempoDialog::TempoDialog (TempoMap& map, TempoSection& section, const string&) , tap_tempo_button (_("Tap tempo")) { Timecode::BBT_Time when (map.bbt_at_frame (section.frame())); - init (when, section.beats_per_minute(), section.note_type(), section.type(), section.movable(), section.position_lock_style()); + init (when, section.note_types_per_minute(), section.note_type(), section.type(), section.movable(), section.position_lock_style()); } void diff --git a/gtk2_ardour/tempo_lines.cc b/gtk2_ardour/tempo_lines.cc index c9160fdf9a..7a780c424e 100644 --- a/gtk2_ardour/tempo_lines.cc +++ b/gtk2_ardour/tempo_lines.cc @@ -77,11 +77,11 @@ TempoLines::draw_ticks (std::vector<ARDOUR::TempoMap::BBTPoint>& grid, if (grid.begin()->c != 0.0) { const double beat_divisions = (l / ((double) divisions)) * (grid.begin()->tempo.note_type() / grid.begin()->meter.note_divisor()); const double time_at_division = log (((grid.begin()->c * (beat_divisions)) / - grid.begin()->tempo.beats_per_minute()) + 1) / grid.begin()->c; + grid.begin()->tempo.note_types_per_minute()) + 1) / grid.begin()->c; f = grid.begin()->frame + (framecnt_t) floor ((time_at_division * 60.0 * frame_rate) + 0.5); } else { - const double fpb = grid.begin()->tempo.frames_per_beat (frame_rate) + const double fpb = grid.begin()->tempo.frames_per_note_type (frame_rate) * (grid.begin()->tempo.note_type() / grid.begin()->meter.note_divisor()); f = grid.begin()->frame + (l * (fpb / (double) divisions)); |