From ca348ce0d9e531a69112b7277d58717414568e3b Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 25 Jul 2023 13:50:05 -0600 Subject: [PATCH] temporal: add TempoMap::replace_bartime() --- libs/temporal/tempo.cc | 12 ++++++++++++ libs/temporal/temporal/tempo.h | 1 + 2 files changed, 13 insertions(+) diff --git a/libs/temporal/tempo.cc b/libs/temporal/tempo.cc index 8d281fc539..0a107e91cd 100644 --- a/libs/temporal/tempo.cc +++ b/libs/temporal/tempo.cc @@ -1493,6 +1493,18 @@ TempoMap::set_bartime (BBT_Time const & bbt, timepos_t const & pos, std::string add_or_replace_bartime (tp); } +void +TempoMap::replace_bartime (MusicTimePoint & mtp, bool with_reset) +{ + bool ignored; + + core_add_bartime (&mtp, ignored); + + if (with_reset) { + reset_starting_at (mtp.sclock()); + } +} + MusicTimePoint* TempoMap::add_or_replace_bartime (MusicTimePoint* mtp) { diff --git a/libs/temporal/temporal/tempo.h b/libs/temporal/temporal/tempo.h index 9b83ebae8c..e3a4bdc7a0 100644 --- a/libs/temporal/temporal/tempo.h +++ b/libs/temporal/temporal/tempo.h @@ -822,6 +822,7 @@ class /*LIBTEMPORAL_API*/ TempoMap : public PBD::StatefulDestructible LIBTEMPORAL_API void set_bartime (BBT_Time const &, timepos_t const &, std::string name = std::string()); LIBTEMPORAL_API void remove_bartime (MusicTimePoint const & tp, bool with_reset = true); + LIBTEMPORAL_API void replace_bartime (MusicTimePoint & tp, bool with_reset = true); LIBTEMPORAL_API TempoPoint& set_tempo (Tempo const &, BBT_Argument const &); LIBTEMPORAL_API TempoPoint& set_tempo (Tempo const &, timepos_t const &);