Use quarter pulses (quarter notes) for VST's ppqBar, ppqPos and cycleStart/EndPos.
This commit is contained in:
parent
b243af48c7
commit
6d0208613d
@ -206,17 +206,15 @@ intptr_t Session::vst_callback (
|
|||||||
timeinfo->samplePos = now;
|
timeinfo->samplePos = now;
|
||||||
timeinfo->sampleRate = session->frame_rate();
|
timeinfo->sampleRate = session->frame_rate();
|
||||||
|
|
||||||
const TempoMetric& tm (session->tempo_map().metric_at (now));
|
|
||||||
|
|
||||||
if (value & (kVstTempoValid)) {
|
if (value & (kVstTempoValid)) {
|
||||||
const Tempo& t (session->tempo_map().tempo_at_frame (now));
|
const Tempo& t (session->tempo_map().tempo_at_frame (now));
|
||||||
timeinfo->tempo = t.beats_per_minute ();
|
timeinfo->tempo = t.beats_per_minute ();
|
||||||
newflags |= (kVstTempoValid);
|
newflags |= (kVstTempoValid);
|
||||||
}
|
}
|
||||||
if (value & (kVstTimeSigValid)) {
|
if (value & (kVstTimeSigValid)) {
|
||||||
const Meter& m (tm.meter());
|
const MeterSection& ms (session->tempo_map().meter_section_at_frame (now));
|
||||||
timeinfo->timeSigNumerator = m.divisions_per_bar ();
|
timeinfo->timeSigNumerator = ms.divisions_per_bar ();
|
||||||
timeinfo->timeSigDenominator = m.note_divisor ();
|
timeinfo->timeSigDenominator = ms.note_divisor ();
|
||||||
newflags |= (kVstTimeSigValid);
|
newflags |= (kVstTimeSigValid);
|
||||||
}
|
}
|
||||||
if ((value & (kVstPpqPosValid)) || (value & (kVstBarsValid))) {
|
if ((value & (kVstPpqPosValid)) || (value & (kVstBarsValid))) {
|
||||||
@ -224,10 +222,12 @@ intptr_t Session::vst_callback (
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
bbt = session->tempo_map().bbt_at_frame_rt (now);
|
bbt = session->tempo_map().bbt_at_frame_rt (now);
|
||||||
|
bbt.beats = 1;
|
||||||
double ppqBar;
|
bbt.ticks = 0;
|
||||||
double ppqPos = vst_ppq (tm, bbt, ppqBar);
|
/* exact quarter note */
|
||||||
|
double ppqBar = session->tempo_map().pulse_at_bbt_rt (bbt) * 4.0;
|
||||||
|
/* quarter note at frame position (not rounded to note subdivision) */
|
||||||
|
double ppqPos = session->tempo_map().quarter_note_at_frame_rt (now);
|
||||||
if (value & (kVstPpqPosValid)) {
|
if (value & (kVstPpqPosValid)) {
|
||||||
timeinfo->ppqPos = ppqPos;
|
timeinfo->ppqPos = ppqPos;
|
||||||
newflags |= kVstPpqPosValid;
|
newflags |= kVstPpqPosValid;
|
||||||
@ -288,14 +288,8 @@ intptr_t Session::vst_callback (
|
|||||||
newflags |= kVstTransportCycleActive;
|
newflags |= kVstTransportCycleActive;
|
||||||
Location * looploc = session->locations ()->auto_loop_location ();
|
Location * looploc = session->locations ()->auto_loop_location ();
|
||||||
if (looploc) try {
|
if (looploc) try {
|
||||||
double ppqBar;
|
timeinfo->cycleStartPos = session->tempo_map ().quarter_note_at_frame_rt (looploc->start ());
|
||||||
Timecode::BBT_Time bbt;
|
timeinfo->cycleEndPos = session->tempo_map ().quarter_note_at_frame_rt (looploc->end ());
|
||||||
|
|
||||||
bbt = session->tempo_map ().bbt_at_frame_rt (looploc->start ());
|
|
||||||
timeinfo->cycleStartPos = vst_ppq (tm, bbt, ppqBar);
|
|
||||||
|
|
||||||
bbt = session->tempo_map ().bbt_at_frame_rt (looploc->end ());
|
|
||||||
timeinfo->cycleEndPos = vst_ppq (tm, bbt, ppqBar);
|
|
||||||
|
|
||||||
newflags |= kVstCyclePosValid;
|
newflags |= kVstCyclePosValid;
|
||||||
} catch (...) { }
|
} catch (...) { }
|
||||||
|
Loading…
Reference in New Issue
Block a user