13
0

use TempoMapChange for define_one_bar

This commit is contained in:
Paul Davis 2022-10-27 12:12:28 -06:00
parent 0e20c4b3eb
commit 9c5d396334

View File

@ -7436,25 +7436,17 @@ Editor::define_one_bar (timepos_t const & start, timepos_t const & end)
*/
}
begin_reversible_command (_("set tempo from region"));
XMLNode& before (tmap->get_state());
TempoMapChange tmc (*this, _("set tempo from region"));
if (do_global) {
tmap->set_tempo (Tempo (beats_per_minute, t.end_note_types_per_minute(), t.note_type()), timepos_t());
tmc.map().set_tempo (Tempo (beats_per_minute, t.end_note_types_per_minute(), t.note_type()), timepos_t());
} else if (t.time() == start) {
tmap->set_tempo (Tempo (beats_per_minute, t.end_note_types_per_minute(), t.note_type()), start);
tmc.map().set_tempo (Tempo (beats_per_minute, t.end_note_types_per_minute(), t.note_type()), start);
} else {
/* constant tempo */
const Tempo tempo (beats_per_minute, t.note_type());
tmap->set_tempo (tempo, start);
tmc.map().set_tempo (tempo, start);
}
XMLNode& after (tmap->get_state());
_session->add_command (new Temporal::TempoCommand (_("set tempo from range"), &before, &after));
TempoMap::update (tmap);
commit_reversible_command ();
}
void