Browse Source

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

tags/2021-05-28
jules 12 years ago
parent
commit
39eae806de
10 changed files with 45 additions and 63 deletions
  1. +1
    -10
      modules/juce_audio_plugin_client/AAX/juce_AAX_Wrapper.cpp
  2. +1
    -10
      modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm
  3. +1
    -11
      modules/juce_audio_plugin_client/RTAS/juce_RTAS_Wrapper.cpp
  4. +3
    -11
      modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h
  5. +3
    -18
      modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp
  6. +2
    -0
      modules/juce_audio_plugin_client/utility/juce_IncludeModuleHeaders.h
  7. +22
    -1
      modules/juce_audio_plugin_client/utility/juce_PluginUtilities.cpp
  8. +1
    -1
      modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm
  9. +8
    -1
      modules/juce_audio_processors/processors/juce_AudioProcessor.cpp
  10. +3
    -0
      modules/juce_audio_processors/processors/juce_AudioProcessor.h

+ 1
- 10
modules/juce_audio_plugin_client/AAX/juce_AAX_Wrapper.cpp 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(); }


+ 1
- 10
modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm 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);


+ 1
- 11
modules/juce_audio_plugin_client/RTAS/juce_RTAS_Wrapper.cpp 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");


+ 3
- 11
modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterWindow.h 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)
{


+ 3
- 18
modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp 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 (...)


+ 2
- 0
modules/juce_audio_plugin_client/utility/juce_IncludeModuleHeaders.h 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);

+ 22
- 1
modules/juce_audio_plugin_client/utility/juce_PluginUtilities.cpp 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;
}

+ 1
- 1
modules/juce_audio_processors/format_types/juce_AudioUnitPluginFormat.mm 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();


+ 8
- 1
modules/juce_audio_processors/processors/juce_AudioProcessor.cpp 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),


+ 3
- 0
modules/juce_audio_processors/processors/juce_AudioProcessor.h 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.


Loading…
Cancel
Save