temporal: remove TempoMap::_type concept
Ramped/Constant is really a function of start/end note_types_per_minute. Having a separate member is really just caching it and leads to errors or risk thereof.
This commit is contained in:
parent
43b3ec005f
commit
8770df611c
@ -105,9 +105,7 @@ Tempo::Tempo (XMLNode const & node)
|
|||||||
if (!node.get_property (X_("note-type"), _note_type)) {
|
if (!node.get_property (X_("note-type"), _note_type)) {
|
||||||
throw failed_constructor ();
|
throw failed_constructor ();
|
||||||
}
|
}
|
||||||
if (!node.get_property (X_("type"), _type)) {
|
|
||||||
throw failed_constructor ();
|
|
||||||
}
|
|
||||||
if (!node.get_property (X_("active"), _active)) {
|
if (!node.get_property (X_("active"), _active)) {
|
||||||
throw failed_constructor ();
|
throw failed_constructor ();
|
||||||
}
|
}
|
||||||
@ -120,11 +118,7 @@ Tempo::Tempo (XMLNode const & node)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Tempo::set_ramped (bool yn)
|
|
||||||
{
|
{
|
||||||
_type = (yn ? Ramped : Constant);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Tempo::set_end (uint64_t n, superclock_t s)
|
Tempo::set_end (uint64_t n, superclock_t s)
|
||||||
{
|
{
|
||||||
@ -170,7 +164,6 @@ Tempo::set_state (XMLNode const & node, int /*version*/)
|
|||||||
_end_super_note_type_per_second = double_npm_to_snps (_enpm);
|
_end_super_note_type_per_second = double_npm_to_snps (_enpm);
|
||||||
|
|
||||||
node.get_property (X_("note-type"), _note_type);
|
node.get_property (X_("note-type"), _note_type);
|
||||||
node.get_property (X_("type"), _type);
|
|
||||||
node.get_property (X_("active"), _active);
|
node.get_property (X_("active"), _active);
|
||||||
|
|
||||||
if (!node.get_property (X_("locked-to-meter"), _locked_to_meter)) {
|
if (!node.get_property (X_("locked-to-meter"), _locked_to_meter)) {
|
||||||
@ -462,8 +455,8 @@ TempoPoint::compute_omega_from_next_tempo (TempoPoint const & next)
|
|||||||
end_scpqn = next.superclocks_per_quarter_note ();
|
end_scpqn = next.superclocks_per_quarter_note ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((_type == Constant) || (superclocks_per_quarter_note () == end_scpqn)) {
|
|
||||||
_omega = 0.0;
|
_omega = 0.0;
|
||||||
|
if (superclocks_per_quarter_note () == end_scpqn) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ class LIBTEMPORAL_API Tempo : public Rampable {
|
|||||||
, _active (true)
|
, _active (true)
|
||||||
, _locked_to_meter (false)
|
, _locked_to_meter (false)
|
||||||
, _clamped (false)
|
, _clamped (false)
|
||||||
, _type (Tempo::Constant) {}
|
{}
|
||||||
|
|
||||||
Tempo (double npm, double enpm, int note_type)
|
Tempo (double npm, double enpm, int note_type)
|
||||||
: _npm (npm)
|
: _npm (npm)
|
||||||
@ -206,7 +206,7 @@ class LIBTEMPORAL_API Tempo : public Rampable {
|
|||||||
, _active (true)
|
, _active (true)
|
||||||
, _locked_to_meter (false)
|
, _locked_to_meter (false)
|
||||||
, _clamped (false)
|
, _clamped (false)
|
||||||
, _type (npm != enpm ? Tempo::Ramped : Tempo::Constant) {}
|
{}
|
||||||
|
|
||||||
/* these five methods should only be used to show and collect information to the user (for whom
|
/* these five methods should only be used to show and collect information to the user (for whom
|
||||||
* bpm as a floating point number is the obvious representation)
|
* bpm as a floating point number is the obvious representation)
|
||||||
@ -260,9 +260,8 @@ class LIBTEMPORAL_API Tempo : public Rampable {
|
|||||||
bool clamped() const { return _clamped; }
|
bool clamped() const { return _clamped; }
|
||||||
void set_clamped (bool yn);
|
void set_clamped (bool yn);
|
||||||
|
|
||||||
Type type() const { return _type; }
|
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; }
|
||||||
bool ramped () const { return _type != Constant; }
|
|
||||||
|
|
||||||
XMLNode& get_state () const;
|
XMLNode& get_state () const;
|
||||||
int set_state (XMLNode const&, int version);
|
int set_state (XMLNode const&, int version);
|
||||||
@ -273,8 +272,7 @@ class LIBTEMPORAL_API Tempo : public Rampable {
|
|||||||
_note_type == other._note_type &&
|
_note_type == other._note_type &&
|
||||||
_active == other._active &&
|
_active == other._active &&
|
||||||
_locked_to_meter == other._locked_to_meter &&
|
_locked_to_meter == other._locked_to_meter &&
|
||||||
_clamped == other._clamped &&
|
_clamped == other._clamped;
|
||||||
_type == other._type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!= (Tempo const & other) const {
|
bool operator!= (Tempo const & other) const {
|
||||||
@ -283,8 +281,7 @@ class LIBTEMPORAL_API Tempo : public Rampable {
|
|||||||
_note_type != other._note_type ||
|
_note_type != other._note_type ||
|
||||||
_active != other._active ||
|
_active != other._active ||
|
||||||
_locked_to_meter != other._locked_to_meter ||
|
_locked_to_meter != other._locked_to_meter ||
|
||||||
_clamped != other._clamped ||
|
_clamped != other._clamped;
|
||||||
_type != other._type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t super_note_type_per_second() const { return _super_note_type_per_second; }
|
uint64_t super_note_type_per_second() const { return _super_note_type_per_second; }
|
||||||
@ -301,7 +298,6 @@ class LIBTEMPORAL_API Tempo : public Rampable {
|
|||||||
bool _active;
|
bool _active;
|
||||||
bool _locked_to_meter; /* XXX name has unclear meaning with nutempo */
|
bool _locked_to_meter; /* XXX name has unclear meaning with nutempo */
|
||||||
bool _clamped;
|
bool _clamped;
|
||||||
Type _type;
|
|
||||||
|
|
||||||
static inline uint64_t double_npm_to_snps (double npm) { return (uint64_t) llround (npm * big_numerator / 60); }
|
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()); }
|
static inline superclock_t double_npm_to_scpn (double npm) { return (superclock_t) llround ((60./npm) * superclock_ticks_per_second()); }
|
||||||
|
Loading…
Reference in New Issue
Block a user