diff options
author | nick_m <mainsbridge@gmail.com> | 2016-05-19 21:27:02 +1000 |
---|---|---|
committer | nick_m <mainsbridge@gmail.com> | 2016-05-27 23:38:16 +1000 |
commit | 820e9a43f54d9ec4c403492527e2f0a136f76569 (patch) | |
tree | 126576f1cd62500ce7708dd481b13d1352cb3640 | |
parent | cfbc42cd3afe32ba189e3760ffeb33cabcd0e5ae (diff) |
Tempo ramps - fix various sub-beat tempo line bugs.
- actual meter is taken into account now.
-rw-r--r-- | gtk2_ardour/tempo_lines.cc | 16 | ||||
-rw-r--r-- | libs/ardour/ardour/tempo.h | 2 | ||||
-rw-r--r-- | libs/ardour/tempo.cc | 2 |
3 files changed, 10 insertions, 10 deletions
diff --git a/gtk2_ardour/tempo_lines.cc b/gtk2_ardour/tempo_lines.cc index 6bc0e435c5..630e476adf 100644 --- a/gtk2_ardour/tempo_lines.cc +++ b/gtk2_ardour/tempo_lines.cc @@ -69,24 +69,24 @@ TempoLines::draw_ticks (std::vector<ARDOUR::TempoMap::BBTPoint>& grid, level = d; } } - /* draw line with alpha corresponding to coarsest level */ const uint8_t a = max(8, (int)rint(UINT_RGBA_A(base) / (0.8 * log2(level)))); const uint32_t c = UINT_RGBA_CHANGE_A(base, a); framepos_t f = 0; if (grid.begin()->c != 0.0) { - const double pulses_per_div = l * (grid.begin()->tempo.note_type() / grid.begin()->meter.note_divisor()) / (double) divisions; - const double time_at_pulse = log (((grid.begin()->c * (pulses_per_div / grid.begin()->tempo.note_type())) / - grid.begin()->tempo.pulses_per_minute()) + 1) / grid.begin()->c; - f = grid.begin()->frame + (framecnt_t) floor ((time_at_pulse * 60.0 * frame_rate) + 0.5); + const double beat_divisions = (l / ((double) divisions)) * (grid.begin()->tempo.note_type() / grid.begin()->meter.note_divisor()); + const double time_at_division = log (((grid.begin()->c * (beat_divisions)) / + grid.begin()->tempo.beats_per_minute()) + 1) / grid.begin()->c; + + f = grid.begin()->frame + (framecnt_t) floor ((time_at_division * 60.0 * frame_rate) + 0.5); } else { - const double fpb = grid.begin()->tempo.frames_per_beat (frame_rate); + const double fpb = grid.begin()->tempo.frames_per_beat (frame_rate) + * (grid.begin()->tempo.note_type() / grid.begin()->meter.note_divisor()); + f = grid.begin()->frame + (l * (fpb / (double) divisions)); } - if (f > leftmost_frame) { - lines.add (PublicEditor::instance().sample_to_pixel_unrounded (f), 1.0, c); } } diff --git a/libs/ardour/ardour/tempo.h b/libs/ardour/ardour/tempo.h index ec15993015..63f09d20be 100644 --- a/libs/ardour/ardour/tempo.h +++ b/libs/ardour/ardour/tempo.h @@ -311,7 +311,7 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible BBTPoint (const MeterSection& m, const Tempo& t, framepos_t f, uint32_t b, uint32_t e, double func_c) - : frame (f), meter (m.note_divisor(), m.divisions_per_bar()), tempo (t.beats_per_minute(), t.note_type()), c (func_c), bar (b), beat (e) {} + : frame (f), meter (m.divisions_per_bar(), m.note_divisor()), tempo (t.beats_per_minute(), t.note_type()), c (func_c), bar (b), beat (e) {} 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 07ff3166f2..bd33c8d3b7 100644 --- a/libs/ardour/tempo.cc +++ b/libs/ardour/tempo.cc @@ -1709,7 +1709,7 @@ TempoMap::beats_to_bbt_locked (const Metrics& metrics, const double& b) const { /* CALLER HOLDS READ LOCK */ MeterSection* prev_m = 0; - const double beats = (b < 0.0) ? 0.0 : b; + const double beats = max (0.0, b); for (Metrics::const_iterator i = metrics.begin(); i != metrics.end(); ++i) { MeterSection* m = 0; |