summaryrefslogtreecommitdiff
path: root/libs/ardour/tempo.cc
diff options
context:
space:
mode:
authornick_m <mainsbridge@gmail.com>2016-11-01 21:54:11 +1100
committernick_m <mainsbridge@gmail.com>2016-11-11 03:37:08 +1100
commit594137f5cc5d641873b9002c28453166e81bac9e (patch)
tree372b45608c4cb95e1d7a0fe4aa337e86e2deb793 /libs/ardour/tempo.cc
parent3db68b4f9e88658e8130769ee469f2a7b4de97a2 (diff)
remove public pulse methods from TempoMap.
- the only object whose musical position is not expressed in quarter notes is MetricSection. there is now no need to expose this.
Diffstat (limited to 'libs/ardour/tempo.cc')
-rw-r--r--libs/ardour/tempo.cc82
1 files changed, 25 insertions, 57 deletions
diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc
index a060b93b34..3410646a8c 100644
--- a/libs/ardour/tempo.cc
+++ b/libs/ardour/tempo.cc
@@ -1584,7 +1584,7 @@ TempoMap::minute_at_beat_locked (const Metrics& metrics, const double& beat) con
return prev_t->minute_at_pulse (((beat - prev_m->beat()) / prev_m->note_divisor()) + prev_m->pulse());
}
-/** Returns a Tempo corresponding to the supplied frame.
+/** Returns a Tempo corresponding to the supplied frame position.
* @param frame The audio frame.
* @return a Tempo according to the tempo map at the supplied frame.
*
@@ -1744,6 +1744,7 @@ TempoMap::pulse_at_tempo_locked (const Metrics& metrics, const Tempo& tempo) con
/** Returns a Tempo corresponding to the supplied BBT (meter-based) beat.
* @param beat The BBT (meter-based) beat.
+ * @return the Tempo at the supplied BBT (meter-based) beat.
*/
Tempo
TempoMap::tempo_at_beat (const double& beat) const
@@ -1757,6 +1758,7 @@ TempoMap::tempo_at_beat (const double& beat) const
/** Returns a BBT (meter-based) beat corresponding to the supplied Tempo.
* @param tempo The tempo.
+ * @return the BBT (meter-based) beat at the supplied Tempo.
*/
double
TempoMap::beat_at_tempo (const Tempo& tempo) const
@@ -1766,21 +1768,17 @@ TempoMap::beat_at_tempo (const Tempo& tempo) const
return beat_at_pulse_locked (_metrics, pulse);
}
+
/** Returns the whole-note pulse corresponding to the supplied BBT (meter-based) beat.
+ * @param metrics the list of metric sections used to calculate the pulse.
* @param beat The BBT (meter-based) beat.
+ * @return the whole-note pulse at the supplied BBT (meter-based) beat.
*
* a pulse or whole note is the base musical position of a MetricSection.
* it is equivalent to four quarter notes.
*
*/
double
-TempoMap::pulse_at_beat (const double& beat) const
-{
- Glib::Threads::RWLock::ReaderLock lm (lock);
- return pulse_at_beat_locked (_metrics, beat);
-}
-
-double
TempoMap::pulse_at_beat_locked (const Metrics& metrics, const double& beat) const
{
const MeterSection* prev_m = &meter_section_at_beat_locked (metrics, beat);
@@ -1789,19 +1787,14 @@ TempoMap::pulse_at_beat_locked (const Metrics& metrics, const double& beat) cons
}
/** Returns the BBT (meter-based) beat corresponding to the supplied whole-note pulse .
+ * @param metrics the list of metric sections used to calculate the beat.
* @param pulse the whole-note pulse.
+ * @return the meter-based beat at the supplied whole-note pulse.
*
* a pulse or whole note is the base musical position of a MetricSection.
* it is equivalent to four quarter notes.
*/
double
-TempoMap::beat_at_pulse (const double& pulse) const
-{
- Glib::Threads::RWLock::ReaderLock lm (lock);
- return beat_at_pulse_locked (_metrics, pulse);
-}
-
-double
TempoMap::beat_at_pulse_locked (const Metrics& metrics, const double& pulse) const
{
MeterSection* prev_m = 0;
@@ -1821,13 +1814,6 @@ TempoMap::beat_at_pulse_locked (const Metrics& metrics, const double& pulse) con
return ret;
}
-double
-TempoMap::pulse_at_frame (const framepos_t& frame) const
-{
- Glib::Threads::RWLock::ReaderLock lm (lock);
- return pulse_at_minute_locked (_metrics, minute_at_frame (frame));
-}
-
/* tempo section based */
double
TempoMap::pulse_at_minute_locked (const Metrics& metrics, const double& minute) const
@@ -1861,14 +1847,6 @@ TempoMap::pulse_at_minute_locked (const Metrics& metrics, const double& minute)
return pulses_in_section + prev_t->pulse();
}
-framepos_t
-TempoMap::frame_at_pulse (const double& pulse) const
-{
- Glib::Threads::RWLock::ReaderLock lm (lock);
-
- return frame_at_minute (minute_at_pulse_locked (_metrics, pulse));
-}
-
/* tempo section based */
double
TempoMap::minute_at_pulse_locked (const Metrics& metrics, const double& pulse) const
@@ -1900,6 +1878,7 @@ TempoMap::minute_at_pulse_locked (const Metrics& metrics, const double& pulse) c
/** Returns the BBT (meter-based) beat corresponding to the supplied BBT time.
* @param bbt The BBT time (meter-based).
+ * @return bbt The BBT beat (meter-based) at the supplied BBT time.
*
*/
double
@@ -1944,6 +1923,7 @@ TempoMap::beat_at_bbt_locked (const Metrics& metrics, const Timecode::BBT_Time&
/** Returns the BBT time corresponding to the supplied BBT (meter-based) beat.
* @param beat The BBT (meter-based) beat.
+ * @return The BBT time (meter-based) at the supplied meter-based beat.
*
*/
Timecode::BBT_Time
@@ -2005,31 +1985,24 @@ TempoMap::bbt_at_beat_locked (const Metrics& metrics, const double& b) const
return ret;
}
-/** Returns the whole-note pulse corresponding to the supplied BBT time (meter-based).
+/** Returns the quarter-note beat corresponding to the supplied BBT time (meter-based).
* @param bbt The BBT time (meter-based).
+ * @return the quarter note beat at the supplied BBT time
+ *
+ * quarter-notes ignore meter and are based on pulse (the musical unit of MetricSection).
*
- * a pulse or whole note is the basic musical position of a MetricSection.
- * it is equivalent to four quarter notes.
* while the input uses meter, the output does not.
*/
double
-TempoMap::pulse_at_bbt (const Timecode::BBT_Time& bbt)
-{
- Glib::Threads::RWLock::ReaderLock lm (lock);
-
- return pulse_at_bbt_locked (_metrics, bbt);
-}
-
-double
-TempoMap::pulse_at_bbt_rt (const Timecode::BBT_Time& bbt)
+TempoMap::quarter_note_at_bbt_rt (const Timecode::BBT_Time& bbt)
{
Glib::Threads::RWLock::ReaderLock lm (lock);
if (!lm.locked()) {
- throw std::logic_error ("TempoMap::pulse_at_bbt_rt() could not lock tempo map");
+ throw std::logic_error ("TempoMap::quarter_note_at_bbt_rt() could not lock tempo map");
}
- return pulse_at_bbt_locked (_metrics, bbt);
+ return pulse_at_bbt_locked (_metrics, bbt) * 4.0;
}
double
@@ -2062,22 +2035,17 @@ TempoMap::pulse_at_bbt_locked (const Metrics& metrics, const Timecode::BBT_Time&
return ret;
}
-/** Returns the BBT time (meter-based) corresponding to the supplied whole-note pulse.
+
+/** Returns the BBT time (meter-based) corresponding to the supplied whole-note pulse position.
+ * @param metrics The list of metric sections used to determine the result.
* @param pulse The whole-note pulse.
+ * @return The BBT time at the supplied whole-note pulse.
*
* a pulse or whole note is the basic musical position of a MetricSection.
* it is equivalent to four quarter notes.
- * while the input uses meter, the output does not.
+ * while the output uses meter, the input does not.
*/
Timecode::BBT_Time
-TempoMap::bbt_at_pulse (const double& pulse)
-{
- Glib::Threads::RWLock::ReaderLock lm (lock);
-
- return bbt_at_pulse_locked (_metrics, pulse);
-}
-
-Timecode::BBT_Time
TempoMap::bbt_at_pulse_locked (const Metrics& metrics, const double& pulse) const
{
MeterSection* prev_m = 0;
@@ -3199,14 +3167,14 @@ TempoMap::gui_change_tempo (TempoSection* ts, const Tempo& bpm)
}
void
-TempoMap::gui_dilate_tempo (TempoSection* ts, const framepos_t& frame, const framepos_t& end_frame, const double& pulse)
+TempoMap::gui_dilate_tempo (TempoSection* ts, const framepos_t& frame, const framepos_t& end_frame)
{
/*
Ts (future prev_t) Tnext
| |
| [drag^] |
|----------|----------
- e_f pulse(frame)
+ e_f qn_beats(frame)
*/
Metrics future_map;
@@ -3300,7 +3268,7 @@ TempoMap::gui_dilate_tempo (TempoSection* ts, const framepos_t& frame, const fra
double frame_ratio = 1.0;
double pulse_ratio = 1.0;
- const double pulse_pos = prev_t->frame_at_pulse (pulse);
+ const double pulse_pos = frame;
if (prev_to_prev_t) {
if (pulse_pos > prev_to_prev_t->frame() + min_dframe && (pulse_pos - fr_off) > prev_to_prev_t->frame() + min_dframe) {