diff options
author | nick_m <mainsbridge@gmail.com> | 2016-04-02 05:41:16 +1100 |
---|---|---|
committer | nick_m <mainsbridge@gmail.com> | 2016-05-27 23:38:13 +1000 |
commit | 3d07cd79e17f1bdda370f54c9ecece559af4d5f9 (patch) | |
tree | 1b32dee23689db6c1657816da45c540cc1d58698 | |
parent | 89f022cb53cc1b983b1a9a0249a0e371a68055c0 (diff) |
Tempo ramps - api change, remove some code.
-rw-r--r-- | gtk2_ardour/editor_drag.cc | 16 | ||||
-rw-r--r-- | gtk2_ardour/editor_tempodisplay.cc | 6 | ||||
-rw-r--r-- | gtk2_ardour/tempo_dialog.cc | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/tempo.h | 22 | ||||
-rw-r--r-- | libs/ardour/tempo.cc | 54 | ||||
-rw-r--r-- | libs/ardour/test/tempo_test.cc | 2 |
6 files changed, 51 insertions, 51 deletions
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index dc7eb3586c..d8618ffca4 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -3180,9 +3180,9 @@ MeterMarkerDrag::motion (GdkEvent* event, bool first_move) _marker->set_position (pf); if (_marker->meter().position_lock_style() == MusicTime) { double const baf = _editor->session()->tempo_map().beat_at_frame (_editor->session()->tempo_map().round_to_bar (pf, (RoundMode) 0)); - _editor->session()->tempo_map().gui_move_meter (_real_section, _marker->meter(), baf); + _editor->session()->tempo_map().gui_move_meter (_real_section, baf); } else { - _editor->session()->tempo_map().gui_move_meter (_real_section, _marker->meter(), pf); + _editor->session()->tempo_map().gui_move_meter (_real_section, pf); } show_verbose_cursor_time (pf); } @@ -3352,7 +3352,7 @@ TempoMarkerDrag::motion (GdkEvent* event, bool first_move) if (_real_section->position_lock_style() == MusicTime) { - const double pulse = map.predict_tempo_pulse (_real_section, Tempo (_real_section->beats_per_minute(), _real_section->note_type()), pf); + const double pulse = map.predict_tempo_pulse (_real_section, pf); when = map.pulse_to_bbt (pulse); if (use_snap && _editor->snap_type() == SnapToBar) { map.round_bbt (when, -1); @@ -3360,15 +3360,15 @@ TempoMarkerDrag::motion (GdkEvent* event, bool first_move) map.round_bbt (when, _editor->get_grid_beat_divisions (0)); } const double beat = map.bbt_to_beats (when); - map.gui_move_tempo_beat (_real_section, tp, beat); + map.gui_move_tempo_beat (_real_section, beat); } else { if (use_snap && _editor->snap_type() == SnapToBar) { map.round_bbt (when, -1); } else if (use_snap) { map.round_bbt (when, _editor->get_grid_beat_divisions (0)); } - pf = map.predict_tempo_frame (_real_section, Tempo (_real_section->beats_per_minute(), _real_section->note_type()), when); - map.gui_move_tempo_frame (_real_section, tp, pf); + pf = map.predict_tempo_frame (_real_section, when); + map.gui_move_tempo_frame (_real_section, pf); } } @@ -3399,7 +3399,7 @@ TempoMarkerDrag::finished (GdkEvent* event, bool movement_occurred) XMLNode &before = map.get_state(); if (_marker->tempo().position_lock_style() == MusicTime) { - double const pulse = map.predict_tempo_pulse (_real_section, _marker->tempo(), _real_section->frame()); + double const pulse = map.predict_tempo_pulse (_real_section, _real_section->frame()); map.add_tempo (_marker->tempo(), pulse, _marker->tempo().type()); } else { map.add_tempo (_marker->tempo(), _real_section->frame(), _marker->tempo().type()); @@ -3411,7 +3411,7 @@ TempoMarkerDrag::finished (GdkEvent* event, bool movement_occurred) } else { if (_marker->tempo().position_lock_style() == MusicTime) { - double const pulse = map.predict_tempo_pulse (_real_section, Tempo (_real_section->beats_per_minute(), _real_section->note_type()), _real_section->frame()); + double const pulse = map.predict_tempo_pulse (_real_section, _real_section->frame()); map.replace_tempo (*_real_section, Tempo (_real_section->beats_per_minute(), _real_section->note_type()) , pulse, _marker->tempo().type()); } else { diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc index b6db6280e4..3931e0bf09 100644 --- a/gtk2_ardour/editor_tempodisplay.cc +++ b/gtk2_ardour/editor_tempodisplay.cc @@ -378,11 +378,11 @@ Editor::edit_tempo_section (TempoSection* section) if (tempo_dialog.get_lock_style() == MusicTime) { section->set_position_lock_style (MusicTime); - framepos_t const f = _session->tempo_map().predict_tempo_frame (section, Tempo (bpm, nt), when); - double const p = _session->tempo_map().predict_tempo_pulse (section, Tempo (bpm, nt), f); + framepos_t const f = _session->tempo_map().predict_tempo_frame (section, when); + double const p = _session->tempo_map().predict_tempo_pulse (section, f); _session->tempo_map().replace_tempo (*section, Tempo (bpm, nt), p, tempo_dialog.get_tempo_type()); } else { - framepos_t const f = _session->tempo_map().predict_tempo_frame (section, Tempo (bpm, nt), when); + framepos_t const f = _session->tempo_map().predict_tempo_frame (section, when); _session->tempo_map().replace_tempo (*section, Tempo (bpm, nt), f, tempo_dialog.get_tempo_type()); } diff --git a/gtk2_ardour/tempo_dialog.cc b/gtk2_ardour/tempo_dialog.cc index 0cd616a1ff..687c428e5b 100644 --- a/gtk2_ardour/tempo_dialog.cc +++ b/gtk2_ardour/tempo_dialog.cc @@ -277,7 +277,7 @@ TempoDialog::entry_key_release (GdkEventKey*) get_bbt_time (bbt); if (_section && is_user_input_valid()) { - set_response_sensitive (RESPONSE_ACCEPT, _map->can_solve_bbt (_section, Tempo (get_bpm(), get_note_type()), bbt)); + set_response_sensitive (RESPONSE_ACCEPT, _map->can_solve_bbt (_section, bbt)); } else { set_response_sensitive (RESPONSE_ACCEPT, is_user_input_valid()); } diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h index 6cb4850288..5ab4056c5e 100644 --- a/libs/ardour/ardour/tempo.h +++ b/libs/ardour/ardour/tempo.h @@ -382,19 +382,19 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible void remove_tempo (const TempoSection&, bool send_signal); void remove_meter (const MeterSection&, bool send_signal); - framepos_t predict_tempo_frame (TempoSection* section, const Tempo& bpm, const Timecode::BBT_Time& bbt); - double predict_tempo_pulse (TempoSection* section, const Tempo& bpm, const framepos_t& frame); + framepos_t predict_tempo_frame (TempoSection* section, const Timecode::BBT_Time& bbt); + double predict_tempo_pulse (TempoSection* section, const framepos_t& frame); void replace_tempo (const TempoSection&, const Tempo&, const double& where, TempoSection::Type type); void replace_tempo (const TempoSection&, const Tempo&, const framepos_t& frame, TempoSection::Type type); - void gui_move_tempo_frame (TempoSection*, const Tempo& bpm, const framepos_t& frame); - void gui_move_tempo_beat (TempoSection*, const Tempo& bpm, const double& frame); - void gui_move_meter (MeterSection*, const Meter& mt, const framepos_t& frame); - void gui_move_meter (MeterSection*, const Meter& mt, const double& beat); + void gui_move_tempo_frame (TempoSection*, const framepos_t& frame); + void gui_move_tempo_beat (TempoSection*, const double& frame); + void gui_move_meter (MeterSection*, const framepos_t& frame); + void gui_move_meter (MeterSection*, const double& beat); bool gui_change_tempo (TempoSection*, const Tempo& bpm); - bool can_solve_bbt (TempoSection* section, const Tempo& bpm, const Timecode::BBT_Time& bbt); + bool can_solve_bbt (TempoSection* section, const Timecode::BBT_Time& bbt); void replace_meter (const MeterSection&, const Meter&, const Timecode::BBT_Time& where); void replace_meter (const MeterSection&, const Meter&, const framepos_t& frame); @@ -460,10 +460,10 @@ private: bool check_solved (Metrics& metrics, bool by_frame); bool set_active_tempos (const Metrics& metrics, const framepos_t& frame); - bool solve_map (Metrics& metrics, TempoSection* section, const Tempo& bpm, const framepos_t& frame); - bool solve_map (Metrics& metrics, TempoSection* section, const Tempo& bpm, const double& pulse); - void solve_map (Metrics& metrics, MeterSection* section, const Meter& mt, const framepos_t& frame); - void solve_map (Metrics& metrics, MeterSection* section, const Meter& mt, const double& pulse); + bool solve_map (Metrics& metrics, TempoSection* section, const framepos_t& frame); + bool solve_map (Metrics& metrics, TempoSection* section, const double& pulse); + void solve_map (Metrics& metrics, MeterSection* section, const framepos_t& frame); + void solve_map (Metrics& metrics, MeterSection* section, const double& pulse); friend class ::BBTTest; friend class ::FrameposPlusBeatsTest; diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc index fe56f8013b..9c40b25919 100644 --- a/libs/ardour/tempo.cc +++ b/libs/ardour/tempo.cc @@ -917,7 +917,7 @@ TempoMap::add_tempo_locked (const Tempo& tempo, double pulse, bool recompute, AR do_insert (ts); if (recompute) { - solve_map (_metrics, ts, Tempo (ts->beats_per_minute(), ts->note_type()), ts->pulse()); + solve_map (_metrics, ts, ts->pulse()); } } @@ -929,7 +929,7 @@ TempoMap::add_tempo_locked (const Tempo& tempo, framepos_t frame, bool recompute do_insert (ts); if (recompute) { - solve_map (_metrics, ts, Tempo (ts->beats_per_minute(), ts->note_type()), ts->frame()); + solve_map (_metrics, ts, ts->frame()); } } @@ -1046,7 +1046,7 @@ TempoMap::add_meter_locked (const Meter& meter, double beat, BBT_Time where, boo do_insert (new_meter); if (recompute) { - solve_map (_metrics, new_meter, Meter (meter.divisions_per_bar(), meter.note_divisor()), pulse); + solve_map (_metrics, new_meter, pulse); } } @@ -1063,7 +1063,7 @@ TempoMap::add_meter_locked (const Meter& meter, framepos_t frame, double beat, T do_insert (new_meter); if (recompute) { - solve_map (_metrics, new_meter, Meter (new_meter->divisions_per_bar(), new_meter->note_divisor()), frame); + solve_map (_metrics, new_meter, frame); } } @@ -1781,7 +1781,7 @@ TempoMap::set_active_tempos (const Metrics& metrics, const framepos_t& frame) } bool -TempoMap::solve_map (Metrics& imaginary, TempoSection* section, const Tempo& bpm, const framepos_t& frame) +TempoMap::solve_map (Metrics& imaginary, TempoSection* section, const framepos_t& frame) { TempoSection* prev_t = 0; TempoSection* section_prev = 0; @@ -1881,7 +1881,7 @@ TempoMap::solve_map (Metrics& imaginary, TempoSection* section, const Tempo& bpm } bool -TempoMap::solve_map (Metrics& imaginary, TempoSection* section, const Tempo& bpm, const double& pulse) +TempoMap::solve_map (Metrics& imaginary, TempoSection* section, const double& pulse) { TempoSection* prev_t = 0; TempoSection* section_prev = 0; @@ -1966,7 +1966,7 @@ TempoMap::solve_map (Metrics& imaginary, TempoSection* section, const Tempo& bpm } void -TempoMap::solve_map (Metrics& imaginary, MeterSection* section, const Meter& mt, const framepos_t& frame) +TempoMap::solve_map (Metrics& imaginary, MeterSection* section, const framepos_t& frame) { MeterSection* prev_m = 0; @@ -1983,11 +1983,11 @@ TempoMap::solve_map (Metrics& imaginary, MeterSection* section, const Meter& mt, new_section->set_pulse (0.0); new_section->set_active (true); - if (solve_map (future_map, new_section, Tempo (new_section->beats_per_minute(), new_section->note_type()), frame)) { + if (solve_map (future_map, new_section, frame)) { first_t->set_frame (frame); first_t->set_pulse (0.0); first_t->set_active (true); - solve_map (imaginary, first_t, Tempo (first_t->beats_per_minute(), first_t->note_type()), frame); + solve_map (imaginary, first_t, frame); } else { return; } @@ -2060,7 +2060,7 @@ TempoMap::solve_map (Metrics& imaginary, MeterSection* section, const Meter& mt, } void -TempoMap::solve_map (Metrics& imaginary, MeterSection* section, const Meter& mt, const double& pulse) +TempoMap::solve_map (Metrics& imaginary, MeterSection* section, const double& pulse) { MeterSection* prev_m = 0; @@ -2165,7 +2165,7 @@ TempoMap::copy_metrics_and_point (Metrics& copy, TempoSection* section) } bool -TempoMap::can_solve_bbt (TempoSection* ts, const Tempo& bpm, const BBT_Time& bbt) +TempoMap::can_solve_bbt (TempoSection* ts, const BBT_Time& bbt) { Metrics copy; TempoSection* new_section = 0; @@ -2176,7 +2176,7 @@ TempoMap::can_solve_bbt (TempoSection* ts, const Tempo& bpm, const BBT_Time& bb } double const beat = bbt_to_beats_locked (copy, bbt); - bool ret = solve_map (copy, new_section, bpm, pulse_at_beat_locked (copy, beat)); + bool ret = solve_map (copy, new_section, pulse_at_beat_locked (copy, beat)); Metrics::const_iterator d = copy.begin(); while (d != copy.end()) { @@ -2196,7 +2196,7 @@ TempoMap::can_solve_bbt (TempoSection* ts, const Tempo& bpm, const BBT_Time& bb * @return returns - the position in frames where the new tempo section will lie. */ framepos_t -TempoMap::predict_tempo_frame (TempoSection* section, const Tempo& bpm, const BBT_Time& bbt) +TempoMap::predict_tempo_frame (TempoSection* section, const BBT_Time& bbt) { Glib::Threads::RWLock::ReaderLock lm (lock); Metrics future_map; @@ -2204,7 +2204,7 @@ TempoMap::predict_tempo_frame (TempoSection* section, const Tempo& bpm, const BB TempoSection* new_section = copy_metrics_and_point (future_map, section); const double beat = bbt_to_beats_locked (future_map, bbt); - if (solve_map (future_map, new_section, bpm, pulse_at_beat_locked (future_map, beat))) { + if (solve_map (future_map, new_section, pulse_at_beat_locked (future_map, beat))) { ret = new_section->frame(); } else { ret = frame_at_beat_locked (_metrics, beat); @@ -2219,14 +2219,14 @@ TempoMap::predict_tempo_frame (TempoSection* section, const Tempo& bpm, const BB } double -TempoMap::predict_tempo_pulse (TempoSection* section, const Tempo& bpm, const framepos_t& frame) +TempoMap::predict_tempo_pulse (TempoSection* section, const framepos_t& frame) { Glib::Threads::RWLock::ReaderLock lm (lock); Metrics future_map; double ret = 0.0; TempoSection* new_section = copy_metrics_and_point (future_map, section); - if (solve_map (future_map, new_section, bpm, frame)) { + if (solve_map (future_map, new_section, frame)) { ret = new_section->pulse(); } else { ret = pulse_at_frame_locked (_metrics, frame); @@ -2241,14 +2241,14 @@ TempoMap::predict_tempo_pulse (TempoSection* section, const Tempo& bpm, const fr } void -TempoMap::gui_move_tempo_frame (TempoSection* ts, const Tempo& bpm, const framepos_t& frame) +TempoMap::gui_move_tempo_frame (TempoSection* ts, const framepos_t& frame) { Metrics future_map; { Glib::Threads::RWLock::WriterLock lm (lock); TempoSection* new_section = copy_metrics_and_point (future_map, ts); - if (solve_map (future_map, new_section, bpm, frame)) { - solve_map (_metrics, ts, bpm, frame); + if (solve_map (future_map, new_section, frame)) { + solve_map (_metrics, ts, frame); } } @@ -2262,14 +2262,14 @@ TempoMap::gui_move_tempo_frame (TempoSection* ts, const Tempo& bpm, const frame } void -TempoMap::gui_move_tempo_beat (TempoSection* ts, const Tempo& bpm, const double& beat) +TempoMap::gui_move_tempo_beat (TempoSection* ts, const double& beat) { Metrics future_map; { Glib::Threads::RWLock::WriterLock lm (lock); TempoSection* new_section = copy_metrics_and_point (future_map, ts); - if (solve_map (future_map, new_section, bpm, pulse_at_beat_locked (future_map, beat))) { - solve_map (_metrics, ts, bpm, pulse_at_beat_locked (_metrics, beat)); + if (solve_map (future_map, new_section, pulse_at_beat_locked (future_map, beat))) { + solve_map (_metrics, ts, pulse_at_beat_locked (_metrics, beat)); } } @@ -2283,29 +2283,29 @@ TempoMap::gui_move_tempo_beat (TempoSection* ts, const Tempo& bpm, const double } void -TempoMap::gui_move_meter (MeterSection* ms, const Meter& mt, const framepos_t& frame) +TempoMap::gui_move_meter (MeterSection* ms, const framepos_t& frame) { { Glib::Threads::RWLock::WriterLock lm (lock); - solve_map (_metrics, ms, mt, frame); + solve_map (_metrics, ms, frame); } MetricPositionChanged (); // Emit Signal } void -TempoMap::gui_move_meter (MeterSection* ms, const Meter& mt, const double& beat) +TempoMap::gui_move_meter (MeterSection* ms, const double& beat) { { Glib::Threads::RWLock::WriterLock lm (lock); - solve_map (_metrics, ms, mt, pulse_at_beat_locked (_metrics, beat)); + solve_map (_metrics, ms, pulse_at_beat_locked (_metrics, beat)); } MetricPositionChanged (); // Emit Signal } bool -TempoMap::gui_change_tempo (TempoSection* ts, const Tempo& bpm) +TempoMap::gui_change_tempo (TempoSection* ts, const Tempo& bpm) { Metrics future_map; bool can_solve = false; diff --git a/libs/ardour/test/tempo_test.cc b/libs/ardour/test/tempo_test.cc index 41419b1bce..0160708542 100644 --- a/libs/ardour/test/tempo_test.cc +++ b/libs/ardour/test/tempo_test.cc @@ -100,7 +100,7 @@ TempoTest::rampTest () CPPUNIT_ASSERT_EQUAL (tB->frame(), tA->frame_at_pulse (tB->pulse(), sampling_rate)); /* self-check tempo at pulse @ 125 bpm. */ - CPPUNIT_ASSERT_DOUBLES_EQUAL (125.0 / 4.0, tA->tempo_at_pulse (tA->pulse_at_tempo (125.0 / 4.0, 0, sampling_rate)), 0.000000000000001); + CPPUNIT_ASSERT_DOUBLES_EQUAL (125.0 / 4.0, tA->tempo_at_pulse (tA->pulse_at_tempo (125.0 / 4.0, 0, sampling_rate)), 0.00000000000000001); /* self-check frame at pulse 20 seconds in. */ const framepos_t target = 20 * sampling_rate; |