summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authornick_m <mainsbridge@gmail.com>2017-06-09 01:44:48 +1000
committernick_m <mainsbridge@gmail.com>2017-06-09 01:44:48 +1000
commitcebefe69d9456ab57fc61128a7931baccef899bc (patch)
tree866e325ee7a0a7d8a1d89eb6aca5d547664a1366 /libs
parent2b320d51dd080909a0e305116f1396dd1356200b (diff)
Tempo lines display subdivisions correctly over a tempo change
TempoMap::get_grid() supplies a list of beat positions, leaving the lines to work out any subdivision positions. This is fine, unless a tempo section falls in between beats. Use a BeatsFramesConverter along with a quarter note position (in the BBTPointsList) to make this easier.
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/tempo.h8
-rw-r--r--libs/ardour/tempo.cc9
2 files changed, 9 insertions, 8 deletions
diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h
index 197c8c5f8f..da68f6516e 100644
--- a/libs/ardour/ardour/tempo.h
+++ b/libs/ardour/ardour/tempo.h
@@ -343,16 +343,16 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
};
struct BBTPoint {
- framepos_t frame;
Meter meter;
Tempo tempo;
- double c;
+ framepos_t frame;
uint32_t bar;
uint32_t beat;
+ double qn;
BBTPoint (const MeterSection& m, const Tempo& t, framepos_t f,
- uint32_t b, uint32_t e, double func_c)
- : frame (f), meter (m.divisions_per_bar(), m.note_divisor()), tempo (t.note_types_per_minute(), t.note_type(), t.end_note_types_per_minute()), c (func_c), bar (b), beat (e) {}
+ uint32_t b, uint32_t e, double qnote)
+ : meter (m), tempo (t), frame (f), bar (b), beat (e), qn (qnote) {}
Timecode::BBT_Time bbt() const { return Timecode::BBT_Time (bar, beat, 0); }
operator Timecode::BBT_Time() const { return bbt(); }
diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc
index e676c274f4..47d718d2f8 100644
--- a/libs/ardour/tempo.cc
+++ b/libs/ardour/tempo.cc
@@ -4162,11 +4162,11 @@ TempoMap::get_grid (vector<TempoMap::BBTPoint>& points,
if (bar_mod == 0) {
while (pos >= 0 && pos < upper) {
pos = frame_at_minute (minute_at_beat_locked (_metrics, cnt));
- const TempoSection tempo = tempo_section_at_minute_locked (_metrics, minute_at_frame (pos));
const MeterSection meter = meter_section_at_minute_locked (_metrics, minute_at_frame (pos));
const BBT_Time bbt = bbt_at_beat_locked (_metrics, cnt);
+ const double qn = pulse_at_beat_locked (_metrics, cnt) * 4.0;
- points.push_back (BBTPoint (meter, tempo_at_minute_locked (_metrics, minute_at_frame (pos)), pos, bbt.bars, bbt.beats, tempo.c()));
+ points.push_back (BBTPoint (meter, tempo_at_minute_locked (_metrics, minute_at_frame (pos)), pos, bbt.bars, bbt.beats, qn));
++cnt;
}
} else {
@@ -4181,9 +4181,10 @@ TempoMap::get_grid (vector<TempoMap::BBTPoint>& points,
while (pos >= 0 && pos < upper) {
pos = frame_at_minute (minute_at_bbt_locked (_metrics, bbt));
- const TempoSection tempo = tempo_section_at_minute_locked (_metrics, minute_at_frame (pos));
const MeterSection meter = meter_section_at_minute_locked (_metrics, minute_at_frame (pos));
- points.push_back (BBTPoint (meter, tempo_at_minute_locked (_metrics, minute_at_frame (pos)), pos, bbt.bars, bbt.beats, tempo.c()));
+ const double qn = pulse_at_bbt_locked (_metrics, bbt) * 4.0;
+
+ points.push_back (BBTPoint (meter, tempo_at_minute_locked (_metrics, minute_at_frame (pos)), pos, bbt.bars, bbt.beats, qn));
bbt.bars += bar_mod;
}
}