From a1ff4eec6a2679d60ab54959610ade04648d4536 Mon Sep 17 00:00:00 2001 From: ed Date: Wed, 27 Jan 2021 14:49:42 +0000 Subject: [PATCH] VST: Renamed ComSmartPtr -> VSTComSmartPtr to avoid confusion with existing class in juce_core --- .../VST3/juce_VST3_Wrapper.cpp | 12 +-- .../format_types/juce_VST3Common.h | 16 +-- .../format_types/juce_VST3PluginFormat.cpp | 98 +++++++++---------- 3 files changed, 63 insertions(+), 63 deletions(-) mode change 100644 => 100755 modules/juce_audio_processors/format_types/juce_VST3Common.h diff --git a/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp b/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp index 5f326a8009..fb11ebf229 100644 --- a/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp +++ b/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp @@ -1015,7 +1015,7 @@ private: friend struct Param; //============================================================================== - ComSmartPtr audioProcessor; + VSTComSmartPtr audioProcessor; struct MidiController { @@ -1685,7 +1685,7 @@ private: //============================================================================== ScopedJuceInitialiser_GUI libraryInitialiser; - ComSmartPtr owner; + VSTComSmartPtr owner; AudioProcessor& pluginInstance; std::unique_ptr component; @@ -2987,9 +2987,9 @@ private: std::atomic refCount { 1 }; AudioProcessor* pluginInstance; - ComSmartPtr host; - ComSmartPtr comPluginInstance; - ComSmartPtr juceVST3EditController; + VSTComSmartPtr host; + VSTComSmartPtr comPluginInstance; + VSTComSmartPtr juceVST3EditController; /** Since VST3 does not provide a way of knowing the buffer size and sample rate at any point, @@ -3323,7 +3323,7 @@ private: //============================================================================== std::atomic refCount { 1 }; const PFactoryInfo factoryInfo; - ComSmartPtr host; + VSTComSmartPtr host; //============================================================================== struct ClassEntry diff --git a/modules/juce_audio_processors/format_types/juce_VST3Common.h b/modules/juce_audio_processors/format_types/juce_VST3Common.h old mode 100644 new mode 100755 index 8ee6db8799..f7116eb3e9 --- a/modules/juce_audio_processors/format_types/juce_VST3Common.h +++ b/modules/juce_audio_processors/format_types/juce_VST3Common.h @@ -355,24 +355,24 @@ static AudioChannelSet getChannelSetForSpeakerArrangement (Steinberg::Vst::Speak //============================================================================== template -class ComSmartPtr +class VSTComSmartPtr { public: - ComSmartPtr() noexcept : source (nullptr) {} - ComSmartPtr (ObjectType* object, bool autoAddRef = true) noexcept : source (object) { if (source != nullptr && autoAddRef) source->addRef(); } - ComSmartPtr (const ComSmartPtr& other) noexcept : source (other.source) { if (source != nullptr) source->addRef(); } - ~ComSmartPtr() { if (source != nullptr) source->release(); } + VSTComSmartPtr() noexcept : source (nullptr) {} + VSTComSmartPtr (ObjectType* object, bool autoAddRef = true) noexcept : source (object) { if (source != nullptr && autoAddRef) source->addRef(); } + VSTComSmartPtr (const VSTComSmartPtr& other) noexcept : source (other.source) { if (source != nullptr) source->addRef(); } + ~VSTComSmartPtr() { if (source != nullptr) source->release(); } operator ObjectType*() const noexcept { return source; } ObjectType* get() const noexcept { return source; } ObjectType& operator*() const noexcept { return *source; } ObjectType* operator->() const noexcept { return source; } - ComSmartPtr& operator= (const ComSmartPtr& other) { return operator= (other.source); } + VSTComSmartPtr& operator= (const VSTComSmartPtr& other) { return operator= (other.source); } - ComSmartPtr& operator= (ObjectType* const newObjectToTakePossessionOf) + VSTComSmartPtr& operator= (ObjectType* const newObjectToTakePossessionOf) { - ComSmartPtr p (newObjectToTakePossessionOf); + VSTComSmartPtr p (newObjectToTakePossessionOf); std::swap (p.source, source); return *this; } diff --git a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp index 0b6abb609d..c13c3fd5c0 100644 --- a/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp @@ -370,7 +370,7 @@ struct VST3HostContext : public Vst::IComponentHandler, // From VST V3.0.0 tresult PLUGIN_API popup (Steinberg::UCoord x, Steinberg::UCoord y) override; #if ! JUCE_MODAL_LOOPS_PERMITTED - static void menuFinished (int modalResult, ComSmartPtr menu) { menu->handleResult (modalResult); } + static void menuFinished (int modalResult, VSTComSmartPtr menu) { menu->handleResult (modalResult); } #endif private: @@ -382,7 +382,7 @@ struct VST3HostContext : public Vst::IComponentHandler, // From VST V3.0.0 struct ItemAndTarget { Item item; - ComSmartPtr target; + VSTComSmartPtr target; }; Array items; @@ -446,7 +446,7 @@ struct VST3HostContext : public Vst::IComponentHandler, // From VST V3.0.0 if (doUIDsMatch (cid, Vst::IMessage::iid) && doUIDsMatch (iid, Vst::IMessage::iid)) { - ComSmartPtr m (new Message (attributeList)); + VSTComSmartPtr m (new Message (attributeList)); messageQueue.add (m); m->addRef(); *obj = m; @@ -454,7 +454,7 @@ struct VST3HostContext : public Vst::IComponentHandler, // From VST V3.0.0 } else if (doUIDsMatch (cid, Vst::IAttributeList::iid) && doUIDsMatch (iid, Vst::IAttributeList::iid)) { - ComSmartPtr l (new AttributeList (this)); + VSTComSmartPtr l (new AttributeList (this)); l->addRef(); *obj = l; return kResultOk; @@ -541,14 +541,14 @@ private: var value; private: - ComSmartPtr attributeList; + VSTComSmartPtr attributeList; String messageId; Atomic refCount; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Message) }; - Array, CriticalSection> messageQueue; + Array, CriticalSection> messageQueue; //============================================================================== struct AttributeList : public Vst::IAttributeList @@ -664,7 +664,7 @@ private: } } - owner->messageQueue.add (ComSmartPtr (new Message (this, id, value))); + owner->messageQueue.add (VSTComSmartPtr (new Message (this, id, value))); } template @@ -687,7 +687,7 @@ private: JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AttributeList) }; - ComSmartPtr attributeList; + VSTComSmartPtr attributeList; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (VST3HostContext) }; @@ -731,8 +731,8 @@ struct DescriptionFactory std::unique_ptr infoW; { - ComSmartPtr pf2; - ComSmartPtr pf3; + VSTComSmartPtr pf2; + VSTComSmartPtr pf3; if (pf2.loadFrom (factory)) { @@ -752,7 +752,7 @@ struct DescriptionFactory PluginDescription desc; { - ComSmartPtr component; + VSTComSmartPtr component; if (component.loadFrom (factory, info.cid)) { @@ -790,8 +790,8 @@ struct DescriptionFactory virtual Result performOnDescription (PluginDescription&) = 0; private: - ComSmartPtr vst3HostContext; - ComSmartPtr factory; + VSTComSmartPtr vst3HostContext; + VSTComSmartPtr factory; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DescriptionFactory) }; @@ -849,7 +849,7 @@ struct DLLHandle //============================================================================== /** The factory should begin with a refCount of 1, so don't increment the reference count - (ie: don't use a ComSmartPtr in here)! Its lifetime will be handled by this DLLHandle. + (ie: don't use a VSTComSmartPtr in here)! Its lifetime will be handled by this DLLHandle. */ IPluginFactory* JUCE_CALLTYPE getPluginFactory() { @@ -1102,8 +1102,8 @@ private: //============================================================================== bool open (const PluginDescription& description) { - ComSmartPtr pluginFactory (DLLHandleCache::getInstance()->findOrCreateHandle (file.getFullPathName()) - .getPluginFactory()); + VSTComSmartPtr pluginFactory (DLLHandleCache::getInstance()->findOrCreateHandle (file.getFullPathName()) + .getPluginFactory()); if (pluginFactory != nullptr) { @@ -1511,7 +1511,7 @@ private: //============================================================================== Atomic refCount { 1 }; - ComSmartPtr view; + VSTComSmartPtr view; #if JUCE_WINDOWS struct ChildComponent : public Component @@ -1569,7 +1569,7 @@ struct VST3ComponentHolder // transfers ownership to the plugin instance! AudioPluginInstance* createPluginInstance(); - bool fetchController (ComSmartPtr& editController) + bool fetchController (VSTComSmartPtr& editController) { if (! isComponentInitialised && ! initialise()) return false; @@ -1618,8 +1618,8 @@ struct VST3ComponentHolder ignoreUnused (success); jassert (success); - ComSmartPtr pf2; - ComSmartPtr pf3; + VSTComSmartPtr pf2; + VSTComSmartPtr pf3; std::unique_ptr info2; std::unique_ptr infoW; @@ -1683,7 +1683,7 @@ struct VST3ComponentHolder JUCE_ASSERT_MESSAGE_THREAD #endif - factory = ComSmartPtr (module->getPluginFactory()); + factory = VSTComSmartPtr (module->getPluginFactory()); int classIdx; if ((classIdx = getClassIndex (module->getName())) < 0) @@ -1734,9 +1734,9 @@ struct VST3ComponentHolder //============================================================================== VST3ModuleHandle::Ptr module; - ComSmartPtr factory; - ComSmartPtr host; - ComSmartPtr component; + VSTComSmartPtr factory; + VSTComSmartPtr host; + VSTComSmartPtr component; FUID cidOfComponent; bool isComponentInitialised = false; @@ -2292,7 +2292,7 @@ public: { if (trackInfoListener != nullptr) { - ComSmartPtr l (new TrackPropertiesAttributeList (properties)); + VSTComSmartPtr l (new TrackPropertiesAttributeList (properties)); trackInfoListener->setChannelContextInfos (l); } } @@ -2427,7 +2427,7 @@ public: if (getActiveEditor() != nullptr) return true; - ComSmartPtr view (tryCreatingView(), false); + VSTComSmartPtr view (tryCreatingView(), false); return view != nullptr; } @@ -2509,7 +2509,7 @@ public: bool setStateFromPresetFile (const MemoryBlock& rawData) { MemoryBlock rawDataCopy (rawData); - ComSmartPtr memoryStream = new Steinberg::MemoryStream (rawDataCopy.getData(), (int) rawDataCopy.getSize()); + VSTComSmartPtr memoryStream = new Steinberg::MemoryStream (rawDataCopy.getData(), (int) rawDataCopy.getSize()); if (memoryStream == nullptr || holder->component == nullptr) return false; @@ -2676,17 +2676,17 @@ private: std::unique_ptr infoW; // Rudimentary interfaces: - ComSmartPtr editController; - ComSmartPtr editController2; - ComSmartPtr midiMapping; - ComSmartPtr processor; - ComSmartPtr componentHandler; - ComSmartPtr componentHandler2; - ComSmartPtr unitInfo; - ComSmartPtr unitData; - ComSmartPtr programListData; - ComSmartPtr componentConnection, editControllerConnection; - ComSmartPtr trackInfoListener; + VSTComSmartPtr editController; + VSTComSmartPtr editController2; + VSTComSmartPtr midiMapping; + VSTComSmartPtr processor; + VSTComSmartPtr componentHandler; + VSTComSmartPtr componentHandler2; + VSTComSmartPtr unitInfo; + VSTComSmartPtr unitData; + VSTComSmartPtr programListData; + VSTComSmartPtr componentConnection, editControllerConnection; + VSTComSmartPtr trackInfoListener; /** The number of IO buses MUST match that of the plugin, even if there aren't enough channels to process, @@ -2701,7 +2701,7 @@ private: //============================================================================== template - static void appendStateFrom (XmlElement& head, ComSmartPtr& object, const String& identifier) + static void appendStateFrom (XmlElement& head, VSTComSmartPtr& object, const String& identifier) { if (object != nullptr) { @@ -2715,7 +2715,7 @@ private: } } - static ComSmartPtr createMemoryStreamForState (XmlElement& head, StringRef identifier) + static VSTComSmartPtr createMemoryStreamForState (XmlElement& head, StringRef identifier) { if (auto* state = head.getChildByName (identifier)) { @@ -2723,7 +2723,7 @@ private: if (mem.fromBase64Encoding (state->getAllSubText())) { - ComSmartPtr stream (new Steinberg::MemoryStream(), false); + VSTComSmartPtr stream (new Steinberg::MemoryStream(), false); stream->setSize ((TSize) mem.getSize()); mem.copyTo (stream->getData(), 0, mem.getSize()); return stream; @@ -2733,8 +2733,8 @@ private: return nullptr; } - ComSmartPtr inputParameterChanges, outputParameterChanges; - ComSmartPtr midiInputs, midiOutputs; + VSTComSmartPtr inputParameterChanges, outputParameterChanges; + VSTComSmartPtr midiInputs, midiOutputs; Vst::ProcessContext timingInfo; //< Only use this in processBlock()! bool isControllerInitialised = false, isActive = false, lastProcessBlockCallWasBypass = false; VST3Parameter* bypassParam = nullptr; @@ -2872,10 +2872,10 @@ private: setRateAndBufferSizeDetails (setup.sampleRate, (int) setup.maxSamplesPerBlock); } - static AudioProcessor::BusesProperties getBusProperties (ComSmartPtr& component) + static AudioProcessor::BusesProperties getBusProperties (VSTComSmartPtr& component) { AudioProcessor::BusesProperties busProperties; - ComSmartPtr processor; + VSTComSmartPtr processor; processor.loadFrom (component.get()); for (int dirIdx = 0; dirIdx < 2; ++dirIdx) @@ -3252,7 +3252,7 @@ tresult VST3HostContext::ContextMenu::popup (Steinberg::UCoord x, Steinberg::UCo // Unfortunately, Steinberg's docs explicitly say this should be modal.. handleResult (topLevelMenu->showMenu (options)); #else - topLevelMenu->showMenuAsync (options, ModalCallbackFunction::create (menuFinished, ComSmartPtr (this))); + topLevelMenu->showMenuAsync (options, ModalCallbackFunction::create (menuFinished, VSTComSmartPtr (this))); #endif return kResultOk; @@ -3314,12 +3314,12 @@ void VST3PluginFormat::findAllTypesForFile (OwnedArray& resul for every housed plugin. */ - ComSmartPtr pluginFactory (DLLHandleCache::getInstance()->findOrCreateHandle (fileOrIdentifier) - .getPluginFactory()); + VSTComSmartPtr pluginFactory (DLLHandleCache::getInstance()->findOrCreateHandle (fileOrIdentifier) + .getPluginFactory()); if (pluginFactory != nullptr) { - ComSmartPtr host (new VST3HostContext()); + VSTComSmartPtr host (new VST3HostContext()); DescriptionLister lister (host, pluginFactory); lister.findDescriptionsAndPerform (File (fileOrIdentifier));