temporal: remove Rampable, change name of method to set end note types per minute
Rampable only existed to provide exclusive access to ::set_end() for the TempoMap. More idiomatic C++ but now that _type has also gone away, so has ::set_ramped() and it really was not worth keeping it around.
This commit is contained in:
parent
8770df611c
commit
f679cd6eab
@ -118,12 +118,10 @@ Tempo::Tempo (XMLNode const & node)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Tempo::set_end_npm (double npm)
|
||||||
{
|
{
|
||||||
void
|
_end_super_note_type_per_second = double_npm_to_snps (npm);
|
||||||
Tempo::set_end (uint64_t n, superclock_t s)
|
_end_superclocks_per_note_type = double_npm_to_scpn (npm);
|
||||||
{
|
|
||||||
_end_super_note_type_per_second = n;
|
|
||||||
_end_superclocks_per_note_type = s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -2997,8 +2995,6 @@ TempoMap::set_ramped (TempoPoint & tp, bool yn)
|
|||||||
{
|
{
|
||||||
assert (!_tempos.empty());
|
assert (!_tempos.empty());
|
||||||
|
|
||||||
Rampable & r (tp);
|
|
||||||
|
|
||||||
if (tp.ramped() == yn) {
|
if (tp.ramped() == yn) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3017,15 +3013,12 @@ TempoMap::set_ramped (TempoPoint & tp, bool yn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (yn) {
|
if (yn) {
|
||||||
r.set_end (nxt->end_super_note_type_per_second(), nxt->end_superclocks_per_note_type());
|
tp.set_end_npm (nxt->end_note_types_per_minute());
|
||||||
} else {
|
} else {
|
||||||
r.set_end (tp.super_note_type_per_second(), tp.superclocks_per_note_type());
|
tp.set_end_npm (tp.note_types_per_minute());
|
||||||
}
|
}
|
||||||
|
|
||||||
r.set_ramped (yn);
|
reset_starting_at (tp.sclock());
|
||||||
tp.compute_omega_from_next_tempo (*nxt);
|
|
||||||
|
|
||||||
reset_starting_at (tp.sclock() + 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3106,7 +3099,7 @@ TempoMap::stretch_tempo (TempoPoint* ts, const samplepos_t sample, const samplep
|
|||||||
if (ts->clamped()) {
|
if (ts->clamped()) {
|
||||||
TempoPoint* prev = 0;
|
TempoPoint* prev = 0;
|
||||||
if ((prev = const_cast<TempoPoint*> (previous_tempo (*ts))) != 0) {
|
if ((prev = const_cast<TempoPoint*> (previous_tempo (*ts))) != 0) {
|
||||||
prev->set_end_note_types_per_minute (ts->note_types_per_minute());
|
prev->set_end_npm (ts->end_note_types_per_minute());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3625,7 +3618,7 @@ TempoMap::fix_legacy_session ()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* Ramp type never existed in the era of this tempo section */
|
/* Ramp type never existed in the era of this tempo section */
|
||||||
t->set_end_note_types_per_minute (t->note_types_per_minute());
|
t->set_end_npm (t->note_types_per_minute());
|
||||||
|
|
||||||
if (t->initial()) {
|
if (t->initial()) {
|
||||||
t->set_pulse (0.0);
|
t->set_pulse (0.0);
|
||||||
@ -3677,7 +3670,7 @@ TempoMap::fix_legacy_end_session ()
|
|||||||
|
|
||||||
if (prev_t) {
|
if (prev_t) {
|
||||||
if (prev_t->end_note_types_per_minute() < 0.0) {
|
if (prev_t->end_note_types_per_minute() < 0.0) {
|
||||||
prev_t->set_end_note_types_per_minute (t->note_types_per_minute());
|
prev_t->set_end_npm (t->note_types_per_minute());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3686,7 +3679,7 @@ TempoMap::fix_legacy_end_session ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (prev_t) {
|
if (prev_t) {
|
||||||
prev_t->set_end_note_types_per_minute (prev_t->note_types_per_minute());
|
prev_t->set_end_npm (prev_t->note_types_per_minute());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,24 +142,10 @@ class /*LIBTEMPORAL_API*/ Point : public point_hook {
|
|||||||
void map_reset_set_sclock_for_sr_change (superclock_t sc) { _sclock = sc; }
|
void map_reset_set_sclock_for_sr_change (superclock_t sc) { _sclock = sc; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/* this exists only to give the TempoMap the only access to ::set_ramped() in a
|
|
||||||
* derived class
|
|
||||||
*/
|
|
||||||
|
|
||||||
class LIBTEMPORAL_API Rampable {
|
|
||||||
protected:
|
|
||||||
virtual ~Rampable() {}
|
|
||||||
|
|
||||||
private:
|
|
||||||
friend class TempoMap;
|
|
||||||
virtual void set_ramped (bool yn) = 0;
|
|
||||||
virtual void set_end (uint64_t, superclock_t) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** Tempo, the speed at which musical time progresses (BPM).
|
/** Tempo, the speed at which musical time progresses (BPM).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class LIBTEMPORAL_API Tempo : public Rampable {
|
class LIBTEMPORAL_API Tempo {
|
||||||
private:
|
private:
|
||||||
/* beats per minute * big_numerator => rational number expressing (possibly fractional) bpm as superbeats-per-minute
|
/* beats per minute * big_numerator => rational number expressing (possibly fractional) bpm as superbeats-per-minute
|
||||||
*
|
*
|
||||||
@ -218,7 +204,6 @@ class LIBTEMPORAL_API Tempo : public Rampable {
|
|||||||
double samples_per_quarter_note(samplecnt_t sr) const { return superclock_to_samples (superclocks_per_quarter_note(), sr); }
|
double samples_per_quarter_note(samplecnt_t sr) const { return superclock_to_samples (superclocks_per_quarter_note(), sr); }
|
||||||
|
|
||||||
void set_note_types_per_minute (double npm) { _superclocks_per_note_type = double_npm_to_scpn (npm); }
|
void set_note_types_per_minute (double npm) { _superclocks_per_note_type = double_npm_to_scpn (npm); }
|
||||||
void set_end_note_types_per_minute (double npm) { _end_superclocks_per_note_type = double_npm_to_scpn (npm); }
|
|
||||||
|
|
||||||
int note_type () const { return _note_type; }
|
int note_type () const { return _note_type; }
|
||||||
Beats note_type_as_beats () const { return Beats (0, (1920 * 4) / _note_type); }
|
Beats note_type_as_beats () const { return Beats (0, (1920 * 4) / _note_type); }
|
||||||
@ -302,9 +287,9 @@ class LIBTEMPORAL_API Tempo : public Rampable {
|
|||||||
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()); }
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
void set_ramped (bool yn);
|
friend class TempoMap;
|
||||||
void set_end (uint64_t snps, superclock_t espn);
|
void set_end_npm (double);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** 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). */
|
||||||
|
Loading…
Reference in New Issue
Block a user