13
0

temporal: add optional with_reset arg to all map ::remove_*() methods

This commit is contained in:
Paul Davis 2022-12-20 21:54:05 -07:00
parent 0ee0226776
commit 818c30a98d
2 changed files with 16 additions and 10 deletions

View File

@ -817,7 +817,7 @@ TempoMap::change_tempo (TempoPoint & p, Tempo const & t)
void
TempoMap::replace_tempo (TempoPoint const & old, Tempo const & t, timepos_t const & time)
{
remove_tempo (old);
remove_tempo (old, false);
set_tempo (t, time);
}
@ -983,7 +983,7 @@ TempoMap::add_tempo (TempoPoint * tp)
}
void
TempoMap::remove_tempo (TempoPoint const & tp)
TempoMap::remove_tempo (TempoPoint const & tp, bool with_reset)
{
if (_tempos.size() < 2) {
return;
@ -1040,7 +1040,9 @@ TempoMap::remove_tempo (TempoPoint const & tp)
if (prev != _tempos.end() && was_end) {
prev->set_end_npm (prev->note_types_per_minute()); /* remove any ramp */
} else {
reset_starting_at (sc);
if (with_reset) {
reset_starting_at (sc);
}
}
}
@ -1077,7 +1079,7 @@ TempoMap::add_or_replace_bartime (MusicTimePoint* mtp)
}
void
TempoMap::remove_bartime (MusicTimePoint const & tp)
TempoMap::remove_bartime (MusicTimePoint const & tp, bool with_reset)
{
superclock_t sc (tp.sclock());
MusicTimes::iterator m;
@ -1106,7 +1108,9 @@ TempoMap::remove_bartime (MusicTimePoint const & tp)
_bartimes.erase (m);
remove_point (*m);
reset_starting_at (sc);
if (with_reset) {
reset_starting_at (sc);
}
}
void
@ -1616,7 +1620,7 @@ TempoMap::set_meter (Meter const & t, BBT_Time const & bbt)
}
void
TempoMap::remove_meter (MeterPoint const & mp)
TempoMap::remove_meter (MeterPoint const & mp, bool with_reset)
{
if (_meters.size() < 2) {
return;
@ -1654,7 +1658,9 @@ TempoMap::remove_meter (MeterPoint const & mp)
_meters.erase (m);
remove_point (*m);
reset_starting_at (sc);
if (with_reset) {
reset_starting_at (sc);
}
}
Temporal::BBT_Time

View File

@ -734,7 +734,7 @@ class /*LIBTEMPORAL_API*/ TempoMap : public PBD::StatefulDestructible
LIBTEMPORAL_API void change_tempo (TempoPoint&, Tempo const&);
LIBTEMPORAL_API void set_bartime (BBT_Time const &, timepos_t const &, std::string name = std::string());
LIBTEMPORAL_API void remove_bartime (MusicTimePoint const & tp);
LIBTEMPORAL_API void remove_bartime (MusicTimePoint const & tp, bool with_reset = true);
LIBTEMPORAL_API TempoPoint& set_tempo (Tempo const &, BBT_Time const &);
LIBTEMPORAL_API TempoPoint& set_tempo (Tempo const &, timepos_t const &);
@ -744,8 +744,8 @@ class /*LIBTEMPORAL_API*/ TempoMap : public PBD::StatefulDestructible
LIBTEMPORAL_API MeterPoint& set_meter (Meter const &, BBT_Time const &);
LIBTEMPORAL_API MeterPoint& set_meter (Meter const &, timepos_t const &);
LIBTEMPORAL_API void remove_tempo (TempoPoint const &);
LIBTEMPORAL_API void remove_meter (MeterPoint const &);
LIBTEMPORAL_API void remove_tempo (TempoPoint const &, bool with_reset = true);
LIBTEMPORAL_API void remove_meter (MeterPoint const &, bool with_reset = true);
/* these are a convenience method that just wrap some odd semantics */
LIBTEMPORAL_API bool move_tempo (TempoPoint const & point, timepos_t const & destination, bool push = false);