From 8e37bc824580de6e6bfdd7f4d64d202f7fa8f24b Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 31 Aug 2019 21:43:27 +0100 Subject: [PATCH] Make loading of vst chunk conflict less with non-juce plugins Signed-off-by: falkTX --- source/backend/plugin/CarlaPluginVST2.cpp | 4 +++- .../format_types/juce_VSTPluginFormat.cpp | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/source/backend/plugin/CarlaPluginVST2.cpp b/source/backend/plugin/CarlaPluginVST2.cpp index 198d30dc5..6a0444e2a 100644 --- a/source/backend/plugin/CarlaPluginVST2.cpp +++ b/source/backend/plugin/CarlaPluginVST2.cpp @@ -2567,9 +2567,11 @@ private: const int32_t* const set = (const int32_t*)data; + if (set[1] != 0) + return false; if (! compareMagic(set[0], "CcnK")) return false; - if (! compareMagic(set[2], "FBCh")) + if (! compareMagic(set[2], "FBCh") && ! compareMagic(set[2], "FJuc")) return false; if (fxbSwap(set[3]) > 1) return false; diff --git a/source/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp b/source/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp index ff225ee2a..08f773e11 100644 --- a/source/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp +++ b/source/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp @@ -1220,7 +1220,7 @@ struct VSTPluginInstance : public AudioPluginInstance, for (int i = 0; i < fxbSwap (prog->numParams); ++i) setParameter (i, fxbSwapFloat (prog->params[i])); } - else if (compareMagic (set->fxMagic, "FBCh")) + else if (compareMagic (set->fxMagic, "FBCh") || compareMagic (set->fxMagic, "FJuc")) { // non-preset chunk auto cset = (const fxChunkSet*) data; @@ -1268,7 +1268,7 @@ struct VSTPluginInstance : public AudioPluginInstance, auto set = (fxChunkSet*) dest.getData(); set->chunkMagic = fxbName ("CcnK"); set->byteSize = 0; - set->fxMagic = fxbName ("FBCh"); + set->fxMagic = fxbName ("FJuc"); set->version = fxbSwap (fxbVersionNum); set->fxID = fxbSwap (getUID()); set->fxVersion = fxbSwap (getVersionNumber());