Browse Source

VST: Renamed ComSmartPtr -> VSTComSmartPtr to avoid confusion with existing class in juce_core

tags/2021-05-28
ed 5 years ago
parent
commit
a1ff4eec6a
3 changed files with 63 additions and 63 deletions
  1. +6
    -6
      modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp
  2. +8
    -8
      modules/juce_audio_processors/format_types/juce_VST3Common.h
  3. +49
    -49
      modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp

+ 6
- 6
modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp View File

@@ -1015,7 +1015,7 @@ private:
friend struct Param;
//==============================================================================
ComSmartPtr<JuceAudioProcessor> audioProcessor;
VSTComSmartPtr<JuceAudioProcessor> audioProcessor;
struct MidiController
{
@@ -1685,7 +1685,7 @@ private:
//==============================================================================
ScopedJuceInitialiser_GUI libraryInitialiser;
ComSmartPtr<JuceVST3EditController> owner;
VSTComSmartPtr<JuceVST3EditController> owner;
AudioProcessor& pluginInstance;
std::unique_ptr<ContentWrapperComponent> component;
@@ -2987,9 +2987,9 @@ private:
std::atomic<int> refCount { 1 };
AudioProcessor* pluginInstance;
ComSmartPtr<Vst::IHostApplication> host;
ComSmartPtr<JuceAudioProcessor> comPluginInstance;
ComSmartPtr<JuceVST3EditController> juceVST3EditController;
VSTComSmartPtr<Vst::IHostApplication> host;
VSTComSmartPtr<JuceAudioProcessor> comPluginInstance;
VSTComSmartPtr<JuceVST3EditController> 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<int> refCount { 1 };
const PFactoryInfo factoryInfo;
ComSmartPtr<Vst::IHostApplication> host;
VSTComSmartPtr<Vst::IHostApplication> host;
//==============================================================================
struct ClassEntry


+ 8
- 8
modules/juce_audio_processors/format_types/juce_VST3Common.h View File

@@ -355,24 +355,24 @@ static AudioChannelSet getChannelSetForSpeakerArrangement (Steinberg::Vst::Speak
//==============================================================================
template <class ObjectType>
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;
}


+ 49
- 49
modules/juce_audio_processors/format_types/juce_VST3PluginFormat.cpp View File

@@ -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<ContextMenu> menu) { menu->handleResult (modalResult); }
static void menuFinished (int modalResult, VSTComSmartPtr<ContextMenu> 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<IContextMenuTarget> target;
VSTComSmartPtr<IContextMenuTarget> target;
};
Array<ItemAndTarget> 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<Message> m (new Message (attributeList));
VSTComSmartPtr<Message> 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<AttributeList> l (new AttributeList (this));
VSTComSmartPtr<AttributeList> l (new AttributeList (this));
l->addRef();
*obj = l;
return kResultOk;
@@ -541,14 +541,14 @@ private:
var value;
private:
ComSmartPtr<Vst::IAttributeList> attributeList;
VSTComSmartPtr<Vst::IAttributeList> attributeList;
String messageId;
Atomic<int> refCount;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Message)
};
Array<ComSmartPtr<Message>, CriticalSection> messageQueue;
Array<VSTComSmartPtr<Message>, CriticalSection> messageQueue;
//==============================================================================
struct AttributeList : public Vst::IAttributeList
@@ -664,7 +664,7 @@ private:
}
}
owner->messageQueue.add (ComSmartPtr<Message> (new Message (this, id, value)));
owner->messageQueue.add (VSTComSmartPtr<Message> (new Message (this, id, value)));
}
template <typename Type>
@@ -687,7 +687,7 @@ private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AttributeList)
};
ComSmartPtr<AttributeList> attributeList;
VSTComSmartPtr<AttributeList> attributeList;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (VST3HostContext)
};
@@ -731,8 +731,8 @@ struct DescriptionFactory
std::unique_ptr<PClassInfoW> infoW;
{
ComSmartPtr<IPluginFactory2> pf2;
ComSmartPtr<IPluginFactory3> pf3;
VSTComSmartPtr<IPluginFactory2> pf2;
VSTComSmartPtr<IPluginFactory3> pf3;
if (pf2.loadFrom (factory))
{
@@ -752,7 +752,7 @@ struct DescriptionFactory
PluginDescription desc;
{
ComSmartPtr<Vst::IComponent> component;
VSTComSmartPtr<Vst::IComponent> component;
if (component.loadFrom (factory, info.cid))
{
@@ -790,8 +790,8 @@ struct DescriptionFactory
virtual Result performOnDescription (PluginDescription&) = 0;
private:
ComSmartPtr<VST3HostContext> vst3HostContext;
ComSmartPtr<IPluginFactory> factory;
VSTComSmartPtr<VST3HostContext> vst3HostContext;
VSTComSmartPtr<IPluginFactory> 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<IPluginFactory> pluginFactory (DLLHandleCache::getInstance()->findOrCreateHandle (file.getFullPathName())
.getPluginFactory());
VSTComSmartPtr<IPluginFactory> pluginFactory (DLLHandleCache::getInstance()->findOrCreateHandle (file.getFullPathName())
.getPluginFactory());
if (pluginFactory != nullptr)
{
@@ -1511,7 +1511,7 @@ private:
//==============================================================================
Atomic<int> refCount { 1 };
ComSmartPtr<IPlugView> view;
VSTComSmartPtr<IPlugView> 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<Vst::IEditController>& editController)
bool fetchController (VSTComSmartPtr<Vst::IEditController>& editController)
{
if (! isComponentInitialised && ! initialise())
return false;
@@ -1618,8 +1618,8 @@ struct VST3ComponentHolder
ignoreUnused (success);
jassert (success);
ComSmartPtr<IPluginFactory2> pf2;
ComSmartPtr<IPluginFactory3> pf3;
VSTComSmartPtr<IPluginFactory2> pf2;
VSTComSmartPtr<IPluginFactory3> pf3;
std::unique_ptr<PClassInfo2> info2;
std::unique_ptr<PClassInfoW> infoW;
@@ -1683,7 +1683,7 @@ struct VST3ComponentHolder
JUCE_ASSERT_MESSAGE_THREAD
#endif
factory = ComSmartPtr<IPluginFactory> (module->getPluginFactory());
factory = VSTComSmartPtr<IPluginFactory> (module->getPluginFactory());
int classIdx;
if ((classIdx = getClassIndex (module->getName())) < 0)
@@ -1734,9 +1734,9 @@ struct VST3ComponentHolder
//==============================================================================
VST3ModuleHandle::Ptr module;
ComSmartPtr<IPluginFactory> factory;
ComSmartPtr<VST3HostContext> host;
ComSmartPtr<Vst::IComponent> component;
VSTComSmartPtr<IPluginFactory> factory;
VSTComSmartPtr<VST3HostContext> host;
VSTComSmartPtr<Vst::IComponent> component;
FUID cidOfComponent;
bool isComponentInitialised = false;
@@ -2292,7 +2292,7 @@ public:
{
if (trackInfoListener != nullptr)
{
ComSmartPtr<Vst::IAttributeList> l (new TrackPropertiesAttributeList (properties));
VSTComSmartPtr<Vst::IAttributeList> l (new TrackPropertiesAttributeList (properties));
trackInfoListener->setChannelContextInfos (l);
}
}
@@ -2427,7 +2427,7 @@ public:
if (getActiveEditor() != nullptr)
return true;
ComSmartPtr<IPlugView> view (tryCreatingView(), false);
VSTComSmartPtr<IPlugView> view (tryCreatingView(), false);
return view != nullptr;
}
@@ -2509,7 +2509,7 @@ public:
bool setStateFromPresetFile (const MemoryBlock& rawData)
{
MemoryBlock rawDataCopy (rawData);
ComSmartPtr<Steinberg::MemoryStream> memoryStream = new Steinberg::MemoryStream (rawDataCopy.getData(), (int) rawDataCopy.getSize());
VSTComSmartPtr<Steinberg::MemoryStream> 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<PClassInfoW> infoW;
// Rudimentary interfaces:
ComSmartPtr<Vst::IEditController> editController;
ComSmartPtr<Vst::IEditController2> editController2;
ComSmartPtr<Vst::IMidiMapping> midiMapping;
ComSmartPtr<Vst::IAudioProcessor> processor;
ComSmartPtr<Vst::IComponentHandler> componentHandler;
ComSmartPtr<Vst::IComponentHandler2> componentHandler2;
ComSmartPtr<Vst::IUnitInfo> unitInfo;
ComSmartPtr<Vst::IUnitData> unitData;
ComSmartPtr<Vst::IProgramListData> programListData;
ComSmartPtr<Vst::IConnectionPoint> componentConnection, editControllerConnection;
ComSmartPtr<Vst::ChannelContext::IInfoListener> trackInfoListener;
VSTComSmartPtr<Vst::IEditController> editController;
VSTComSmartPtr<Vst::IEditController2> editController2;
VSTComSmartPtr<Vst::IMidiMapping> midiMapping;
VSTComSmartPtr<Vst::IAudioProcessor> processor;
VSTComSmartPtr<Vst::IComponentHandler> componentHandler;
VSTComSmartPtr<Vst::IComponentHandler2> componentHandler2;
VSTComSmartPtr<Vst::IUnitInfo> unitInfo;
VSTComSmartPtr<Vst::IUnitData> unitData;
VSTComSmartPtr<Vst::IProgramListData> programListData;
VSTComSmartPtr<Vst::IConnectionPoint> componentConnection, editControllerConnection;
VSTComSmartPtr<Vst::ChannelContext::IInfoListener> 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 <typename Type>
static void appendStateFrom (XmlElement& head, ComSmartPtr<Type>& object, const String& identifier)
static void appendStateFrom (XmlElement& head, VSTComSmartPtr<Type>& object, const String& identifier)
{
if (object != nullptr)
{
@@ -2715,7 +2715,7 @@ private:
}
}
static ComSmartPtr<Steinberg::MemoryStream> createMemoryStreamForState (XmlElement& head, StringRef identifier)
static VSTComSmartPtr<Steinberg::MemoryStream> createMemoryStreamForState (XmlElement& head, StringRef identifier)
{
if (auto* state = head.getChildByName (identifier))
{
@@ -2723,7 +2723,7 @@ private:
if (mem.fromBase64Encoding (state->getAllSubText()))
{
ComSmartPtr<Steinberg::MemoryStream> stream (new Steinberg::MemoryStream(), false);
VSTComSmartPtr<Steinberg::MemoryStream> 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<ParamValueQueueList> inputParameterChanges, outputParameterChanges;
ComSmartPtr<MidiEventList> midiInputs, midiOutputs;
VSTComSmartPtr<ParamValueQueueList> inputParameterChanges, outputParameterChanges;
VSTComSmartPtr<MidiEventList> 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<Vst::IComponent>& component)
static AudioProcessor::BusesProperties getBusProperties (VSTComSmartPtr<Vst::IComponent>& component)
{
AudioProcessor::BusesProperties busProperties;
ComSmartPtr<Vst::IAudioProcessor> processor;
VSTComSmartPtr<Vst::IAudioProcessor> 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<ContextMenu> (this)));
topLevelMenu->showMenuAsync (options, ModalCallbackFunction::create (menuFinished, VSTComSmartPtr<ContextMenu> (this)));
#endif
return kResultOk;
@@ -3314,12 +3314,12 @@ void VST3PluginFormat::findAllTypesForFile (OwnedArray<PluginDescription>& resul
for every housed plugin.
*/
ComSmartPtr<IPluginFactory> pluginFactory (DLLHandleCache::getInstance()->findOrCreateHandle (fileOrIdentifier)
.getPluginFactory());
VSTComSmartPtr<IPluginFactory> pluginFactory (DLLHandleCache::getInstance()->findOrCreateHandle (fileOrIdentifier)
.getPluginFactory());
if (pluginFactory != nullptr)
{
ComSmartPtr<VST3HostContext> host (new VST3HostContext());
VSTComSmartPtr<VST3HostContext> host (new VST3HostContext());
DescriptionLister lister (host, pluginFactory);
lister.findDescriptionsAndPerform (File (fileOrIdentifier));


Loading…
Cancel
Save