mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-05 03:50:07 +00:00
More ScopedPointer/unique_ptr compatibility work
This commit is contained in:
parent
48a5fbd333
commit
1a60fa9765
80 changed files with 404 additions and 368 deletions
|
|
@ -125,7 +125,7 @@ AudioPluginInstance* AudioPluginFormat::createInstanceFromDescription (const Plu
|
|||
createPluginInstanceAsync (desc, initialSampleRate, initialBufferSize, eventSignaler.release());
|
||||
else
|
||||
createPluginInstance (desc, initialSampleRate, initialBufferSize,
|
||||
eventSignaler, EventSignaler::staticCompletionCallback);
|
||||
eventSignaler.get(), EventSignaler::staticCompletionCallback);
|
||||
|
||||
|
||||
waitForCreation.wait();
|
||||
|
|
|
|||
|
|
@ -2223,7 +2223,7 @@ AudioProcessorEditor* AudioUnitPluginInstance::createEditor()
|
|||
ScopedPointer<AudioProcessorEditor> w (new AudioUnitPluginWindowCocoa (*this, false));
|
||||
|
||||
if (! static_cast<AudioUnitPluginWindowCocoa*> (w.get())->isValid())
|
||||
w = nullptr;
|
||||
w.reset();
|
||||
|
||||
#if JUCE_SUPPORT_CARBON
|
||||
if (w == nullptr)
|
||||
|
|
@ -2236,7 +2236,7 @@ AudioProcessorEditor* AudioUnitPluginInstance::createEditor()
|
|||
#endif
|
||||
|
||||
if (w == nullptr)
|
||||
w = new AudioUnitPluginWindowCocoa (*this, true); // use AUGenericView as a fallback
|
||||
w.reset (new AudioUnitPluginWindowCocoa (*this, true)); // use AUGenericView as a fallback
|
||||
|
||||
return w.release();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -897,14 +897,14 @@ struct DescriptionFactory
|
|||
|
||||
if (pf2.loadFrom (factory))
|
||||
{
|
||||
info2 = new PClassInfo2();
|
||||
pf2->getClassInfo2 (i, info2);
|
||||
info2.reset (new PClassInfo2());
|
||||
pf2->getClassInfo2 (i, info2.get());
|
||||
}
|
||||
|
||||
if (pf3.loadFrom (factory))
|
||||
{
|
||||
infoW = new PClassInfoW();
|
||||
pf3->getClassInfoUnicode (i, infoW);
|
||||
infoW.reset (new PClassInfoW());
|
||||
pf3->getClassInfoUnicode (i, infoW.get());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -923,7 +923,7 @@ struct DescriptionFactory
|
|||
auto numOutputs = getNumSingleDirectionChannelsFor (component, false, true);
|
||||
|
||||
createPluginDescription (desc, file, companyName, name,
|
||||
info, info2, infoW, numInputs, numOutputs);
|
||||
info, info2.get(), infoW.get(), numInputs, numOutputs);
|
||||
|
||||
component->terminate();
|
||||
}
|
||||
|
|
@ -1246,7 +1246,7 @@ private:
|
|||
//==============================================================================
|
||||
bool open (const File& f, const PluginDescription& description)
|
||||
{
|
||||
dllHandle = new DLLHandle (f.getFullPathName());
|
||||
dllHandle.reset (new DLLHandle (f.getFullPathName()));
|
||||
|
||||
ComSmartPtr<IPluginFactory> pluginFactory (dllHandle->getPluginFactory());
|
||||
|
||||
|
|
@ -1572,23 +1572,23 @@ struct VST3ComponentHolder
|
|||
|
||||
if (pf2.loadFrom (factory))
|
||||
{
|
||||
info2 = new PClassInfo2();
|
||||
pf2->getClassInfo2 (classIdx, info2);
|
||||
info2.reset (new PClassInfo2());
|
||||
pf2->getClassInfo2 (classIdx, info2.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
info2 = nullptr;
|
||||
info2.reset();
|
||||
}
|
||||
|
||||
if (pf3.loadFrom (factory))
|
||||
{
|
||||
pf3->setHostContext (host->getFUnknown());
|
||||
infoW = new PClassInfoW();
|
||||
pf3->getClassInfoUnicode (classIdx, infoW);
|
||||
infoW.reset (new PClassInfoW());
|
||||
pf3->getClassInfoUnicode (classIdx, infoW.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
infoW = nullptr;
|
||||
infoW.reset();
|
||||
}
|
||||
|
||||
Vst::BusInfo bus;
|
||||
|
|
@ -1606,7 +1606,7 @@ struct VST3ComponentHolder
|
|||
|
||||
createPluginDescription (description, module->file,
|
||||
factoryInfo.vendor, module->name,
|
||||
info, info2, infoW,
|
||||
info, info2.get(), infoW.get(),
|
||||
totalNumInputChannels,
|
||||
totalNumOutputChannels);
|
||||
|
||||
|
|
@ -2784,14 +2784,14 @@ void VST3PluginFormat::createPluginInstance (const PluginDescription& descriptio
|
|||
|
||||
if (const VST3Classes::VST3ModuleHandle::Ptr module = VST3Classes::VST3ModuleHandle::findOrCreateModule (file, description))
|
||||
{
|
||||
ScopedPointer<VST3Classes::VST3ComponentHolder> holder = new VST3Classes::VST3ComponentHolder (module);
|
||||
ScopedPointer<VST3Classes::VST3ComponentHolder> holder (new VST3Classes::VST3ComponentHolder (module));
|
||||
|
||||
if (holder->initialise())
|
||||
{
|
||||
result = new VST3Classes::VST3PluginInstance (holder.release());
|
||||
result.reset (new VST3Classes::VST3PluginInstance (holder.release()));
|
||||
|
||||
if (! result->initialise())
|
||||
result = nullptr;
|
||||
result.reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -447,7 +447,7 @@ struct ModuleHandle : public ReferenceCountedObject
|
|||
.findChildFiles (vstXmlFiles, File::findFiles, false, "*.vstxml");
|
||||
|
||||
if (vstXmlFiles.size() > 0)
|
||||
vstXml = XmlDocument::parse (vstXmlFiles.getReference(0));
|
||||
vstXml.reset (XmlDocument::parse (vstXmlFiles.getReference(0)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2077,10 +2077,16 @@ public:
|
|||
|
||||
#if JUCE_SUPPORT_CARBON
|
||||
if (! plug.usesCocoaNSView)
|
||||
addAndMakeVisible (carbonWrapper = new CarbonWrapperComponent (*this));
|
||||
{
|
||||
carbonWrapper.reset (new CarbonWrapperComponent (*this));
|
||||
addAndMakeVisible (carbonWrapper.get());
|
||||
}
|
||||
else
|
||||
#endif
|
||||
addAndMakeVisible (cocoaWrapper = new AutoResizingNSViewComponentWithParent());
|
||||
{
|
||||
cocoaWrapper.reset (new AutoResizingNSViewComponentWithParent());
|
||||
addAndMakeVisible (cocoaWrapper.get());
|
||||
}
|
||||
#endif
|
||||
|
||||
activeVSTWindows.add (this);
|
||||
|
|
@ -2096,9 +2102,9 @@ public:
|
|||
|
||||
#if JUCE_MAC
|
||||
#if JUCE_SUPPORT_CARBON
|
||||
carbonWrapper = nullptr;
|
||||
carbonWrapper.reset();
|
||||
#endif
|
||||
cocoaWrapper = nullptr;
|
||||
cocoaWrapper.reset();
|
||||
#elif JUCE_LINUX
|
||||
display = XWindowSystem::getInstance()->displayUnref();
|
||||
#endif
|
||||
|
|
@ -2791,10 +2797,10 @@ void VSTPluginFormat::createPluginInstance (const PluginDescription& desc,
|
|||
{
|
||||
shellUIDToCreate = desc.uid;
|
||||
|
||||
result = VSTPluginInstance::create (module, sampleRate, blockSize);
|
||||
result.reset (VSTPluginInstance::create (module, sampleRate, blockSize));
|
||||
|
||||
if (result != nullptr && ! result->initialiseEffect (sampleRate, blockSize))
|
||||
result = nullptr;
|
||||
result.reset();
|
||||
}
|
||||
|
||||
previousWorkingDirectory.setAsCurrentWorkingDirectory();
|
||||
|
|
@ -2954,9 +2960,13 @@ AudioPluginInstance* VSTPluginFormat::createCustomVSTFromMainCall (void* entryPo
|
|||
ModuleHandle::Ptr module = new ModuleHandle (File(), (MainCall) entryPointFunction);
|
||||
|
||||
if (module->open())
|
||||
if (ScopedPointer<VSTPluginInstance> result = VSTPluginInstance::create (module, initialSampleRate, initialBufferSize))
|
||||
{
|
||||
ScopedPointer<VSTPluginInstance> result (VSTPluginInstance::create (module, initialSampleRate, initialBufferSize));
|
||||
|
||||
if (result != nullptr)
|
||||
if (result->initialiseEffect (initialSampleRate, initialBufferSize))
|
||||
return result.release();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
|
@ -2966,7 +2976,7 @@ void VSTPluginFormat::setExtraFunctions (AudioPluginInstance* plugin, ExtraFunct
|
|||
ScopedPointer<ExtraFunctions> f (functions);
|
||||
|
||||
if (auto* vst = dynamic_cast<VSTPluginInstance*> (plugin))
|
||||
vst->extraFunctions = f;
|
||||
std::swap (vst->extraFunctions, f);
|
||||
}
|
||||
|
||||
AudioPluginInstance* VSTPluginFormat::getPluginInstanceFromVstEffectInterface (void* aEffect)
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ AudioProcessorEditor::~AudioProcessorEditor()
|
|||
// if this fails, then the wrapper hasn't called editorBeingDeleted() on the
|
||||
// filter for some reason..
|
||||
jassert (processor.getActiveEditor() != this);
|
||||
removeComponentListener (resizeListener);
|
||||
removeComponentListener (resizeListener.get());
|
||||
}
|
||||
|
||||
void AudioProcessorEditor::setControlHighlight (ParameterControlHighlightInfo) {}
|
||||
|
|
@ -77,7 +77,8 @@ void AudioProcessorEditor::initialise()
|
|||
resizable = false;
|
||||
|
||||
attachConstrainer (&defaultConstrainer);
|
||||
addComponentListener (resizeListener = new AudioProcessorEditorListener (*this));
|
||||
resizeListener.reset (new AudioProcessorEditorListener (*this));
|
||||
addComponentListener (resizeListener.get());
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -108,7 +109,8 @@ void AudioProcessorEditor::setResizable (const bool shouldBeResizable, const boo
|
|||
{
|
||||
if (shouldHaveCornerResizer)
|
||||
{
|
||||
Component::addChildComponent (resizableCorner = new ResizableCornerComponent (this, constrainer));
|
||||
resizableCorner.reset (new ResizableCornerComponent (this, constrainer));
|
||||
Component::addChildComponent (resizableCorner.get());
|
||||
resizableCorner->setAlwaysOnTop (true);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -1144,8 +1144,8 @@ void AudioProcessorGraph::clearRenderingSequence()
|
|||
|
||||
{
|
||||
const ScopedLock sl (getCallbackLock());
|
||||
renderSequenceFloat.swapWith (oldSequenceF);
|
||||
renderSequenceDouble.swapWith (oldSequenceD);
|
||||
std::swap (renderSequenceFloat, oldSequenceF);
|
||||
std::swap (renderSequenceDouble, oldSequenceD);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1187,8 +1187,8 @@ void AudioProcessorGraph::buildRenderingSequence()
|
|||
|
||||
const ScopedLock sl (getCallbackLock());
|
||||
|
||||
renderSequenceFloat.swapWith (newSequenceF);
|
||||
renderSequenceDouble.swapWith (newSequenceD);
|
||||
std::swap (renderSequenceFloat, newSequenceF);
|
||||
std::swap (renderSequenceDouble, newSequenceD);
|
||||
}
|
||||
|
||||
void AudioProcessorGraph::handleAsyncUpdate()
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ public:
|
|||
const NodeID nodeID;
|
||||
|
||||
/** The actual processor object that this node represents. */
|
||||
AudioProcessor* getProcessor() const noexcept { return processor; }
|
||||
AudioProcessor* getProcessor() const noexcept { return processor.get(); }
|
||||
|
||||
/** A set of user-definable properties that are associated with this node.
|
||||
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ bool KnownPluginList::isListingUpToDate (const String& fileOrIdentifier,
|
|||
|
||||
void KnownPluginList::setCustomScanner (CustomScanner* newScanner)
|
||||
{
|
||||
scanner = newScanner;
|
||||
scanner.reset (newScanner);
|
||||
}
|
||||
|
||||
bool KnownPluginList::scanAndAddFile (const String& fileOrIdentifier,
|
||||
|
|
@ -425,7 +425,7 @@ struct PluginTreeUtils
|
|||
{
|
||||
current->folder = lastType;
|
||||
tree.subFolders.add (current.release());
|
||||
current = new KnownPluginList::PluginTree();
|
||||
current.reset (new KnownPluginList::PluginTree());
|
||||
}
|
||||
|
||||
lastType = thisType;
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ PluginListComponent::PluginListComponent (AudioPluginFormatManager& manager, Kno
|
|||
allowAsync (allowPluginsWhichRequireAsynchronousInstantiation),
|
||||
numThreads (allowAsync ? 1 : 0)
|
||||
{
|
||||
tableModel = new TableModel (*this, listToEdit);
|
||||
tableModel.reset (new TableModel (*this, listToEdit));
|
||||
|
||||
TableHeaderComponent& header = table.getHeader();
|
||||
|
||||
|
|
@ -154,7 +154,7 @@ PluginListComponent::PluginListComponent (AudioPluginFormatManager& manager, Kno
|
|||
|
||||
table.setHeaderHeight (22);
|
||||
table.setRowHeight (20);
|
||||
table.setModel (tableModel);
|
||||
table.setModel (tableModel.get());
|
||||
table.setMultipleSelectionEnabled (true);
|
||||
addAndMakeVisible (table);
|
||||
|
||||
|
|
@ -228,8 +228,8 @@ void PluginListComponent::removeSelectedPlugins()
|
|||
void PluginListComponent::setTableModel (TableListBoxModel* model)
|
||||
{
|
||||
table.setModel (nullptr);
|
||||
tableModel = model;
|
||||
table.setModel (tableModel);
|
||||
tableModel.reset (model);
|
||||
table.setModel (tableModel.get());
|
||||
|
||||
table.getHeader().reSortTable();
|
||||
table.updateContent();
|
||||
|
|
@ -479,8 +479,8 @@ private:
|
|||
{
|
||||
pathChooserWindow.setVisible (false);
|
||||
|
||||
scanner = new PluginDirectoryScanner (owner.list, formatToScan, pathList.getPath(),
|
||||
true, owner.deadMansPedalFile, allowAsync);
|
||||
scanner.reset (new PluginDirectoryScanner (owner.list, formatToScan, pathList.getPath(),
|
||||
true, owner.deadMansPedalFile, allowAsync));
|
||||
|
||||
if (propertiesToUse != nullptr)
|
||||
{
|
||||
|
|
@ -494,7 +494,7 @@ private:
|
|||
|
||||
if (numThreads > 0)
|
||||
{
|
||||
pool = new ThreadPool (numThreads);
|
||||
pool.reset (new ThreadPool (numThreads));
|
||||
|
||||
for (int i = numThreads; --i >= 0;)
|
||||
pool->addJob (new ScanJob (*this), true);
|
||||
|
|
@ -560,9 +560,9 @@ private:
|
|||
|
||||
void PluginListComponent::scanFor (AudioPluginFormat& format)
|
||||
{
|
||||
currentScanner = new Scanner (*this, format, propertiesToUse, allowAsync, numThreads,
|
||||
dialogTitle.isNotEmpty() ? dialogTitle : TRANS("Scanning for plug-ins..."),
|
||||
dialogText.isNotEmpty() ? dialogText : TRANS("Searching for all possible plug-in files..."));
|
||||
currentScanner.reset (new Scanner (*this, format, propertiesToUse, allowAsync, numThreads,
|
||||
dialogTitle.isNotEmpty() ? dialogTitle : TRANS("Scanning for plug-ins..."),
|
||||
dialogText.isNotEmpty() ? dialogText : TRANS("Searching for all possible plug-in files...")));
|
||||
}
|
||||
|
||||
bool PluginListComponent::isScanning() const noexcept
|
||||
|
|
@ -574,8 +574,8 @@ void PluginListComponent::scanFinished (const StringArray& failedFiles)
|
|||
{
|
||||
StringArray shortNames;
|
||||
|
||||
for (int i = 0; i < failedFiles.size(); ++i)
|
||||
shortNames.add (File::createFileWithoutCheckingPath (failedFiles[i]).getFileName());
|
||||
for (auto& f : failedFiles)
|
||||
shortNames.add (File::createFileWithoutCheckingPath (f).getFileName());
|
||||
|
||||
currentScanner.reset(); // mustn't delete this before using the failed files array
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue