1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Changes to make sure the AudioProcessor::wrapperType member is set correctly when its constructor is called.

This commit is contained in:
jules 2012-12-06 15:18:02 +00:00
parent 9cb14fb966
commit 39eae806de
10 changed files with 45 additions and 63 deletions

View file

@ -54,12 +54,6 @@
using juce::Component;
//==============================================================================
/** Somewhere in the codebase of your plugin, you need to implement this function
and make it return a new instance of the filter subclass that you're building.
*/
extern AudioProcessor* JUCE_CALLTYPE createPluginFilter();
//==============================================================================
struct AAXClasses
{
@ -362,10 +356,7 @@ struct AAXClasses
public:
JuceAAX_Parameters()
{
pluginInstance = createPluginFilter();
jassert (pluginInstance != nullptr); // your createPluginFilter() method must return an object!
pluginInstance->wrapperType = AudioProcessor::wrapperType_AAX;
pluginInstance = createPluginFilterOfType (AudioProcessor::wrapperType_AAX);
}
static AAX_CEffectParameters* AAX_CALLBACK Create() { return new JuceAAX_Parameters(); }

View file

@ -108,12 +108,6 @@ static const int numChannelConfigs = sizeof (channelConfigs) / sizeof (*channelC
#define JUCE_STATE_DICTIONARY_KEY CFSTR("jucePluginState")
#endif
//==============================================================================
/** Somewhere in the codebase of your plugin, you need to implement this function
and make it create an instance of the filter subclass that you're building.
*/
extern AudioProcessor* JUCE_CALLTYPE createPluginFilter();
//==============================================================================
class JuceAU : public JuceAUBaseClass,
public AudioProcessorListener,
@ -140,10 +134,7 @@ public:
initialiseJuce_GUI();
}
juceFilter = createPluginFilter();
jassert (juceFilter != nullptr); // your createPluginFilter() method must return an object!
juceFilter->wrapperType = AudioProcessor::wrapperType_AudioUnit;
juceFilter = createPluginFilterOfType (AudioProcessor::wrapperType_AudioUnit);
juceFilter->setPlayHead (this);
juceFilter->addListener (this);

View file

@ -133,15 +133,8 @@ const int midiBufferSize = 1024;
const OSType juceChunkType = 'juce';
static const int bypassControlIndex = 1;
//==============================================================================
/** Somewhere in the codebase of your plugin, you need to implement this function
and make it return a new instance of the filter subclass that you're building.
*/
extern AudioProcessor* JUCE_CALLTYPE createPluginFilter();
static int numInstances = 0;
//==============================================================================
class JucePlugInProcess : public CEffectProcessMIDI,
public CEffectProcessRTAS,
@ -155,10 +148,7 @@ public:
sampleRate (44100.0)
{
asyncUpdater = new InternalAsyncUpdater (*this);
juceFilter = createPluginFilter();
jassert (juceFilter != nullptr); // your createPluginFilter() method must return an object!
juceFilter->wrapperType = AudioProcessor::wrapperType_RTAS;
juceFilter = createPluginFilterOfType (AudioProcessor::wrapperType_RTAS);
AddChunk (juceChunkType, "Juce Audio Plugin Data");

View file

@ -26,13 +26,7 @@
#ifndef __JUCE_STANDALONEFILTERWINDOW_JUCEHEADER__
#define __JUCE_STANDALONEFILTERWINDOW_JUCEHEADER__
//==============================================================================
/** Somewhere in the codebase of your plugin, you need to implement this function
and make it create an instance of the filter subclass that you're building.
*/
extern AudioProcessor* JUCE_CALLTYPE createPluginFilter();
extern AudioProcessor* JUCE_CALLTYPE createPluginFilterOfType (AudioProcessor::WrapperType);
//==============================================================================
/**
@ -67,7 +61,7 @@ public:
JUCE_TRY
{
filter = createPluginFilter();
filter = createPluginFilterOfType (AudioProcessor::wrapperType_Standalone);
}
JUCE_CATCH_ALL
@ -77,8 +71,6 @@ public:
JUCEApplication::quit();
}
filter->wrapperType = AudioProcessor::wrapperType_Standalone;
filter->setPlayConfigDetails (JucePlugin_MaxNumInputChannels,
JucePlugin_MaxNumOutputChannels,
44100, 512);
@ -163,7 +155,7 @@ public:
{
deleteFilter();
filter = createPluginFilter();
filter = createPluginFilterOfType (AudioProcessor::wrapperType_Standalone);
if (filter != nullptr)
{

View file

@ -1450,13 +1450,6 @@ private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (JuceVSTWrapper)
};
//==============================================================================
/** Somewhere in the codebase of your plugin, you need to implement this function
and make it create an instance of the filter subclass that you're building.
*/
extern AudioProcessor* JUCE_CALLTYPE createPluginFilter();
//==============================================================================
namespace
{
@ -1473,17 +1466,9 @@ namespace
MessageManagerLock mmLock;
#endif
if (AudioProcessor* const filter = createPluginFilter())
{
filter->wrapperType = AudioProcessor::wrapperType_VST;
JuceVSTWrapper* const wrapper = new JuceVSTWrapper (audioMaster, filter);
return wrapper->getAeffect();
}
else
{
jassertfalse; // your createPluginFilter() method must return an object!
}
AudioProcessor* const filter = createPluginFilterOfType (AudioProcessor::wrapperType_VST);
JuceVSTWrapper* const wrapper = new JuceVSTWrapper (audioMaster, filter);
return wrapper->getAeffect();
}
}
catch (...)

View file

@ -31,3 +31,5 @@ using namespace juce;
#define Point juce::Point
#define Component juce::Component
#endif
extern AudioProcessor* JUCE_CALLTYPE createPluginFilterOfType (AudioProcessor::WrapperType);

View file

@ -24,7 +24,8 @@
*/
#if _MSC_VER
#include <windows.h>
#include <windows.h>
#endif
// Your project must contain an AppConfig.h file with your project-specific settings in it,
// and your header search path must make it accessible to the module's files.
@ -33,6 +34,8 @@
#include "../utility/juce_CheckSettingMacros.h"
#include "juce_IncludeModuleHeaders.h"
#if _MSC_VER
#if JucePlugin_Build_RTAS
extern "C" BOOL WINAPI DllMainRTAS (HINSTANCE, DWORD, LPVOID);
#endif
@ -57,3 +60,21 @@ extern "C" BOOL WINAPI DllMain (HINSTANCE instance, DWORD reason, LPVOID reserve
}
#endif
//==============================================================================
/** Somewhere in the codebase of your plugin, you need to implement this function
and make it return a new instance of the filter subclass that you're building.
*/
extern AudioProcessor* JUCE_CALLTYPE createPluginFilter();
AudioProcessor* JUCE_CALLTYPE createPluginFilterOfType (AudioProcessor::WrapperType type)
{
AudioProcessor::setTypeOfNextNewPlugin (type);
AudioProcessor* const pluginInstance = createPluginFilter();
AudioProcessor::setTypeOfNextNewPlugin (AudioProcessor::wrapperType_Undefined);
// your createPluginFilter() method must return an object!
jassert (pluginInstance != nullptr && pluginInstance->wrapperType == type);
return pluginInstance;
}

View file

@ -1573,7 +1573,7 @@ bool AudioUnitPluginFormat::fileMightContainThisPluginType (const String& fileOr
if (AudioUnitFormatHelpers::getComponentDescFromIdentifier (fileOrIdentifier, desc, name, version, manufacturer))
return FindNextComponent (0, &desc) != 0;
const File f (fileOrIdentifier);
const File f (File::createFileWithoutCheckingPath (fileOrIdentifier));
return f.hasFileExtension (".component")
&& f.isDirectory();

View file

@ -23,8 +23,15 @@
==============================================================================
*/
static ThreadLocalValue<AudioProcessor::WrapperType> wrapperTypeBeingCreated;
void AudioProcessor::setTypeOfNextNewPlugin (AudioProcessor::WrapperType type)
{
wrapperTypeBeingCreated = type;
}
AudioProcessor::AudioProcessor()
: wrapperType (wrapperType_Undefined),
: wrapperType (wrapperTypeBeingCreated.get()),
playHead (nullptr),
sampleRate (0),
blockSize (0),

View file

@ -592,6 +592,9 @@ public:
*/
WrapperType wrapperType;
/** @internal */
static void setTypeOfNextNewPlugin (WrapperType);
protected:
//==============================================================================
/** Helper function that just converts an xml element into a binary blob.