Browse Source

Try to get VSTs working a bit better

tags/1.9.8
falkTX 7 years ago
parent
commit
1fd8608708
2 changed files with 36 additions and 11 deletions
  1. +3
    -1
      source/backend/plugin/CarlaPluginBridge.cpp
  2. +33
    -10
      source/backend/plugin/CarlaPluginVST2.cpp

+ 3
- 1
source/backend/plugin/CarlaPluginBridge.cpp View File

@@ -1673,7 +1673,9 @@ public:
const uint32_t optionEn = fShmNonRtServerControl.readUInt();
const int64_t uniqueId = fShmNonRtServerControl.readLong();

CARLA_SAFE_ASSERT_INT2(fUniqueId == uniqueId, fUniqueId, uniqueId);
if (fUniqueId != 0) {
CARLA_SAFE_ASSERT_INT2(fUniqueId == uniqueId, fUniqueId, uniqueId);
}

pData->hints = hints | PLUGIN_IS_BRIDGE;
pData->options = optionEn;


+ 33
- 10
source/backend/plugin/CarlaPluginVST2.cpp View File

@@ -902,6 +902,8 @@ public:
{
if (newCount > 0)
setProgram(0, false, false, false);
else
dispatcher(effSetProgram, 0, 0, nullptr, 0.0f);
}
else
{
@@ -960,6 +962,15 @@ public:
{
CARLA_SAFE_ASSERT_RETURN(fEffect != nullptr,);

dispatcher(effSetProcessPrecision, 0, kVstProcessPrecision32, nullptr, 0.0f);

dispatcher(effSetBlockSizeAndSampleRate, 0,
static_cast<int32_t>(pData->engine->getBufferSize()), nullptr,
static_cast<float>(pData->engine->getSampleRate()));

dispatcher(effSetSampleRate, 0, 0, nullptr, static_cast<float>(pData->engine->getSampleRate()));
dispatcher(effSetBlockSize, 0, static_cast<int32_t>(pData->engine->getBufferSize()), nullptr, 0.0f);

try {
dispatcher(effMainsChanged, 0, 1, nullptr, 0.0f);
} catch(...) {}
@@ -1059,9 +1070,12 @@ public:

if (timeInfo.valid & EngineTimeInfo::kValidBBT)
{
double ppqBar = double(timeInfo.bbt.bar - 1) * timeInfo.bbt.beatsPerBar;
double ppqBeat = double(timeInfo.bbt.beat - 1);
double ppqTick = double(timeInfo.bbt.tick) / timeInfo.bbt.ticksPerBeat;
CARLA_SAFE_ASSERT_INT(timeInfo.bbt.bar > 0, timeInfo.bbt.bar);
CARLA_SAFE_ASSERT_INT(timeInfo.bbt.beat > 0, timeInfo.bbt.beat);

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

// PPQ Pos
fTimeInfo.ppqPos = ppqBar + ppqBeat + ppqTick;
@@ -2106,6 +2120,17 @@ public:

fEffect->ptr1 = this;

dispatcher(effIdentify, 0, 0, 0, 0);

dispatcher(effSetProcessPrecision, 0, kVstProcessPrecision32, nullptr, 0.0f);

dispatcher(effSetBlockSizeAndSampleRate, 0,
static_cast<int32_t>(pData->engine->getBufferSize()), nullptr,
static_cast<float>(pData->engine->getSampleRate()));

dispatcher(effSetSampleRate, 0, 0, nullptr, static_cast<float>(pData->engine->getSampleRate()));
dispatcher(effSetBlockSize, 0, static_cast<int32_t>(pData->engine->getBufferSize()), nullptr, 0.0f);

dispatcher(effOpen, 0, 0, nullptr, 0.0f);

// ---------------------------------------------------------------
@@ -2145,17 +2170,15 @@ public:
// ---------------------------------------------------------------
// initialize plugin (part 2)

#if ! VST_FORCE_DEPRECATED
dispatcher(effSetBlockSizeAndSampleRate, 0, static_cast<int32_t>(pData->engine->getBufferSize()), nullptr, static_cast<float>(pData->engine->getSampleRate()));
#endif
dispatcher(effSetSampleRate, 0, 0, nullptr, static_cast<float>(pData->engine->getSampleRate()));
dispatcher(effSetBlockSize, 0, static_cast<int32_t>(pData->engine->getBufferSize()), nullptr, 0.0f);
dispatcher(effSetProcessPrecision, 0, kVstProcessPrecision32, nullptr, 0.0f);
for (int i = fEffect->numInputs; --i >= 0;) dispatcher(effConnectInput, i, 1, 0, 0);
for (int i = fEffect->numOutputs; --i >= 0;) dispatcher(effConnectOutput, i, 1, 0, 0);

if (dispatcher(effGetVstVersion, 0, 0, nullptr, 0.0f) < kVstVersion)
pData->hints |= PLUGIN_USES_OLD_VSTSDK;

if (static_cast<uintptr_t>(dispatcher(effCanDo, 0, 0, const_cast<char*>("hasCockosExtensions"), 0.0f)) == 0xbeef0000)
static const char kHasCockosExtensions[] = "hasCockosExtensions";

if (static_cast<uintptr_t>(dispatcher(effCanDo, 0, 0, const_cast<char*>(kHasCockosExtensions), 0.0f)) == 0xbeef0000)
pData->hints |= PLUGIN_HAS_COCKOS_EXTENSIONS;

// ---------------------------------------------------------------


Loading…
Cancel
Save