mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-28 02:30:05 +00:00
Clean-ups and small fix for plugin hosting classes.
This commit is contained in:
parent
45befc9ed2
commit
c7957d7d1e
14 changed files with 147 additions and 206 deletions
|
|
@ -8440,15 +8440,12 @@ InputStream* URL::createInputStream (const bool usePostCommand,
|
|||
const String& extraHeaders,
|
||||
const int timeOutMs) const
|
||||
{
|
||||
WebInputStream* wi = new WebInputStream (*this, usePostCommand,
|
||||
progressCallback, progressCallbackContext,
|
||||
extraHeaders,
|
||||
timeOutMs);
|
||||
ScopedPointer <WebInputStream> wi (new WebInputStream (*this, usePostCommand,
|
||||
progressCallback, progressCallbackContext,
|
||||
extraHeaders,
|
||||
timeOutMs));
|
||||
|
||||
if (wi->isError())
|
||||
deleteAndZero (wi);
|
||||
|
||||
return wi;
|
||||
return wi->isError() ? 0 : wi.release();
|
||||
}
|
||||
|
||||
bool URL::readEntireBinaryStream (MemoryBlock& destData,
|
||||
|
|
@ -17594,13 +17591,12 @@ END_JUCE_NAMESPACE
|
|||
BEGIN_JUCE_NAMESPACE
|
||||
|
||||
ApplicationCommandTarget::ApplicationCommandTarget()
|
||||
: messageInvoker (0)
|
||||
{
|
||||
}
|
||||
|
||||
ApplicationCommandTarget::~ApplicationCommandTarget()
|
||||
{
|
||||
deleteAndZero (messageInvoker);
|
||||
messageInvoker = 0;
|
||||
}
|
||||
|
||||
bool ApplicationCommandTarget::tryToInvoke (const InvocationInfo& info, const bool async)
|
||||
|
|
@ -19584,17 +19580,15 @@ bool AiffAudioFormat::canHandleFile (const File& f)
|
|||
AudioFormatReader* AiffAudioFormat::createReaderFor (InputStream* sourceStream,
|
||||
const bool deleteStreamIfOpeningFails)
|
||||
{
|
||||
AiffAudioFormatReader* w = new AiffAudioFormatReader (sourceStream);
|
||||
ScopedPointer <AiffAudioFormatReader> w (new AiffAudioFormatReader (sourceStream));
|
||||
|
||||
if (w->sampleRate == 0)
|
||||
{
|
||||
if (! deleteStreamIfOpeningFails)
|
||||
w->input = 0;
|
||||
if (w->sampleRate != 0)
|
||||
return w.release();
|
||||
|
||||
deleteAndZero (w);
|
||||
}
|
||||
if (! deleteStreamIfOpeningFails)
|
||||
w->input = 0;
|
||||
|
||||
return w;
|
||||
return 0;
|
||||
}
|
||||
|
||||
AudioFormatWriter* AiffAudioFormat::createWriterFor (OutputStream* out,
|
||||
|
|
@ -21557,17 +21551,15 @@ bool QuickTimeAudioFormat::canDoMono()
|
|||
AudioFormatReader* QuickTimeAudioFormat::createReaderFor (InputStream* sourceStream,
|
||||
const bool deleteStreamIfOpeningFails)
|
||||
{
|
||||
QTAudioReader* r = new QTAudioReader (sourceStream, 0);
|
||||
ScopedPointer <QTAudioReader> r (new QTAudioReader (sourceStream, 0));
|
||||
|
||||
if (! r->ok)
|
||||
{
|
||||
if (! deleteStreamIfOpeningFails)
|
||||
r->input = 0;
|
||||
if (r->ok)
|
||||
return r.release();
|
||||
|
||||
deleteAndZero (r);
|
||||
}
|
||||
if (! deleteStreamIfOpeningFails)
|
||||
r->input = 0;
|
||||
|
||||
return r;
|
||||
return 0;
|
||||
}
|
||||
|
||||
AudioFormatWriter* QuickTimeAudioFormat::createWriterFor (OutputStream* /*streamToWriteTo*/,
|
||||
|
|
@ -22302,17 +22294,15 @@ bool WavAudioFormat::canDoMono()
|
|||
AudioFormatReader* WavAudioFormat::createReaderFor (InputStream* sourceStream,
|
||||
const bool deleteStreamIfOpeningFails)
|
||||
{
|
||||
WavAudioFormatReader* r = new WavAudioFormatReader (sourceStream);
|
||||
ScopedPointer <WavAudioFormatReader> r (new WavAudioFormatReader (sourceStream));
|
||||
|
||||
if (r->sampleRate == 0)
|
||||
{
|
||||
if (! deleteStreamIfOpeningFails)
|
||||
r->input = 0;
|
||||
if (r->sampleRate != 0)
|
||||
return r.release();
|
||||
|
||||
deleteAndZero (r);
|
||||
}
|
||||
if (! deleteStreamIfOpeningFails)
|
||||
r->input = 0;
|
||||
|
||||
return r;
|
||||
return 0;
|
||||
}
|
||||
|
||||
AudioFormatWriter* WavAudioFormat::createWriterFor (OutputStream* out,
|
||||
|
|
@ -30939,10 +30929,10 @@ private:
|
|||
|
||||
AudioProcessorEditor* AudioUnitPluginInstance::createEditor()
|
||||
{
|
||||
AudioProcessorEditor* w = new AudioUnitPluginWindowCocoa (*this, false);
|
||||
ScopedPointer <AudioProcessorEditor> w (new AudioUnitPluginWindowCocoa (*this, false));
|
||||
|
||||
if (! ((AudioUnitPluginWindowCocoa*) w)->isValid())
|
||||
deleteAndZero (w);
|
||||
w = 0;
|
||||
|
||||
#if JUCE_SUPPORT_CARBON
|
||||
if (w == 0)
|
||||
|
|
@ -30950,14 +30940,14 @@ AudioProcessorEditor* AudioUnitPluginInstance::createEditor()
|
|||
w = new AudioUnitPluginWindowCarbon (*this);
|
||||
|
||||
if (! ((AudioUnitPluginWindowCarbon*) w)->isValid())
|
||||
deleteAndZero (w);
|
||||
w = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (w == 0)
|
||||
w = new AudioUnitPluginWindowCocoa (*this, true); // use AUGenericView as a fallback
|
||||
|
||||
return w;
|
||||
return w.release();
|
||||
}
|
||||
|
||||
const String AudioUnitPluginInstance::getCategory() const
|
||||
|
|
@ -31252,43 +31242,37 @@ void AudioUnitPluginFormat::findAllTypesForFile (OwnedArray <PluginDescription>&
|
|||
desc.fileOrIdentifier = fileOrIdentifier;
|
||||
desc.uid = 0;
|
||||
|
||||
AudioUnitPluginInstance* instance = dynamic_cast <AudioUnitPluginInstance*> (createInstanceFromDescription (desc));
|
||||
|
||||
if (instance == 0)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
instance->fillInPluginDescription (desc);
|
||||
results.add (new PluginDescription (desc));
|
||||
ScopedPointer <AudioPluginInstance> createdInstance (createInstanceFromDescription (desc));
|
||||
AudioUnitPluginInstance* const auInstance = dynamic_cast <AudioUnitPluginInstance*> ((AudioPluginInstance*) createdInstance);
|
||||
|
||||
if (auInstance != 0)
|
||||
{
|
||||
auInstance->fillInPluginDescription (desc);
|
||||
results.add (new PluginDescription (desc));
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// crashed while loading...
|
||||
}
|
||||
|
||||
deleteAndZero (instance);
|
||||
}
|
||||
|
||||
AudioPluginInstance* AudioUnitPluginFormat::createInstanceFromDescription (const PluginDescription& desc)
|
||||
{
|
||||
AudioUnitPluginInstance* result = 0;
|
||||
|
||||
if (fileMightContainThisPluginType (desc.fileOrIdentifier))
|
||||
{
|
||||
result = new AudioUnitPluginInstance (desc.fileOrIdentifier);
|
||||
ScopedPointer <AudioUnitPluginInstance> result (new AudioUnitPluginInstance (desc.fileOrIdentifier));
|
||||
|
||||
if (result->audioUnit != 0)
|
||||
{
|
||||
result->initialise();
|
||||
}
|
||||
else
|
||||
{
|
||||
deleteAndZero (result);
|
||||
return result.release();
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
return 0;
|
||||
}
|
||||
|
||||
const StringArray AudioUnitPluginFormat::searchPathsForPlugins (const FileSearchPath& /*directoriesToSearch*/,
|
||||
|
|
@ -31846,15 +31830,15 @@ public:
|
|||
|
||||
log ("Attempting to load VST: " + file.getFullPathName());
|
||||
|
||||
ModuleHandle* m = new ModuleHandle (file);
|
||||
ScopedPointer <ModuleHandle> m (new ModuleHandle (file));
|
||||
|
||||
if (! m->open())
|
||||
deleteAndZero (m);
|
||||
m = 0;
|
||||
|
||||
--insideVSTCallback;
|
||||
_fpreset(); // (doesn't do any harm)
|
||||
|
||||
return m;
|
||||
return m.release();
|
||||
}
|
||||
|
||||
ModuleHandle (const File& file_)
|
||||
|
|
@ -34350,7 +34334,7 @@ AudioPluginInstance* VSTPluginFormat::createInstanceFromDescription (const Plugi
|
|||
|
||||
if (result->effect != 0)
|
||||
{
|
||||
result->effect->resvd2 = (VstIntPtr) (pointer_sized_int) result;
|
||||
result->effect->resvd2 = (VstIntPtr) (pointer_sized_int) (VSTPluginInstance*) result;
|
||||
result->initialise();
|
||||
}
|
||||
else
|
||||
|
|
@ -125629,17 +125613,15 @@ bool FlacAudioFormat::isCompressed()
|
|||
AudioFormatReader* FlacAudioFormat::createReaderFor (InputStream* in,
|
||||
const bool deleteStreamIfOpeningFails)
|
||||
{
|
||||
FlacReader* r = new FlacReader (in);
|
||||
ScopedPointer <FlacReader> r (new FlacReader (in));
|
||||
|
||||
if (r->sampleRate == 0)
|
||||
{
|
||||
if (! deleteStreamIfOpeningFails)
|
||||
r->input = 0;
|
||||
if (r->sampleRate != 0)
|
||||
return r.release();
|
||||
|
||||
deleteAndZero (r);
|
||||
}
|
||||
if (! deleteStreamIfOpeningFails)
|
||||
r->input = 0;
|
||||
|
||||
return r;
|
||||
return 0;
|
||||
}
|
||||
|
||||
AudioFormatWriter* FlacAudioFormat::createWriterFor (OutputStream* out,
|
||||
|
|
@ -125651,15 +125633,13 @@ AudioFormatWriter* FlacAudioFormat::createWriterFor (OutputStream* out,
|
|||
{
|
||||
if (getPossibleBitDepths().contains (bitsPerSample))
|
||||
{
|
||||
FlacWriter* w = new FlacWriter (out,
|
||||
sampleRate,
|
||||
numberOfChannels,
|
||||
bitsPerSample);
|
||||
ScopedPointer <FlacWriter> w (new FlacWriter (out,
|
||||
sampleRate,
|
||||
numberOfChannels,
|
||||
bitsPerSample));
|
||||
|
||||
if (! w->ok)
|
||||
deleteAndZero (w);
|
||||
|
||||
return w;
|
||||
if (w->ok)
|
||||
return w.release();
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
@ -184577,17 +184557,15 @@ bool OggVorbisAudioFormat::canDoMono()
|
|||
AudioFormatReader* OggVorbisAudioFormat::createReaderFor (InputStream* in,
|
||||
const bool deleteStreamIfOpeningFails)
|
||||
{
|
||||
OggReader* r = new OggReader (in);
|
||||
ScopedPointer <OggReader> r (new OggReader (in));
|
||||
|
||||
if (r->sampleRate == 0)
|
||||
{
|
||||
if (! deleteStreamIfOpeningFails)
|
||||
r->input = 0;
|
||||
if (r->sampleRate != 0)
|
||||
return r.release();
|
||||
|
||||
deleteAndZero (r);
|
||||
}
|
||||
if (! deleteStreamIfOpeningFails)
|
||||
r->input = 0;
|
||||
|
||||
return r;
|
||||
return 0;
|
||||
}
|
||||
|
||||
AudioFormatWriter* OggVorbisAudioFormat::createWriterFor (OutputStream* out,
|
||||
|
|
@ -184597,16 +184575,13 @@ AudioFormatWriter* OggVorbisAudioFormat::createWriterFor (OutputStream* out,
|
|||
const StringPairArray& /*metadataValues*/,
|
||||
int qualityOptionIndex)
|
||||
{
|
||||
OggWriter* w = new OggWriter (out,
|
||||
sampleRate,
|
||||
numChannels,
|
||||
bitsPerSample,
|
||||
qualityOptionIndex);
|
||||
ScopedPointer <OggWriter> w (new OggWriter (out,
|
||||
sampleRate,
|
||||
numChannels,
|
||||
bitsPerSample,
|
||||
qualityOptionIndex));
|
||||
|
||||
if (! w->ok)
|
||||
deleteAndZero (w);
|
||||
|
||||
return w;
|
||||
return w->ok ? w.release() : 0;
|
||||
}
|
||||
|
||||
bool OggVorbisAudioFormat::isCompressed()
|
||||
|
|
@ -264032,13 +264007,10 @@ OpenGLContext* OpenGLContext::createContextForWindow (Component* const component
|
|||
const OpenGLPixelFormat& pixelFormat,
|
||||
const OpenGLContext* const contextToShareWith)
|
||||
{
|
||||
WindowedGLContext* c = new WindowedGLContext (component, pixelFormat,
|
||||
contextToShareWith != 0 ? (NSOpenGLContext*) contextToShareWith->getRawContext() : 0);
|
||||
ScopedPointer <WindowedGLContext> c (new WindowedGLContext (component, pixelFormat,
|
||||
contextToShareWith != 0 ? (NSOpenGLContext*) contextToShareWith->getRawContext() : 0));
|
||||
|
||||
if (c->renderContext == 0)
|
||||
deleteAndZero (c);
|
||||
|
||||
return c;
|
||||
return (c->renderContext != 0) ? c.release() : 0;
|
||||
}
|
||||
|
||||
void* OpenGLComponent::getNativeWindowHandle() const
|
||||
|
|
@ -269259,13 +269231,10 @@ OpenGLContext* OpenGLContext::createContextForWindow (Component* const component
|
|||
const OpenGLPixelFormat& pixelFormat,
|
||||
const OpenGLContext* const contextToShareWith)
|
||||
{
|
||||
WindowedGLContext* c = new WindowedGLContext (component, pixelFormat,
|
||||
contextToShareWith != 0 ? (NSOpenGLContext*) contextToShareWith->getRawContext() : 0);
|
||||
ScopedPointer <WindowedGLContext> c (new WindowedGLContext (component, pixelFormat,
|
||||
contextToShareWith != 0 ? (NSOpenGLContext*) contextToShareWith->getRawContext() : 0));
|
||||
|
||||
if (c->renderContext == 0)
|
||||
deleteAndZero (c);
|
||||
|
||||
return c;
|
||||
return (c->renderContext != 0) ? c.release() : 0;
|
||||
}
|
||||
|
||||
void* OpenGLComponent::getNativeWindowHandle() const
|
||||
|
|
|
|||
|
|
@ -5037,7 +5037,7 @@ public:
|
|||
|
||||
/** Returns the object that this ScopedPointer refers to.
|
||||
*/
|
||||
inline ObjectType& operator*() const { return *object; }
|
||||
inline ObjectType& operator*() const { return *object; }
|
||||
|
||||
/** Lets you access methods and properties of the object that this ScopedPointer refers to. */
|
||||
inline ObjectType* operator->() const { return object; }
|
||||
|
|
@ -25313,7 +25313,7 @@ private:
|
|||
const CommandTargetMessageInvoker& operator= (const CommandTargetMessageInvoker&);
|
||||
};
|
||||
|
||||
CommandTargetMessageInvoker* messageInvoker;
|
||||
ScopedPointer <CommandTargetMessageInvoker> messageInvoker;
|
||||
|
||||
friend class CommandTargetMessageInvoker;
|
||||
bool tryToInvoke (const InvocationInfo& info, const bool async);
|
||||
|
|
|
|||
|
|
@ -33,13 +33,12 @@ BEGIN_JUCE_NAMESPACE
|
|||
|
||||
//==============================================================================
|
||||
ApplicationCommandTarget::ApplicationCommandTarget()
|
||||
: messageInvoker (0)
|
||||
{
|
||||
}
|
||||
|
||||
ApplicationCommandTarget::~ApplicationCommandTarget()
|
||||
{
|
||||
deleteAndZero (messageInvoker);
|
||||
messageInvoker = 0;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ private:
|
|||
const CommandTargetMessageInvoker& operator= (const CommandTargetMessageInvoker&);
|
||||
};
|
||||
|
||||
CommandTargetMessageInvoker* messageInvoker;
|
||||
ScopedPointer <CommandTargetMessageInvoker> messageInvoker;
|
||||
|
||||
friend class CommandTargetMessageInvoker;
|
||||
bool tryToInvoke (const InvocationInfo& info, const bool async);
|
||||
|
|
|
|||
|
|
@ -788,17 +788,15 @@ bool AiffAudioFormat::canHandleFile (const File& f)
|
|||
AudioFormatReader* AiffAudioFormat::createReaderFor (InputStream* sourceStream,
|
||||
const bool deleteStreamIfOpeningFails)
|
||||
{
|
||||
AiffAudioFormatReader* w = new AiffAudioFormatReader (sourceStream);
|
||||
ScopedPointer <AiffAudioFormatReader> w (new AiffAudioFormatReader (sourceStream));
|
||||
|
||||
if (w->sampleRate == 0)
|
||||
{
|
||||
if (! deleteStreamIfOpeningFails)
|
||||
w->input = 0;
|
||||
if (w->sampleRate != 0)
|
||||
return w.release();
|
||||
|
||||
deleteAndZero (w);
|
||||
}
|
||||
if (! deleteStreamIfOpeningFails)
|
||||
w->input = 0;
|
||||
|
||||
return w;
|
||||
return 0;
|
||||
}
|
||||
|
||||
AudioFormatWriter* AiffAudioFormat::createWriterFor (OutputStream* out,
|
||||
|
|
|
|||
|
|
@ -516,17 +516,15 @@ bool FlacAudioFormat::isCompressed()
|
|||
AudioFormatReader* FlacAudioFormat::createReaderFor (InputStream* in,
|
||||
const bool deleteStreamIfOpeningFails)
|
||||
{
|
||||
FlacReader* r = new FlacReader (in);
|
||||
ScopedPointer <FlacReader> r (new FlacReader (in));
|
||||
|
||||
if (r->sampleRate == 0)
|
||||
{
|
||||
if (! deleteStreamIfOpeningFails)
|
||||
r->input = 0;
|
||||
if (r->sampleRate != 0)
|
||||
return r.release();
|
||||
|
||||
deleteAndZero (r);
|
||||
}
|
||||
if (! deleteStreamIfOpeningFails)
|
||||
r->input = 0;
|
||||
|
||||
return r;
|
||||
return 0;
|
||||
}
|
||||
|
||||
AudioFormatWriter* FlacAudioFormat::createWriterFor (OutputStream* out,
|
||||
|
|
@ -538,15 +536,13 @@ AudioFormatWriter* FlacAudioFormat::createWriterFor (OutputStream* out,
|
|||
{
|
||||
if (getPossibleBitDepths().contains (bitsPerSample))
|
||||
{
|
||||
FlacWriter* w = new FlacWriter (out,
|
||||
sampleRate,
|
||||
numberOfChannels,
|
||||
bitsPerSample);
|
||||
ScopedPointer <FlacWriter> w (new FlacWriter (out,
|
||||
sampleRate,
|
||||
numberOfChannels,
|
||||
bitsPerSample));
|
||||
|
||||
if (! w->ok)
|
||||
deleteAndZero (w);
|
||||
|
||||
return w;
|
||||
if (w->ok)
|
||||
return w.release();
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -426,17 +426,15 @@ bool OggVorbisAudioFormat::canDoMono()
|
|||
AudioFormatReader* OggVorbisAudioFormat::createReaderFor (InputStream* in,
|
||||
const bool deleteStreamIfOpeningFails)
|
||||
{
|
||||
OggReader* r = new OggReader (in);
|
||||
ScopedPointer <OggReader> r (new OggReader (in));
|
||||
|
||||
if (r->sampleRate == 0)
|
||||
{
|
||||
if (! deleteStreamIfOpeningFails)
|
||||
r->input = 0;
|
||||
if (r->sampleRate != 0)
|
||||
return r.release();
|
||||
|
||||
deleteAndZero (r);
|
||||
}
|
||||
if (! deleteStreamIfOpeningFails)
|
||||
r->input = 0;
|
||||
|
||||
return r;
|
||||
return 0;
|
||||
}
|
||||
|
||||
AudioFormatWriter* OggVorbisAudioFormat::createWriterFor (OutputStream* out,
|
||||
|
|
@ -446,16 +444,13 @@ AudioFormatWriter* OggVorbisAudioFormat::createWriterFor (OutputStream* out,
|
|||
const StringPairArray& /*metadataValues*/,
|
||||
int qualityOptionIndex)
|
||||
{
|
||||
OggWriter* w = new OggWriter (out,
|
||||
sampleRate,
|
||||
numChannels,
|
||||
bitsPerSample,
|
||||
qualityOptionIndex);
|
||||
ScopedPointer <OggWriter> w (new OggWriter (out,
|
||||
sampleRate,
|
||||
numChannels,
|
||||
bitsPerSample,
|
||||
qualityOptionIndex));
|
||||
|
||||
if (! w->ok)
|
||||
deleteAndZero (w);
|
||||
|
||||
return w;
|
||||
return w->ok ? w.release() : 0;
|
||||
}
|
||||
|
||||
bool OggVorbisAudioFormat::isCompressed()
|
||||
|
|
|
|||
|
|
@ -373,17 +373,15 @@ bool QuickTimeAudioFormat::canDoMono()
|
|||
AudioFormatReader* QuickTimeAudioFormat::createReaderFor (InputStream* sourceStream,
|
||||
const bool deleteStreamIfOpeningFails)
|
||||
{
|
||||
QTAudioReader* r = new QTAudioReader (sourceStream, 0);
|
||||
ScopedPointer <QTAudioReader> r (new QTAudioReader (sourceStream, 0));
|
||||
|
||||
if (! r->ok)
|
||||
{
|
||||
if (! deleteStreamIfOpeningFails)
|
||||
r->input = 0;
|
||||
if (r->ok)
|
||||
return r.release();
|
||||
|
||||
deleteAndZero (r);
|
||||
}
|
||||
if (! deleteStreamIfOpeningFails)
|
||||
r->input = 0;
|
||||
|
||||
return r;
|
||||
return 0;
|
||||
}
|
||||
|
||||
AudioFormatWriter* QuickTimeAudioFormat::createWriterFor (OutputStream* /*streamToWriteTo*/,
|
||||
|
|
|
|||
|
|
@ -759,17 +759,15 @@ bool WavAudioFormat::canDoMono()
|
|||
AudioFormatReader* WavAudioFormat::createReaderFor (InputStream* sourceStream,
|
||||
const bool deleteStreamIfOpeningFails)
|
||||
{
|
||||
WavAudioFormatReader* r = new WavAudioFormatReader (sourceStream);
|
||||
ScopedPointer <WavAudioFormatReader> r (new WavAudioFormatReader (sourceStream));
|
||||
|
||||
if (r->sampleRate == 0)
|
||||
{
|
||||
if (! deleteStreamIfOpeningFails)
|
||||
r->input = 0;
|
||||
if (r->sampleRate != 0)
|
||||
return r.release();
|
||||
|
||||
deleteAndZero (r);
|
||||
}
|
||||
if (! deleteStreamIfOpeningFails)
|
||||
r->input = 0;
|
||||
|
||||
return r;
|
||||
return 0;
|
||||
}
|
||||
|
||||
AudioFormatWriter* WavAudioFormat::createWriterFor (OutputStream* out,
|
||||
|
|
|
|||
|
|
@ -1093,10 +1093,10 @@ private:
|
|||
//==============================================================================
|
||||
AudioProcessorEditor* AudioUnitPluginInstance::createEditor()
|
||||
{
|
||||
AudioProcessorEditor* w = new AudioUnitPluginWindowCocoa (*this, false);
|
||||
ScopedPointer <AudioProcessorEditor> w (new AudioUnitPluginWindowCocoa (*this, false));
|
||||
|
||||
if (! ((AudioUnitPluginWindowCocoa*) w)->isValid())
|
||||
deleteAndZero (w);
|
||||
w = 0;
|
||||
|
||||
#if JUCE_SUPPORT_CARBON
|
||||
if (w == 0)
|
||||
|
|
@ -1104,14 +1104,14 @@ AudioProcessorEditor* AudioUnitPluginInstance::createEditor()
|
|||
w = new AudioUnitPluginWindowCarbon (*this);
|
||||
|
||||
if (! ((AudioUnitPluginWindowCarbon*) w)->isValid())
|
||||
deleteAndZero (w);
|
||||
w = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (w == 0)
|
||||
w = new AudioUnitPluginWindowCocoa (*this, true); // use AUGenericView as a fallback
|
||||
|
||||
return w;
|
||||
return w.release();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1415,43 +1415,37 @@ void AudioUnitPluginFormat::findAllTypesForFile (OwnedArray <PluginDescription>&
|
|||
desc.fileOrIdentifier = fileOrIdentifier;
|
||||
desc.uid = 0;
|
||||
|
||||
AudioUnitPluginInstance* instance = dynamic_cast <AudioUnitPluginInstance*> (createInstanceFromDescription (desc));
|
||||
|
||||
if (instance == 0)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
instance->fillInPluginDescription (desc);
|
||||
results.add (new PluginDescription (desc));
|
||||
ScopedPointer <AudioPluginInstance> createdInstance (createInstanceFromDescription (desc));
|
||||
AudioUnitPluginInstance* const auInstance = dynamic_cast <AudioUnitPluginInstance*> ((AudioPluginInstance*) createdInstance);
|
||||
|
||||
if (auInstance != 0)
|
||||
{
|
||||
auInstance->fillInPluginDescription (desc);
|
||||
results.add (new PluginDescription (desc));
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// crashed while loading...
|
||||
}
|
||||
|
||||
deleteAndZero (instance);
|
||||
}
|
||||
|
||||
AudioPluginInstance* AudioUnitPluginFormat::createInstanceFromDescription (const PluginDescription& desc)
|
||||
{
|
||||
AudioUnitPluginInstance* result = 0;
|
||||
|
||||
if (fileMightContainThisPluginType (desc.fileOrIdentifier))
|
||||
{
|
||||
result = new AudioUnitPluginInstance (desc.fileOrIdentifier);
|
||||
ScopedPointer <AudioUnitPluginInstance> result (new AudioUnitPluginInstance (desc.fileOrIdentifier));
|
||||
|
||||
if (result->audioUnit != 0)
|
||||
{
|
||||
result->initialise();
|
||||
}
|
||||
else
|
||||
{
|
||||
deleteAndZero (result);
|
||||
return result.release();
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
return 0;
|
||||
}
|
||||
|
||||
const StringArray AudioUnitPluginFormat::searchPathsForPlugins (const FileSearchPath& /*directoriesToSearch*/,
|
||||
|
|
|
|||
|
|
@ -365,15 +365,15 @@ public:
|
|||
|
||||
log ("Attempting to load VST: " + file.getFullPathName());
|
||||
|
||||
ModuleHandle* m = new ModuleHandle (file);
|
||||
ScopedPointer <ModuleHandle> m (new ModuleHandle (file));
|
||||
|
||||
if (! m->open())
|
||||
deleteAndZero (m);
|
||||
m = 0;
|
||||
|
||||
--insideVSTCallback;
|
||||
_fpreset(); // (doesn't do any harm)
|
||||
|
||||
return m;
|
||||
return m.release();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -2915,7 +2915,7 @@ AudioPluginInstance* VSTPluginFormat::createInstanceFromDescription (const Plugi
|
|||
|
||||
if (result->effect != 0)
|
||||
{
|
||||
result->effect->resvd2 = (VstIntPtr) (pointer_sized_int) result;
|
||||
result->effect->resvd2 = (VstIntPtr) (pointer_sized_int) (VSTPluginInstance*) result;
|
||||
result->initialise();
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ public:
|
|||
|
||||
/** Returns the object that this ScopedPointer refers to.
|
||||
*/
|
||||
inline ObjectType& operator*() const { return *object; }
|
||||
inline ObjectType& operator*() const { return *object; }
|
||||
|
||||
/** Lets you access methods and properties of the object that this ScopedPointer refers to. */
|
||||
inline ObjectType* operator->() const { return object; }
|
||||
|
|
|
|||
|
|
@ -452,15 +452,12 @@ InputStream* URL::createInputStream (const bool usePostCommand,
|
|||
const String& extraHeaders,
|
||||
const int timeOutMs) const
|
||||
{
|
||||
WebInputStream* wi = new WebInputStream (*this, usePostCommand,
|
||||
progressCallback, progressCallbackContext,
|
||||
extraHeaders,
|
||||
timeOutMs);
|
||||
ScopedPointer <WebInputStream> wi (new WebInputStream (*this, usePostCommand,
|
||||
progressCallback, progressCallbackContext,
|
||||
extraHeaders,
|
||||
timeOutMs));
|
||||
|
||||
if (wi->isError())
|
||||
deleteAndZero (wi);
|
||||
|
||||
return wi;
|
||||
return wi->isError() ? 0 : wi.release();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
|
|||
|
|
@ -262,13 +262,10 @@ OpenGLContext* OpenGLContext::createContextForWindow (Component* const component
|
|||
const OpenGLPixelFormat& pixelFormat,
|
||||
const OpenGLContext* const contextToShareWith)
|
||||
{
|
||||
WindowedGLContext* c = new WindowedGLContext (component, pixelFormat,
|
||||
contextToShareWith != 0 ? (NSOpenGLContext*) contextToShareWith->getRawContext() : 0);
|
||||
ScopedPointer <WindowedGLContext> c (new WindowedGLContext (component, pixelFormat,
|
||||
contextToShareWith != 0 ? (NSOpenGLContext*) contextToShareWith->getRawContext() : 0));
|
||||
|
||||
if (c->renderContext == 0)
|
||||
deleteAndZero (c);
|
||||
|
||||
return c;
|
||||
return (c->renderContext != 0) ? c.release() : 0;
|
||||
}
|
||||
|
||||
void* OpenGLComponent::getNativeWindowHandle() const
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue