diff --git a/source/backend/plugin/CarlaPluginBridge.cpp b/source/backend/plugin/CarlaPluginBridge.cpp index 7e4d02fb9..a6ecdd5b9 100644 --- a/source/backend/plugin/CarlaPluginBridge.cpp +++ b/source/backend/plugin/CarlaPluginBridge.cpp @@ -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; diff --git a/source/backend/plugin/CarlaPluginVST2.cpp b/source/backend/plugin/CarlaPluginVST2.cpp index f2abf9b30..83fb996b6 100644 --- a/source/backend/plugin/CarlaPluginVST2.cpp +++ b/source/backend/plugin/CarlaPluginVST2.cpp @@ -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(pData->engine->getBufferSize()), nullptr, + static_cast(pData->engine->getSampleRate())); + + dispatcher(effSetSampleRate, 0, 0, nullptr, static_cast(pData->engine->getSampleRate())); + dispatcher(effSetBlockSize, 0, static_cast(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(pData->engine->getBufferSize()), nullptr, + static_cast(pData->engine->getSampleRate())); + + dispatcher(effSetSampleRate, 0, 0, nullptr, static_cast(pData->engine->getSampleRate())); + dispatcher(effSetBlockSize, 0, static_cast(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(pData->engine->getBufferSize()), nullptr, static_cast(pData->engine->getSampleRate())); -#endif - dispatcher(effSetSampleRate, 0, 0, nullptr, static_cast(pData->engine->getSampleRate())); - dispatcher(effSetBlockSize, 0, static_cast(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(dispatcher(effCanDo, 0, 0, const_cast("hasCockosExtensions"), 0.0f)) == 0xbeef0000) + static const char kHasCockosExtensions[] = "hasCockosExtensions"; + + if (static_cast(dispatcher(effCanDo, 0, 0, const_cast(kHasCockosExtensions), 0.0f)) == 0xbeef0000) pData->hints |= PLUGIN_HAS_COCKOS_EXTENSIONS; // ---------------------------------------------------------------