temporal: add TempoMap::set_continuing() and make it and set_ramped return bool

This commit is contained in:
Paul Davis 2022-05-23 11:24:59 -06:00
parent f2a596669e
commit e7e467264f
2 changed files with 25 additions and 4 deletions

View File

@ -3046,13 +3046,13 @@ TempoMap::metric_at (BBT_Time const & bbt, bool can_match) const
return TempoMetric (*tp, *mp);
}
void
bool
TempoMap::set_ramped (TempoPoint & tp, bool yn)
{
assert (!_tempos.empty());
if (tp.ramped() == yn) {
return;
return false;
}
Tempos::iterator nxt = _tempos.begin();
@ -3065,7 +3065,7 @@ TempoMap::set_ramped (TempoPoint & tp, bool yn)
}
if (nxt == _tempos.end()) {
return;
return false;
}
if (yn) {
@ -3075,8 +3075,28 @@ TempoMap::set_ramped (TempoPoint & tp, bool yn)
}
reset_starting_at (tp.sclock());
return true;
}
bool
TempoMap::set_continuing (TempoPoint& tp, bool yn)
{
if (!yn) {
tp.set_continuing (false);
return true; /* change made */
}
TempoPoint const * prev = previous_tempo (tp);
if (!prev) {
return false;
}
tp.set_note_types_per_minute (prev->note_types_per_minute());
return true;
}
void
TempoMap::stretch_tempo (TempoPoint* ts, samplepos_t sample, samplepos_t end_sample, Beats const & start_qnote, Beats const & end_qnote)

View File

@ -690,7 +690,8 @@ class /*LIBTEMPORAL_API*/ TempoMap : public PBD::StatefulDestructible
* the RCU manager.
*/
LIBTEMPORAL_API void set_ramped (TempoPoint&, bool);
LIBTEMPORAL_API bool set_ramped (TempoPoint&, bool);
LIBTEMPORAL_API bool set_continuing (TempoPoint&, bool);
LIBTEMPORAL_API void insert_time (timepos_t const & pos, timecnt_t const & duration);
LIBTEMPORAL_API bool remove_time (timepos_t const & pos, timecnt_t const & duration);