diff --git a/modules/juce_audio_plugin_client/AAX/juce_AAX_Wrapper.cpp b/modules/juce_audio_plugin_client/AAX/juce_AAX_Wrapper.cpp index 5391f63411..b4c1824c32 100644 --- a/modules/juce_audio_plugin_client/AAX/juce_AAX_Wrapper.cpp +++ b/modules/juce_audio_plugin_client/AAX/juce_AAX_Wrapper.cpp @@ -101,8 +101,6 @@ namespace juce const int32_t juceChunkType = 'juce'; const int maxAAXChannels = 8; -JUCE_DEFINE_WRAPPER_TYPE (wrapperType_AAX); - //============================================================================== struct AAXClasses { @@ -563,7 +561,7 @@ struct AAXClasses static AAX_CEffectParameters* AAX_CALLBACK Create() { - JUCE_DECLARE_WRAPPER_TYPE (wrapperType_AAX); + PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_AAX; return new JuceAAX_Processor(); } @@ -1549,7 +1547,7 @@ struct AAXClasses static void getPlugInDescription (AAX_IEffectDescriptor& descriptor) { - JUCE_DECLARE_WRAPPER_TYPE (wrapperType_AAX); + PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_AAX; ScopedPointer plugin = createPluginFilterOfType (AudioProcessor::wrapperType_AAX); PluginBusUtilities busUtils (*plugin, false, maxAAXChannels); diff --git a/modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm b/modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm index bb5175a1b1..bcbecafbe8 100644 --- a/modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm +++ b/modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm @@ -80,8 +80,6 @@ #include "juce_AU_Shared.h" -JUCE_DEFINE_WRAPPER_TYPE (wrapperType_AudioUnit); - //============================================================================== static Array activePlugins, activeUIs; @@ -2090,7 +2088,7 @@ private: extern "C" __attribute__((visibility("default"))) ComponentResult Name ## Suffix (ComponentParameters* params, Class* obj); \ extern "C" __attribute__((visibility("default"))) ComponentResult Name ## Suffix (ComponentParameters* params, Class* obj) \ { \ - JUCE_DECLARE_WRAPPER_TYPE (wrapperType_AudioUnit); \ + PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_AudioUnit; \ return ComponentEntryPoint::Dispatch (params, obj); \ } @@ -2104,7 +2102,7 @@ private: extern "C" __attribute__((visibility("default"))) void* Name ## Factory (const AudioComponentDescription* desc); \ extern "C" __attribute__((visibility("default"))) void* Name ## Factory (const AudioComponentDescription* desc) \ { \ - JUCE_DECLARE_WRAPPER_TYPE (wrapperType_AudioUnit); \ + PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_AudioUnit; \ return FACTORY_BASE_CLASS::Factory (desc); \ } diff --git a/modules/juce_audio_plugin_client/AU/juce_AUv3_Wrapper.mm b/modules/juce_audio_plugin_client/AU/juce_AUv3_Wrapper.mm index 31663df677..baa55f7624 100644 --- a/modules/juce_audio_plugin_client/AU/juce_AUv3_Wrapper.mm +++ b/modules/juce_audio_plugin_client/AU/juce_AUv3_Wrapper.mm @@ -72,8 +72,6 @@ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wnullability-completeness" -JUCE_DEFINE_WRAPPER_TYPE (wrapperType_AudioUnitv3); - // TODO: ask Timur: use SFINAE to automatically generate this for all NSObjects template <> struct ContainerDeletePolicy { static void destroy (NSObject* o) { [o release]; } }; template <> struct ContainerDeletePolicy { static void destroy (NSObject* o) { [o release]; } }; @@ -1183,7 +1181,7 @@ const double JuceAudioUnitv3::kDefaultSampleRate = 44100.0; JuceAudioUnitv3Base* JuceAudioUnitv3Base::create (AUAudioUnit* audioUnit, AudioComponentDescription descr, AudioComponentInstantiationOptions options, NSError** error) { - JUCE_DECLARE_WRAPPER_TYPE (wrapperType_AudioUnitv3); + PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_AudioUnitv3; return new JuceAudioUnitv3 (audioUnit, descr, options, error); } @@ -1197,7 +1195,7 @@ public: { jassert (MessageManager::getInstance()->isThisTheMessageThread()); - JUCE_DECLARE_WRAPPER_TYPE (wrapperType_AudioUnitv3); + PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_AudioUnitv3; initialiseJuce_GUI(); } diff --git a/modules/juce_audio_plugin_client/RTAS/juce_RTAS_Wrapper.cpp b/modules/juce_audio_plugin_client/RTAS/juce_RTAS_Wrapper.cpp index de39d82714..7410b864c5 100644 --- a/modules/juce_audio_plugin_client/RTAS/juce_RTAS_Wrapper.cpp +++ b/modules/juce_audio_plugin_client/RTAS/juce_RTAS_Wrapper.cpp @@ -105,8 +105,6 @@ #include "../utility/juce_IncludeModuleHeaders.h" -JUCE_DEFINE_WRAPPER_TYPE (wrapperType_RTAS); - #ifdef _MSC_VER #pragma pack (pop) @@ -958,7 +956,7 @@ private: #if JUCE_WINDOWS Process::setCurrentModuleInstanceHandle (gThisModule); #endif - JUCE_DECLARE_WRAPPER_TYPE (wrapperType_RTAS); + PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_RTAS; initialiseJuce_GUI(); return new JucePlugInProcess(); diff --git a/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterApp.cpp b/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterApp.cpp index 289224d8a9..647346ca9e 100644 --- a/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterApp.cpp +++ b/modules/juce_audio_plugin_client/Standalone/juce_StandaloneFilterApp.cpp @@ -35,8 +35,6 @@ #include #include -JUCE_DEFINE_WRAPPER_TYPE (wrapperType_Standalone); - // You can set this flag in your build if you need to specify a different // standalone JUCEApplication class for your app to use. If you don't // set it then by default we'll just create a simple one as below. @@ -55,7 +53,7 @@ class StandaloneFilterApp : public JUCEApplication public: StandaloneFilterApp() { - JUCE_DECLARE_WRAPPER_TYPE (wrapperType_Standalone); + PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_Standalone; } const String getApplicationName() override { return JucePlugin_Name; } diff --git a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp index d5060d8c7a..7d671525bc 100644 --- a/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp +++ b/modules/juce_audio_plugin_client/VST/juce_VST_Wrapper.cpp @@ -111,8 +111,6 @@ class JuceVSTWrapper; static bool recursionCheck = false; -JUCE_DEFINE_WRAPPER_TYPE (wrapperType_VST); - namespace juce { #if JUCE_MAC @@ -1994,7 +1992,7 @@ namespace JUCE_EXPORTED_FUNCTION AEffect* VSTPluginMain (audioMasterCallback audioMaster); JUCE_EXPORTED_FUNCTION AEffect* VSTPluginMain (audioMasterCallback audioMaster) { - JUCE_DECLARE_WRAPPER_TYPE (wrapperType_VST); + PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST; #if JUCE_MAC initialiseMacVST(); @@ -2006,7 +2004,7 @@ namespace JUCE_EXPORTED_FUNCTION AEffect* main_macho (audioMasterCallback audioMaster); JUCE_EXPORTED_FUNCTION AEffect* main_macho (audioMasterCallback audioMaster) { - JUCE_DECLARE_WRAPPER_TYPE (wrapperType_VST); + PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST; #if JUCE_MAC initialiseMacVST(); @@ -2022,7 +2020,7 @@ namespace JUCE_EXPORTED_FUNCTION AEffect* VSTPluginMain (audioMasterCallback audioMaster); JUCE_EXPORTED_FUNCTION AEffect* VSTPluginMain (audioMasterCallback audioMaster) { - JUCE_DECLARE_WRAPPER_TYPE (wrapperType_VST); + PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST; SharedMessageThread::getInstance(); return pluginEntryPoint (audioMaster); @@ -2031,7 +2029,7 @@ namespace JUCE_EXPORTED_FUNCTION AEffect* main_plugin (audioMasterCallback audioMaster) asm ("main"); JUCE_EXPORTED_FUNCTION AEffect* main_plugin (audioMasterCallback audioMaster) { - JUCE_DECLARE_WRAPPER_TYPE (wrapperType_VST); + PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST; return VSTPluginMain (audioMaster); } @@ -2046,7 +2044,7 @@ namespace extern "C" __declspec (dllexport) AEffect* VSTPluginMain (audioMasterCallback audioMaster) { - JUCE_DECLARE_WRAPPER_TYPE (wrapperType_VST); + PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST; return pluginEntryPoint (audioMaster); } @@ -2054,7 +2052,7 @@ namespace #ifndef JUCE_64BIT // (can't compile this on win64, but it's not needed anyway with VST2.4) extern "C" __declspec (dllexport) int main (audioMasterCallback audioMaster) { - JUCE_DECLARE_WRAPPER_TYPE (wrapperType_VST); + PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST; return (int) pluginEntryPoint (audioMaster); } diff --git a/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp b/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp index 0003eabe4b..955b6e14b8 100644 --- a/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp +++ b/modules/juce_audio_plugin_client/VST3/juce_VST3_Wrapper.cpp @@ -63,8 +63,6 @@ #endif #endif -JUCE_DEFINE_WRAPPER_TYPE (wrapperType_VST3); - namespace juce { @@ -2410,7 +2408,7 @@ private: // The VST3 plugin entry point. JUCE_EXPORTED_FUNCTION IPluginFactory* PLUGIN_API GetPluginFactory() { - JUCE_DECLARE_WRAPPER_TYPE (wrapperType_VST3); + PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_VST3; #if JUCE_WINDOWS // Cunning trick to force this function to be exported. Life's too short to diff --git a/modules/juce_audio_plugin_client/utility/juce_PluginHostType.h b/modules/juce_audio_plugin_client/utility/juce_PluginHostType.h index eb9d0628d7..b779bf1d3f 100644 --- a/modules/juce_audio_plugin_client/utility/juce_PluginHostType.h +++ b/modules/juce_audio_plugin_client/utility/juce_PluginHostType.h @@ -22,18 +22,6 @@ ============================================================================== */ -#ifndef DOXYGEN - // @internal - extern JUCE_API int* jucePlugInClientCurrentWrapperType; - - // this is ugly hack is needed by juce_getExecutableFile to have a wrapper - // dependent symbol - #define JUCE_DEFINE_WRAPPER_TYPE(x) JUCE_API int jucePlugInClientCurrentWrapperType_ ## x = static_cast (AudioProcessor::x); - #define JUCE_DECLARE_WRAPPER_TYPE(x) jucePlugInClientCurrentWrapperType = &jucePlugInClientCurrentWrapperType_ ## x; - -#endif - - //============================================================================== class PluginHostType { @@ -190,15 +178,15 @@ public: @see AudioProcessor::wrapperType */ - static AudioProcessor::WrapperType getPluginLoadedAs() noexcept - { - if (jucePlugInClientCurrentWrapperType != nullptr) - return static_cast (*jucePlugInClientCurrentWrapperType); - - return AudioProcessor::wrapperType_Undefined; - } + static AudioProcessor::WrapperType getPluginLoadedAs() noexcept { return jucePlugInClientCurrentWrapperType; } //============================================================================== + + #ifndef DOXYGEN + // @internal + static AudioProcessor::WrapperType jucePlugInClientCurrentWrapperType; + #endif + private: static HostType getHostType() { diff --git a/modules/juce_audio_plugin_client/utility/juce_PluginUtilities.cpp b/modules/juce_audio_plugin_client/utility/juce_PluginUtilities.cpp index d95c931191..f9f4a2f297 100644 --- a/modules/juce_audio_plugin_client/utility/juce_PluginUtilities.cpp +++ b/modules/juce_audio_plugin_client/utility/juce_PluginUtilities.cpp @@ -32,7 +32,7 @@ namespace juce { - int* jucePlugInClientCurrentWrapperType = nullptr; + AudioProcessor::WrapperType PluginHostType::jucePlugInClientCurrentWrapperType = AudioProcessor::wrapperType_Undefined; } #if _MSC_VER || JUCE_MINGW diff --git a/modules/juce_core/native/juce_posix_SharedCode.h b/modules/juce_core/native/juce_posix_SharedCode.h index b01f4b0ce9..111b5818b8 100644 --- a/modules/juce_core/native/juce_posix_SharedCode.h +++ b/modules/juce_core/native/juce_posix_SharedCode.h @@ -26,10 +26,6 @@ ============================================================================== */ -#ifdef JUCE_MODULE_AVAILABLE_juce_audio_plugin_client - extern int* jucePlugInClientCurrentWrapperType; -#endif - CriticalSection::CriticalSection() noexcept { pthread_mutexattr_t atts; @@ -634,12 +630,7 @@ File juce_getExecutableFile() { Dl_info exeInfo; - #ifdef JUCE_MODULE_AVAILABLE_juce_audio_plugin_client - void* localSymbol = jucePlugInClientCurrentWrapperType != nullptr ? (void*) jucePlugInClientCurrentWrapperType - : (void*) juce_getExecutableFile; - #else void* localSymbol = (void*) juce_getExecutableFile; - #endif dladdr (localSymbol, &exeInfo); return CharPointer_UTF8 (exeInfo.dli_fname); }