change return type of Tempo::set_{ramped,clamped} and fix call sites

This commit is contained in:
Paul Davis 2021-03-22 11:27:47 -06:00
parent 99c8c0b658
commit ce3fb0507c
3 changed files with 22 additions and 33 deletions

View file

@ -1530,16 +1530,13 @@ Editor::toggle_tempo_clamped ()
XMLNode &before = tmap->get_state(); XMLNode &before = tmap->get_state();
Temporal::Tempo & tempo (tm->tempo()); Temporal::Tempo & tempo (tm->tempo());
if (tempo.set_clamped (!tempo.clamped())) { tempo.set_clamped (!tempo.clamped());
XMLNode &after = tmap->get_state(); XMLNode &after = tmap->get_state();
_session->add_command (new MementoCommand<Temporal::TempoMap> (new Temporal::TempoMap::MementoBinder(), &before, &after)); _session->add_command (new MementoCommand<Temporal::TempoMap> (new Temporal::TempoMap::MementoBinder(), &before, &after));
commit_reversible_command (); commit_reversible_command ();
TempoMap::update (tmap); TempoMap::update (tmap);
} else {
abort_reversible_command ();
}
} }
} }
@ -1558,15 +1555,12 @@ Editor::ramp_to_next_tempo ()
XMLNode &before = tmap->get_state(); XMLNode &before = tmap->get_state();
Temporal::TempoPoint & tempo (tm->tempo()); Temporal::TempoPoint & tempo (tm->tempo());
if (tmap->set_ramped (tempo, !tempo.ramped())) { tmap->set_ramped (tempo, !tempo.ramped());
XMLNode &after = tmap->get_state(); XMLNode &after = tmap->get_state();
_session->add_command (new MementoCommand<Temporal::TempoMap> (new Temporal::TempoMap::MementoBinder(), &before, &after)); _session->add_command (new MementoCommand<Temporal::TempoMap> (new Temporal::TempoMap::MementoBinder(), &before, &after));
commit_reversible_command (); commit_reversible_command ();
TempoMap::update (tmap); TempoMap::update (tmap);
} else {
abort_reversible_command ();
}
} }
} }

View file

@ -113,18 +113,16 @@ Tempo::Tempo (XMLNode const & node)
} }
} }
bool void
Tempo::set_ramped (bool yn) Tempo::set_ramped (bool yn)
{ {
_type = (yn ? Ramped : Constant); _type = (yn ? Ramped : Constant);
return true;
} }
bool void
Tempo::set_clamped (bool) Tempo::set_clamped (bool yn)
{ {
#warning implement Tempo::set_clamped _clamped = yn;
return true;
} }
XMLNode& XMLNode&
@ -2892,16 +2890,13 @@ TempoMap::metric_at (BBT_Time const & bbt, bool can_match) const
return TempoMetric (*const_cast<TempoPoint*>(prev_t), *const_cast<MeterPoint*> (prev_m)); return TempoMetric (*const_cast<TempoPoint*>(prev_t), *const_cast<MeterPoint*> (prev_m));
} }
bool void
TempoMap::set_ramped (TempoPoint & tp, bool yn) TempoMap::set_ramped (TempoPoint & tp, bool yn)
{ {
Rampable & r (tp); Rampable & r (tp);
bool ret = r.set_ramped (yn); r.set_ramped (yn);
if (ret) {
reset_starting_at (tp.sclock()); reset_starting_at (tp.sclock());
} }
return ret;
}
#if 0 #if 0
bool bool

View file

@ -144,7 +144,7 @@ class LIBTEMPORAL_API Rampable {
private: private:
friend class TempoMap; friend class TempoMap;
virtual bool set_ramped (bool yn) = 0; virtual void set_ramped (bool yn) = 0;
}; };
/** Tempo, the speed at which musical time progresses (BPM). /** Tempo, the speed at which musical time progresses (BPM).
@ -246,7 +246,7 @@ class LIBTEMPORAL_API Tempo : public Rampable {
void set_locked_to_meter (bool yn) { _locked_to_meter = yn; } void set_locked_to_meter (bool yn) { _locked_to_meter = yn; }
bool clamped() const { return _clamped; } bool clamped() const { return _clamped; }
bool set_clamped (bool yn); void set_clamped (bool yn);
Type type() const { return _type; } Type type() const { return _type; }
@ -295,7 +295,7 @@ class LIBTEMPORAL_API Tempo : public Rampable {
static inline superclock_t double_npm_to_scpn (double npm) { return (superclock_t) llround ((60./npm) * superclock_ticks_per_second); } static inline superclock_t double_npm_to_scpn (double npm) { return (superclock_t) llround ((60./npm) * superclock_ticks_per_second); }
private: private:
bool set_ramped (bool yn); void set_ramped (bool yn);
}; };
/** Meter, or time signature (subdivisions per bar, and which note type is a single subdivision). */ /** Meter, or time signature (subdivisions per bar, and which note type is a single subdivision). */
@ -675,7 +675,7 @@ class LIBTEMPORAL_API TempoMap : public PBD::StatefulDestructible
* the RCU manager. * the RCU manager.
*/ */
bool set_ramped (TempoPoint&, bool); void set_ramped (TempoPoint&, bool);
void insert_time (timepos_t const & pos, timecnt_t const & duration); void insert_time (timepos_t const & pos, timecnt_t const & duration);
bool remove_time (timepos_t const & pos, timecnt_t const & duration); bool remove_time (timepos_t const & pos, timecnt_t const & duration);