diff options
author | nick_m <mainsbridge@gmail.com> | 2015-12-20 04:41:45 +1100 |
---|---|---|
committer | nick_m <mainsbridge@gmail.com> | 2016-05-27 23:38:09 +1000 |
commit | 7fc3b0c34c552d7be862897bd0aaa542453e9973 (patch) | |
tree | 35898328a86aefec5ac18a00c56c8577f4779d1f /libs/ardour/session_vst.cc | |
parent | 94187e66a2ae2bc2ab082ef614c25b35ec0d5e24 (diff) |
Initial stab at tempo ramps.
Replaces the list of points in TempoMap with TempoSection functions, which
compute tempo-at or tick-at time relative to tempo section start.
TempoMap consults them additively to determine things like bbt_time(),
frame_time() get_grid() etc.
This has a marked effect on scrolling speed along with the code simplification
in the places it has been attempted.
Several things are broken here.
Currently every ramp except the last one is an exponential ramp. this may
be simple to fix :).
Mouse-over midi grid doesn't match mouse click grid. should also be simple.
Many things seem to work, but their accuracy should be in question until
each area has been addressed.
Diffstat (limited to 'libs/ardour/session_vst.cc')
-rw-r--r-- | libs/ardour/session_vst.cc | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/libs/ardour/session_vst.cc b/libs/ardour/session_vst.cc index 21875ece46..34df6bd52e 100644 --- a/libs/ardour/session_vst.cc +++ b/libs/ardour/session_vst.cc @@ -223,9 +223,29 @@ intptr_t Session::vst_callback ( Timecode::BBT_Time bbt; try { - session->tempo_map().bbt_time_rt (now, bbt); - double ppqBar; - double ppqPos = vst_ppq (tm, bbt, ppqBar); + session->tempo_map().bbt_time (now, bbt); + + /* PPQ = pulse per quarter + * VST's "pulse" is our "division". + * + * 8 divisions per bar, 1 division = quarter, so 8 quarters per bar, ppq = 1 + * 8 divisions per bar, 1 division = eighth, so 4 quarters per bar, ppq = 2 + * 4 divisions per bar, 1 division = quarter, so 4 quarters per bar, ppq = 1 + * 4 divisions per bar, 1 division = half, so 8 quarters per bar, ppq = 0.5 + * 4 divisions per bar, 1 division = fifth, so (4 * 5/4) quarters per bar, ppq = 5/4 + * + * general: divs_per_bar / (note_type / 4.0) + */ + double ppq_scaling = tm.meter().note_divisor() / 4.0; + + /* Note that this assumes constant meter/tempo throughout the session. Stupid VST */ + double ppqBar = double(bbt.bars - 1) * tm.meter().divisions_per_bar(); + double ppqBeat = double(bbt.beats - 1); + double ppqTick = double(bbt.ticks) / Timecode::BBT_Time::ticks_per_beat; + + ppqBar *= ppq_scaling; + ppqBeat *= ppq_scaling; + ppqTick *= ppq_scaling; if (value & (kVstPpqPosValid)) { timeinfo->ppqPos = ppqPos; |