summaryrefslogtreecommitdiff
path: root/libs/ardour/session_vst.cc
diff options
context:
space:
mode:
authornick_m <mainsbridge@gmail.com>2016-05-28 00:10:53 +1000
committernick_m <mainsbridge@gmail.com>2016-05-28 00:10:53 +1000
commit78bec77c3e4deeffcb02da3e8de5b034705a6ebb (patch)
treee5a84d45fc79feb5de73708251cd4974d9d6f229 /libs/ardour/session_vst.cc
parentbf96a74e96224f620105e8ec6a87361e15055c8c (diff)
Tempo ramps - fix merge conflicts, add bbt_at_frame_rt().
Diffstat (limited to 'libs/ardour/session_vst.cc')
-rw-r--r--libs/ardour/session_vst.cc32
1 files changed, 6 insertions, 26 deletions
diff --git a/libs/ardour/session_vst.cc b/libs/ardour/session_vst.cc
index 3741ceb9a1..5bc82a1795 100644
--- a/libs/ardour/session_vst.cc
+++ b/libs/ardour/session_vst.cc
@@ -223,29 +223,10 @@ intptr_t Session::vst_callback (
Timecode::BBT_Time bbt;
try {
- bbt = session->tempo_map().bbt_at_frame (now);
-
- /* 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;
+ bbt = session->tempo_map().bbt_at_frame_rt (now);
+
+ double ppqBar;
+ double ppqPos = vst_ppq (tm, bbt, ppqBar);
if (value & (kVstPpqPosValid)) {
timeinfo->ppqPos = ppqPos;
@@ -310,10 +291,10 @@ intptr_t Session::vst_callback (
double ppqBar;
Timecode::BBT_Time bbt;
- session->tempo_map().bbt_time_rt (looploc->start (), bbt);
+ bbt = session->tempo_map ().bbt_at_frame_rt (looploc->start ());
timeinfo->cycleStartPos = vst_ppq (tm, bbt, ppqBar);
- session->tempo_map().bbt_time_rt (looploc->end (), bbt);
+ bbt = session->tempo_map ().bbt_at_frame (looploc->end ());
timeinfo->cycleEndPos = vst_ppq (tm, bbt, ppqBar);
newflags |= kVstCyclePosValid;
@@ -568,4 +549,3 @@ intptr_t Session::vst_callback (
return 0;
}
-