From c6fe937db2a3d7a349f9bb7e1d4fd64d24b2886d Mon Sep 17 00:00:00 2001 From: defiantnerd <97224712+defiantnerd@users.noreply.github.com> Date: Sun, 9 Jun 2024 16:57:44 +0200 Subject: [PATCH] fixing a few start up bugs --- src/wrapasvst3.h | 15 ++++++++++++--- src/wrapasvst3_entry.cpp | 38 +++++++++++++++++++------------------- 2 files changed, 31 insertions(+), 22 deletions(-) diff --git a/src/wrapasvst3.h b/src/wrapasvst3.h index 7447a1c2..251d9f3b 100644 --- a/src/wrapasvst3.h +++ b/src/wrapasvst3.h @@ -241,10 +241,19 @@ class ClapAsVst3 : public Steinberg::Vst::SingleComponentEffect, DEF_INTERFACE(IContextMenuTarget); } } - if (_plugin->_ext._ara) + if (::Steinberg::FUnknownPrivate::iidEqual(iid, IPlugInEntryPoint::iid)) { - DEF_INTERFACE(IPlugInEntryPoint) - DEF_INTERFACE(IPlugInEntryPoint2) + if (_plugin->_ext._ara) + { + DEF_INTERFACE(IPlugInEntryPoint) + } + } + if (::Steinberg::FUnknownPrivate::iidEqual(iid, IPlugInEntryPoint2::iid)) + { + if (_plugin->_ext._ara) + { + DEF_INTERFACE(IPlugInEntryPoint2) + } } // add any other interfaces here: diff --git a/src/wrapasvst3_entry.cpp b/src/wrapasvst3_entry.cpp index 238066f9..8f8bfdb2 100644 --- a/src/wrapasvst3_entry.cpp +++ b/src/wrapasvst3_entry.cpp @@ -132,7 +132,7 @@ IPluginFactory* GetPluginFactoryEntryPoint() // static IPtr gPluginFactory = nullptr; static Clap::Library gClapLibrary; - static std::vector gCreationContexts; + static std::vector> gCreationContexts; // if there is no ClapLibrary yet if (!gClapLibrary._pluginFactory) @@ -275,15 +275,15 @@ IPluginFactory* GetPluginFactoryEntryPoint() LOGDETAIL("plugin id: {} -> {}", clapdescr->id, x); } #endif - - gCreationContexts.push_back( - {&gClapLibrary, ctr, - PClassInfo2( - lcid, PClassInfo::kManyInstances, kVstAudioEffectClass, plugname, - 0 /* the only flag is usually Vst:kDistributable, but CLAPs aren't distributable */, - features.c_str(), pluginvendor, clapdescr->version, kVstVersionString)}); - gPluginFactory->registerClass(&gCreationContexts.back().classinfo, ClapAsVst3::createInstance, - &gCreationContexts.back()); + auto ptr = std::make_shared(); + *ptr = {&gClapLibrary, ctr, + PClassInfo2( + lcid, PClassInfo::kManyInstances, kVstAudioEffectClass, plugname, + 0 /* the only flag is usually Vst:kDistributable, but CLAPs aren't distributable */, + features.c_str(), pluginvendor, clapdescr->version, kVstVersionString)}; + gCreationContexts.push_back(ptr); + gPluginFactory->registerClass(&gCreationContexts.back()->classinfo, ClapAsVst3::createInstance, + gCreationContexts.back().get()); } if (gClapLibrary._pluginFactoryARAInfo) @@ -311,15 +311,15 @@ IPluginFactory* GetPluginFactoryEntryPoint() n.append(" (CLAP->VST3)"); #endif auto plugname = n.c_str(); // clapdescr->name; - gCreationContexts.push_back({ - - &gClapLibrary, (int)i, - PClassInfo2(lcid, PClassInfo::kManyInstances, kARAMainFactoryClass, plugname, 0, - "", /* not used in this context */ - "", /* not used in this context */ - clapdescr->version, kVstVersionString)}); - gPluginFactory->registerClass(&gCreationContexts.back().classinfo, - ClapAsVst3::createInstance, &gCreationContexts.back()); + auto ptr = std::make_shared(); + *ptr = {&gClapLibrary, (int)i, + PClassInfo2(lcid, PClassInfo::kManyInstances, kARAMainFactoryClass, plugname, 0, + "", /* not used in this context */ + "", /* not used in this context */ + clapdescr->version, kVstVersionString)}; + gCreationContexts.push_back(ptr); + gPluginFactory->registerClass(&gCreationContexts.back()->classinfo, + ClapAsVst3::createInstance, gCreationContexts.back().get()); break; }