temporal: change "clamped" terminology to "continuing" (since that's what the GUI calls it)

This commit is contained in:
Paul Davis 2022-05-23 08:06:36 -06:00
parent fcbe6aab49
commit 20d7313e13
2 changed files with 36 additions and 26 deletions

View File

@ -113,8 +113,11 @@ Tempo::Tempo (XMLNode const & node)
if (!node.get_property (X_("locked-to-meter"), _locked_to_meter)) {
_locked_to_meter = true;
}
if (!node.get_property (X_("clamped"), _clamped)) {
_clamped = false;
/* older versions used "clamped" as the property name here */
if (!node.get_property (X_("continuing"), _continuing) && !node.get_property (X_("clamped"), _continuing)) {
_continuing = false;
}
}
@ -126,9 +129,9 @@ Tempo::set_end_npm (double npm)
}
void
Tempo::set_clamped (bool yn)
Tempo::set_continuing (bool yn)
{
_clamped = yn;
_continuing = yn;
}
XMLNode&
@ -142,7 +145,7 @@ Tempo::get_state () const
node->set_property (X_("type"), type());
node->set_property (X_("active"), active());
node->set_property (X_("locked-to-meter"), _locked_to_meter);
node->set_property (X_("clamped"), _clamped);
node->set_property (X_("continuing"), _continuing);
return *node;
}
@ -169,8 +172,10 @@ Tempo::set_state (XMLNode const & node, int /*version*/)
_locked_to_meter = true;
}
if (!node.get_property (X_("clamped"), _clamped)) {
_clamped = false;
/* older versions used "clamped" as the property name here */
if (!node.get_property (X_("continuing"), _continuing) && !node.get_property (X_("continuing"), _continuing)) {
_continuing = false;
}
return 0;
@ -450,7 +455,7 @@ TempoPoint::compute_omega_from_next_tempo (TempoPoint const & next)
{
superclock_t end_scpqn;
if (!_clamped) {
if (!_continuing) {
/* tempo is defined by our own start and end */
end_scpqn = end_superclocks_per_quarter_note();
} else {
@ -3086,7 +3091,7 @@ TempoMap::stretch_tempo (TempoPoint* ts, samplepos_t sample, samplepos_t end_sam
const superclock_t min_delta_sclock = samples_to_superclock (2, TEMPORAL_SAMPLE_RATE);
double new_bpm;
if (ts->clamped()) {
if (ts->continuing()) {
/* this tempo point is required to start using the same bpm
* that the previous tempo ended with.
@ -3138,7 +3143,7 @@ TempoMap::stretch_tempo (TempoPoint* ts, samplepos_t sample, samplepos_t end_sam
ts->set_note_types_per_minute (new_bpm);
if (ts->clamped()) {
if (ts->continuing()) {
TempoPoint* prev = 0;
if ((prev = const_cast<TempoPoint*> (previous_tempo (*ts))) != 0) {
prev->set_end_npm (ts->end_note_types_per_minute());
@ -3190,7 +3195,7 @@ TempoMap::stretch_tempo_end (TempoPoint* ts, samplepos_t sample, samplepos_t end
prev_t->set_end_npm (new_bpm);
if (ts->clamped()) {
if (ts->continuing()) {
ts->set_note_types_per_minute (prev_t->end_note_types_per_minute());
}
@ -3297,7 +3302,7 @@ TempoMap::twist_tempi (TempoPoint* ts, samplepos_t start_sample, samplepos_t end
ts->set_end_npm (new_copy_end_bpm);
if (next_t->clamped()) {
if (next_t->continuing()) {
next_t->set_note_types_per_minute (new_copy_end_bpm);
} else {
next_t->set_note_types_per_minute (new_next_bpm);
@ -3439,8 +3444,10 @@ TempoMap::parse_tempo_state_3x (const XMLNode& node, LegacyTempoState& lts)
lts.note_type = 4.0;
}
if (!node.get_property ("clamped", lts.clamped)) {
lts.clamped = false;
/* older versions used "clamped" as the property name here */
if (!node.get_property ("clamped", lts.continuing)) {
lts.continuing = false;
}
if (node.get_property ("end-beats-per-minute", lts.end_note_types_per_minute)) {
@ -3573,6 +3580,9 @@ TempoMap::set_state_3x (const XMLNode& node)
lts.end_note_types_per_minute,
lts.note_type);
TempoPoint* tp = new TempoPoint (*this, t, samples_to_superclock (0, TEMPORAL_SAMPLE_RATE), Beats(), BBT_Time());
tp->set_continuing (lts.continuing);
_tempos.clear ();
if (need_points_clear) {
_points.clear ();

View File

@ -178,7 +178,7 @@ class LIBTEMPORAL_API Tempo {
, _note_type (note_type)
, _active (true)
, _locked_to_meter (false)
, _clamped (false)
, _continuing (false)
{}
Tempo (double npm, double enpm, int note_type)
@ -191,7 +191,7 @@ class LIBTEMPORAL_API Tempo {
, _note_type (note_type)
, _active (true)
, _locked_to_meter (false)
, _clamped (false)
, _continuing (false)
{}
/* these five methods should only be used to show and collect information to the user (for whom
@ -242,8 +242,8 @@ class LIBTEMPORAL_API Tempo {
bool locked_to_meter () const { return _locked_to_meter; }
void set_locked_to_meter (bool yn) { _locked_to_meter = yn; }
bool clamped() const { return _clamped; }
void set_clamped (bool yn);
bool continuing() const { return _continuing; }
void set_continuing (bool yn);
Type type() const { return _superclocks_per_note_type == _end_superclocks_per_note_type ? Constant : Ramped; }
bool ramped () const { return _superclocks_per_note_type != _end_superclocks_per_note_type; }
@ -253,11 +253,11 @@ class LIBTEMPORAL_API Tempo {
bool operator== (Tempo const & other) const {
return _superclocks_per_note_type == other._superclocks_per_note_type &&
_end_superclocks_per_note_type == other._end_superclocks_per_note_type &&
_note_type == other._note_type &&
_active == other._active &&
_locked_to_meter == other._locked_to_meter &&
_clamped == other._clamped;
_end_superclocks_per_note_type == other._end_superclocks_per_note_type &&
_note_type == other._note_type &&
_active == other._active &&
_locked_to_meter == other._locked_to_meter &&
_continuing == other._continuing;
}
bool operator!= (Tempo const & other) const {
@ -266,7 +266,7 @@ class LIBTEMPORAL_API Tempo {
_note_type != other._note_type ||
_active != other._active ||
_locked_to_meter != other._locked_to_meter ||
_clamped != other._clamped;
_continuing != other._continuing;
}
uint64_t super_note_type_per_second() const { return _super_note_type_per_second; }
@ -282,7 +282,7 @@ class LIBTEMPORAL_API Tempo {
int8_t _note_type;
bool _active;
bool _locked_to_meter; /* XXX name has unclear meaning with nutempo */
bool _clamped;
bool _continuing;
static inline uint64_t double_npm_to_snps (double npm) { return (uint64_t) llround (npm * big_numerator / 60); }
static inline superclock_t double_npm_to_scpn (double npm) { return (superclock_t) llround ((60./npm) * superclock_ticks_per_second()); }
@ -1013,7 +1013,7 @@ class /*LIBTEMPORAL_API*/ TempoMap : public PBD::StatefulDestructible
double note_types_per_minute;
double end_note_types_per_minute;
double note_type;
bool clamped;
bool continuing; /* "clamped" in actual legacy stuff */
bool active;
};