summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authornick_m <mainsbridge@gmail.com>2016-09-03 01:22:41 +1000
committernick_m <mainsbridge@gmail.com>2016-09-03 01:22:41 +1000
commitd50df82799665e4bbf7c9d8cf2a7c2af866f0da2 (patch)
tree8c723208fdb2dd1fb9d52f78788eed1d6e52a567 /libs
parentd7879486a05d8be7a10f7bd24e6272b567fae782 (diff)
Fix various paste errors in tempo.cc. Should fix recent regressions.
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/tempo.h4
-rw-r--r--libs/ardour/tempo.cc23
2 files changed, 16 insertions, 11 deletions
diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h
index ebc02284db..c58465e46f 100644
--- a/libs/ardour/ardour/tempo.h
+++ b/libs/ardour/ardour/tempo.h
@@ -70,7 +70,7 @@ class LIBARDOUR_API Tempo {
return (60.0 * sr) / _beats_per_minute;
}
double frames_per_pulse (framecnt_t sr) const {
- return (_note_type * 60.0 * sr) / _beats_per_minute;
+ return (4.0 * 60.0 * sr) / _beats_per_minute;
}
protected:
@@ -414,7 +414,6 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
const Meter& meter_at_frame (framepos_t) const;
- /* you probably only need to use pulses when moving tempos */
double pulse_at_beat (const double& beat) const;
double beat_at_pulse (const double& pulse) const;
@@ -498,6 +497,7 @@ private:
framepos_t frame_at_quarter_note_locked (const Metrics& metrics, const double quarter_note) const;
double quarter_note_at_frame_locked (const Metrics& metrics, const framepos_t frame) const;
double quarter_note_at_beat_locked (const Metrics& metrics, const double beat) const;
+ double beat_at_quarter_note_locked (const Metrics& metrics, const double beat) const;
const TempoSection& tempo_section_at_frame_locked (const Metrics& metrics, framepos_t frame) const;
const TempoSection& tempo_section_at_beat_locked (const Metrics& metrics, const double& beat) const;
diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc
index 9c367ea4bd..4257767458 100644
--- a/libs/ardour/tempo.cc
+++ b/libs/ardour/tempo.cc
@@ -1669,9 +1669,7 @@ TempoMap::beat_at_pulse_locked (const Metrics& metrics, const double& pulse) con
if (!(*i)->is_tempo()) {
m = static_cast<MeterSection*> (*i);
if (prev_m && m->pulse() > pulse) {
- if (((pulse - prev_m->pulse()) * prev_m->note_divisor()) + prev_m->beat() > m->beat()) {
- break;
- }
+ break;
}
prev_m = m;
}
@@ -1754,7 +1752,7 @@ TempoMap::frame_at_pulse_locked (const Metrics& metrics, const double& pulse) co
/* must be treated as constant, irrespective of _type */
double const dtime = (pulse - prev_t->pulse()) * prev_t->frames_per_pulse (_frame_rate);
- return (framecnt_t) floor (dtime) + prev_t->frame();
+ return (framepos_t) floor (dtime) + prev_t->frame();
}
double
@@ -2107,7 +2105,7 @@ TempoMap::frame_at_bbt_locked (const Metrics& metrics, const BBT_Time& bbt) cons
double
TempoMap::quarter_note_at_frame (const framepos_t frame)
{
- Glib::Threads::RWLock::ReaderLock lm (lock, Glib::Threads::TRY_LOCK);
+ Glib::Threads::RWLock::ReaderLock lm (lock);
const double ret = quarter_note_at_frame_locked (_metrics, frame);
@@ -2139,7 +2137,7 @@ TempoMap::quarter_note_at_frame_rt (const framepos_t frame)
framepos_t
TempoMap::frame_at_quarter_note (const double quarter_note)
{
- Glib::Threads::RWLock::ReaderLock lm (lock, Glib::Threads::TRY_LOCK);
+ Glib::Threads::RWLock::ReaderLock lm (lock);
const framepos_t ret = frame_at_quarter_note_locked (_metrics, quarter_note);
@@ -2157,7 +2155,7 @@ TempoMap::frame_at_quarter_note_locked (const Metrics& metrics, const double qua
double
TempoMap::quarter_note_at_beat (const double beat)
{
- Glib::Threads::RWLock::ReaderLock lm (lock, Glib::Threads::TRY_LOCK);
+ Glib::Threads::RWLock::ReaderLock lm (lock);
const double ret = quarter_note_at_beat_locked (_metrics, beat);
@@ -2175,9 +2173,16 @@ TempoMap::quarter_note_at_beat_locked (const Metrics& metrics, const double beat
double
TempoMap::beat_at_quarter_note (const double quarter_note)
{
- Glib::Threads::RWLock::ReaderLock lm (lock, Glib::Threads::TRY_LOCK);
+ Glib::Threads::RWLock::ReaderLock lm (lock);
+
+ const double ret = beat_at_quarter_note_locked (_metrics, quarter_note);
- const double ret = beat_at_pulse_locked (_metrics, quarter_note / 4.0);
+ return ret;
+}
+double
+TempoMap::beat_at_quarter_note_locked (const Metrics& metrics, const double quarter_note) const
+{
+ const double ret = beat_at_pulse_locked (metrics, quarter_note / 4.0);
return ret;
}