From: nick_m Date: Wed, 13 Apr 2016 20:03:20 +0000 (+1000) Subject: Tempo ramps - adding a new tempo doesn't involve a dialog. X-Git-Tag: 5.0-pre0~403 X-Git-Url: https://main.carlh.net/gitweb/?p=ardour.git;a=commitdiff_plain;h=932c7b07fd42fa383d772b6cb4543893ed9ea7f7 Tempo ramps - adding a new tempo doesn't involve a dialog. --- diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc index fecdeb0ecb..4f12aadb0a 100644 --- a/gtk2_ardour/editor_tempodisplay.cc +++ b/gtk2_ardour/editor_tempodisplay.cc @@ -223,32 +223,12 @@ Editor::mouse_add_new_tempo_event (framepos_t frame) } TempoMap& map(_session->tempo_map()); - TempoDialog tempo_dialog (map, frame, _("add")); - //this causes compiz to display no border. - //tempo_dialog.signal_realize().connect (sigc::bind (sigc::ptr_fun (set_decoration), &tempo_dialog, Gdk::WMDecoration (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH))); - - switch (tempo_dialog.run()) { - case RESPONSE_ACCEPT: - break; - default: - return; - } - - double bpm = 0; - Timecode::BBT_Time requested; - bpm = tempo_dialog.get_bpm (); - double nt = tempo_dialog.get_note_type(); - bpm = max (0.01, bpm); - - tempo_dialog.get_bbt_time (requested); begin_reversible_command (_("add tempo mark")); XMLNode &before = map.get_state(); - if (tempo_dialog.get_lock_style() == MusicTime) { - map.add_tempo (Tempo (bpm,nt), map.pulse_at_beat (map.bbt_to_beats (requested)), tempo_dialog.get_tempo_type()); - } else { - map.add_tempo (Tempo (bpm,nt), frame, tempo_dialog.get_tempo_type()); - } + /* add music-locked ramped (?) tempo using the bpm/note type at frame*/ + map.add_tempo (map.tempo_at (frame), map.pulse_at_frame (frame), TempoSection::Ramp); + XMLNode &after = map.get_state(); _session->add_command(new MementoCommand(map, &before, &after)); commit_reversible_command (); diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h index 3f81a6a938..18c256695e 100644 --- a/libs/ardour/ardour/tempo.h +++ b/libs/ardour/ardour/tempo.h @@ -441,13 +441,16 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible double pulse_at_beat (const double& beat) const; double beat_at_pulse (const double& pulse) const; + double pulse_at_frame (const framecnt_t& frame) const; + framecnt_t frame_at_pulse (const double& pulse) const; + PBD::Signal0 MetricPositionChanged; private: double pulse_at_beat_locked (const Metrics& metrics, const double& beat) const; double beat_at_pulse_locked (const Metrics& metrics, const double& pulse) const; double pulse_at_frame_locked (const Metrics& metrics, const framecnt_t& frame) const; - framecnt_t frame_at_pulse_locked (const Metrics& metrics, const double& beat) const; + framecnt_t frame_at_pulse_locked (const Metrics& metrics, const double& pulse) const; double beat_at_frame_locked (const Metrics& metrics, const framecnt_t& frame) const; framecnt_t frame_at_beat_locked (const Metrics& metrics, const double& beat) const; diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc index 0df8efacbd..e6f43e412a 100644 --- a/libs/ardour/tempo.cc +++ b/libs/ardour/tempo.cc @@ -1485,6 +1485,13 @@ TempoMap::pulse_at_frame_locked (const Metrics& metrics, const framecnt_t& frame return pulses_in_section + prev_t->pulse(); } +double +TempoMap::pulse_at_frame (const framecnt_t& frame) const +{ + Glib::Threads::RWLock::ReaderLock lm (lock); + return pulse_at_frame_locked (_metrics, frame); +} + framecnt_t TempoMap::frame_at_pulse_locked (const Metrics& metrics, const double& pulse) const { @@ -1515,6 +1522,13 @@ TempoMap::frame_at_pulse_locked (const Metrics& metrics, const double& pulse) co return ret; } +framecnt_t +TempoMap::frame_at_pulse (const double& pulse) const +{ + Glib::Threads::RWLock::ReaderLock lm (lock); + return frame_at_pulse_locked (_metrics, pulse); +} + double TempoMap::beat_at_frame_locked (const Metrics& metrics, const framecnt_t& frame) const {