more functional tempo mapping

TempoMarker drag modifies tempo (and thus beat-time positions
and durations).

BBTRuler drag modifies the map but not positions/durations
This commit is contained in:
Paul Davis 2023-02-24 16:51:44 -07:00
parent 45490bf43f
commit 38bb89c110
3 changed files with 46 additions and 39 deletions

View file

@ -3489,7 +3489,7 @@ BBTRulerDrag::BBTRulerDrag (Editor* e, ArdourCanvas::Item* i)
void
BBTRulerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
{
map = _editor->begin_tempo_map_edit ();
map = _editor->begin_tempo_mapping ();
Drag::start_grab (event, cursor);
@ -3598,26 +3598,28 @@ BBTRulerDrag::finished (GdkEvent* event, bool movement_occurred)
}
}
XMLNode &after = map->get_state();
_editor->session()->add_command (new Temporal::TempoCommand (_("move BBT point"), _before_state, &after));
_editor->commit_reversible_command ();
/* 2nd argument means "update tempo map display after the new map is
* installed. We need to do this because the code above has not
* actually changed anything about how tempo is displayed, it simply
* modified the map.
*/
_editor->commit_tempo_map_edit (map, true);
XMLNode &after = map->get_state();
_editor->session()->add_command (new Temporal::TempoCommand (_("move BBT point"), _before_state, &after));
_editor->commit_reversible_command ();
_editor->commit_tempo_mapping (map);
}
void
BBTRulerDrag::aborted (bool moved)
{
TempoMap::abort_update ();
_editor->abort_tempo_mapping ();
}
/*------------------------------------------------------------------*/
TempoTwistDrag::TempoTwistDrag (Editor* e, ArdourCanvas::Item* i)
: Drag (e, i, Temporal::BeatTime)
, _tempo (0)

View file

@ -738,11 +738,15 @@ Editor::LocationMarkers::setup_lines ()
void
Editor::mouse_add_new_marker (timepos_t where, Location::Flags extra_flags, int32_t cue_id)
{
if (!_session) {
return;
}
string markername;
string namebase;
Location::Flags flags = Location::Flags (extra_flags|Location::IsMark);
if (_session) {
std::cerr << "adding marker @ " << where << std::endl;
if (flags & Location::IsCueMarker) {
/* XXX i18n needed for cue letter names */
@ -774,7 +778,6 @@ Editor::mouse_add_new_marker (timepos_t where, Location::Flags extra_flags, int3
commit_reversible_command ();
}
}
void
Editor::mouse_add_new_loop (timepos_t where)

View file

@ -821,7 +821,7 @@ Editor::mid_tempo_change (MidTempoChanges what_changed)
// TempoMap::SharedPtr map (TempoMap::use());
// map->dump (std::cerr);
if (what_changed & TempoChanged) {
if ((what_changed & MidTempoChanges(BBTChanged|TempoChanged))) {
double min_tempo = DBL_MAX;
double max_tempo = 0.0;
@ -850,8 +850,10 @@ Editor::mid_tempo_change (MidTempoChanges what_changed)
update_tempo_based_rulers ();
maybe_draw_grid_lines ();
if (!(what_changed & BBTChanged)) {
/* Nothing changes in tracks when it is a BBT change */
foreach_time_axis_view (sigc::mem_fun (*this, &Editor::mid_tempo_per_track_update));
}
}
void