Browse Source

Calculate VST ppqPos in a more reliable way

Fixes #795

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.1-alpha2
falkTX 5 years ago
parent
commit
abdcf7ac7f
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
1 changed files with 4 additions and 3 deletions
  1. +4
    -3
      source/backend/plugin/CarlaPluginVST2.cpp

+ 4
- 3
source/backend/plugin/CarlaPluginVST2.cpp View File

@@ -1184,11 +1184,12 @@ public:
CARLA_SAFE_ASSERT_INT(timeInfo.bbt.beat > 0, timeInfo.bbt.beat); CARLA_SAFE_ASSERT_INT(timeInfo.bbt.beat > 0, timeInfo.bbt.beat);


const double ppqBar = static_cast<double>(timeInfo.bbt.beatsPerBar) * (timeInfo.bbt.bar - 1); const double ppqBar = static_cast<double>(timeInfo.bbt.beatsPerBar) * (timeInfo.bbt.bar - 1);
const double ppqBeat = static_cast<double>(timeInfo.bbt.beat - 1);
const double ppqTick = timeInfo.bbt.tick / timeInfo.bbt.ticksPerBeat;
// const double ppqBeat = static_cast<double>(timeInfo.bbt.beat - 1);
// const double ppqTick = timeInfo.bbt.tick / timeInfo.bbt.ticksPerBeat;


// PPQ Pos // PPQ Pos
fTimeInfo.ppqPos = ppqBar + ppqBeat + ppqTick;
fTimeInfo.ppqPos = fTimeInfo.samplePos / (fTimeInfo.sampleRate * 60 / fTimeInfo.tempo);
// fTimeInfo.ppqPos = ppqBar + ppqBeat + ppqTick;
fTimeInfo.flags |= kVstPpqPosValid; fTimeInfo.flags |= kVstPpqPosValid;


// Tempo // Tempo


Loading…
Cancel
Save