diff options
author | nick_m <mainsbridge@gmail.com> | 2016-05-20 06:39:48 +1000 |
---|---|---|
committer | nick_m <mainsbridge@gmail.com> | 2016-05-27 23:38:16 +1000 |
commit | 82d876b48b9de4e178547d00e91e6aa098ae56a7 (patch) | |
tree | 61653c2fbc3fce5b6b974f3161263ec2988c6806 /gtk2_ardour/editor_markers.cc | |
parent | 820e9a43f54d9ec4c403492527e2f0a136f76569 (diff) |
Tempo ramps - clean up add/replace tempo
Diffstat (limited to 'gtk2_ardour/editor_markers.cc')
-rw-r--r-- | gtk2_ardour/editor_markers.cc | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc index a1fef51d67..635131fdd1 100644 --- a/gtk2_ardour/editor_markers.cc +++ b/gtk2_ardour/editor_markers.cc @@ -1403,11 +1403,9 @@ Editor::toggle_marker_lock_style () begin_reversible_command (_("change tempo lock style")); XMLNode &before = _session->tempo_map().get_state(); TempoSection* tsp = &tm->tempo(); - if (tsp->position_lock_style() == AudioTime) { - _session->tempo_map().replace_tempo_pulse (*tsp, Tempo (tsp->beats_per_minute(), tsp->note_type()), tsp->pulse(), tsp->type()); - } else { - _session->tempo_map().replace_tempo_frame (*tsp, Tempo (tsp->beats_per_minute(), tsp->note_type()), tsp->frame(), tsp->type()); - } + const PositionLockStyle pls = (tsp->position_lock_style() == AudioTime) ? MusicTime : AudioTime; + _session->tempo_map().replace_tempo (*tsp, Tempo (tsp->beats_per_minute(), tsp->note_type()), tsp->pulse(), tsp->frame(), tsp->type(), pls); + XMLNode &after = _session->tempo_map().get_state(); _session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after)); commit_reversible_command (); @@ -1425,13 +1423,9 @@ Editor::toggle_tempo_type () begin_reversible_command (_("change tempo type")); XMLNode &before = _session->tempo_map().get_state(); TempoSection* tsp = &tm->tempo(); - if (tsp->position_lock_style() == AudioTime) { - _session->tempo_map().replace_tempo_frame (*tsp, Tempo (tsp->beats_per_minute(), tsp->note_type()) - , tsp->frame(), (tsp->type() == TempoSection::Ramp) ? TempoSection::Constant : TempoSection::Ramp); - } else { - _session->tempo_map().replace_tempo_pulse (*tsp, Tempo (tsp->beats_per_minute(), tsp->note_type()) - , tsp->pulse(), (tsp->type() == TempoSection::Ramp) ? TempoSection::Constant : TempoSection::Ramp); - } + const TempoSection::Type type = (tsp->type() == TempoSection::Ramp) ? TempoSection::Constant : TempoSection::Ramp; + _session->tempo_map().replace_tempo (*tsp, Tempo (tsp->beats_per_minute(), tsp->note_type()), tsp->pulse(), tsp->frame() + , type, tsp->position_lock_style()); XMLNode &after = _session->tempo_map().get_state(); _session->add_command(new MementoCommand<TempoMap>(_session->tempo_map(), &before, &after)); |