temporal: add a new ::set_tempo() method for use when loading older tempo maps

This commit is contained in:
Paul Davis 2023-11-13 22:29:29 -07:00
parent 7be61b0909
commit f8d86c8d19
2 changed files with 14 additions and 0 deletions

View file

@ -1390,6 +1390,19 @@ TempoMap::set_tempo (Tempo const & t, timepos_t const & time)
return *ret; return *ret;
} }
TempoPoint &
TempoMap::set_tempo (Tempo const & t, timepos_t const & time, Beats const & beats)
{
assert (!time.is_beats());
BBT_Time bbt;
TempoMetric metric (metric_at (beats, false));
bbt = metric.bbt_at (beats);
TempoPoint* tp = new TempoPoint (*this, t, time.superclocks(), beats, bbt);
TempoPoint* ret = add_tempo (tp);
return *ret;
}
void void
TempoMap::core_add_point (Point* pp) TempoMap::core_add_point (Point* pp)
{ {

View file

@ -1180,6 +1180,7 @@ class /*LIBTEMPORAL_API*/ TempoMap : public PBD::StatefulDestructible
int parse_tempo_state_3x (const XMLNode& node, LegacyTempoState& lts); int parse_tempo_state_3x (const XMLNode& node, LegacyTempoState& lts);
int parse_meter_state_3x (const XMLNode& node, LegacyMeterState& lts); int parse_meter_state_3x (const XMLNode& node, LegacyMeterState& lts);
int set_state_3x (XMLNode const &); int set_state_3x (XMLNode const &);
TempoPoint & set_tempo (Tempo const & t, timepos_t const & time, Beats const & beats);
friend class TempoPoint; friend class TempoPoint;
friend class MeterPoint; friend class MeterPoint;