diff options
author | nick_m <mainsbridge@gmail.com> | 2016-03-28 05:21:29 +1100 |
---|---|---|
committer | nick_m <mainsbridge@gmail.com> | 2016-05-27 23:38:12 +1000 |
commit | 15f8f371c3854ae5370e01e643946a25e92a397b (patch) | |
tree | 33dce18a4b5990e7fd953cd1495bc349cffef1a5 /gtk2_ardour/tempo_lines.cc | |
parent | a7df009de73ad38026ff97d9aeafb8e2aa22e627 (diff) |
Tempo rampo - tempo tick lines no longer assume constant tempo.
Diffstat (limited to 'gtk2_ardour/tempo_lines.cc')
-rw-r--r-- | gtk2_ardour/tempo_lines.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/gtk2_ardour/tempo_lines.cc b/gtk2_ardour/tempo_lines.cc index 11d1738944..ef4cba3921 100644 --- a/gtk2_ardour/tempo_lines.cc +++ b/gtk2_ardour/tempo_lines.cc @@ -74,8 +74,17 @@ TempoLines::draw_ticks (std::vector<ARDOUR::TempoMap::BBTPoint>& grid, /* 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); - const framepos_t f = grid.begin()->frame + (l * (fpb / (double)divisions)); - //const framepos_t f = frame_at_tick (last_beat_in_ticks + (l * (BBT_Time::ticks_per_beat / (double)divisions))); + 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()) / 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); + } else { + f = grid.begin()->frame + (l * (fpb / (double)divisions)); + } + if (f > leftmost_frame) { lines.add (PublicEditor::instance().sample_to_pixel_unrounded (f), 1.0, c); } |