From a88087b836c3c69d8cab09907c1dd7b7841e7e00 Mon Sep 17 00:00:00 2001 From: "Dr. Tom Murphy VII Ph.D" <499244+tom7@users.noreply.github.com> Date: Sat, 27 Jun 2020 23:05:43 +0000 Subject: [PATCH] Oops, checked in some of this already with the previous commit. Some plugins are calling GetChannelNum which is AU-specific, but it's easy to support with the mDSPcores thing. Add that. The macro-based initialization is not working today because mDSPCores is private (makes sense) but the macro is evaluated in the context of the derived class, which doesn't have access to private members. So instead, just define a protected initCores method, which does nothing in AU but otherwise this initialization (and now also setting the channel like AU kernel does). Instead of the macro, plugins run initCores() at the bottom of their ctor (does nothing in AU). --- exemplar/exemplar.cpp | 17 +++++++++-------- geometer/geometer.cpp | 8 ++++---- guitest/guitest.cpp | 17 +++++++++-------- polarizer/polarizer.cpp | 2 +- slowft/slowft.cpp | 7 ++++--- stub-dfxplugin/dfxplugin-stub.cpp | 2 +- transverb/transverbformalities.cpp | 2 +- windowingstub/windowingstub.cpp | 7 ++++--- 8 files changed, 33 insertions(+), 29 deletions(-) diff --git a/exemplar/exemplar.cpp b/exemplar/exemplar.cpp index c51aaf70..c17ef1a6 100644 --- a/exemplar/exemplar.cpp +++ b/exemplar/exemplar.cpp @@ -79,15 +79,16 @@ PLUGIN::PLUGIN(TARGET_API_BASE_INSTANCE_TYPE inInstance) addchannelconfig(1, 1); /* mono */ #endif - #ifdef TARGET_API_VST - #if TARGET_PLUGIN_USES_DSPCORE - DFX_INIT_CORE(ExemplarDSP); /* we need to manage DSP cores manually in VST */ - #endif - /* if you have a GUI, need an Editor class... */ - #if TARGET_PLUGIN_HAS_GUI - editor = new ExemplarEditor(this); - #endif +#if TARGET_PLUGIN_USES_DSPCORE + initCores(); +#endif + +#ifdef TARGET_API_VST + /* if you have a GUI, need an Editor class... */ + #if TARGET_PLUGIN_HAS_GUI + editor = new ExemplarEditor(this); #endif +#endif } PLUGIN::~PLUGIN() { diff --git a/geometer/geometer.cpp b/geometer/geometer.cpp index 6d422fad..8ce8af42 100644 --- a/geometer/geometer.cpp +++ b/geometer/geometer.cpp @@ -178,12 +178,12 @@ PLUGIN::PLUGIN(TARGET_API_BASE_INSTANCE_TYPE inInstance) addchannelconfig(1, 1); /* mono */ #endif - tmpx.fill(0); - tmpy.fill(0.0f); - #if TARGET_PLUGIN_USES_DSPCORE - DFX_INIT_CORE(PLUGINCORE); + initCores(); #endif + + tmpx.fill(0); + tmpy.fill(0.0f); } void PLUGIN::dfx_PostConstructor() diff --git a/guitest/guitest.cpp b/guitest/guitest.cpp index 7efc2956..93a5a48f 100644 --- a/guitest/guitest.cpp +++ b/guitest/guitest.cpp @@ -54,15 +54,16 @@ PLUGIN::PLUGIN(TARGET_API_BASE_INSTANCE_TYPE inInstance) addchannelconfig(1, 1); /* mono */ #endif - #ifdef TARGET_API_VST - #if TARGET_PLUGIN_USES_DSPCORE - DFX_INIT_CORE(GuitestDSP); /* we need to manage DSP cores manually in VST */ - #endif - /* if you have a GUI, need an Editor class... */ - #if TARGET_PLUGIN_HAS_GUI - editor = new GuitestEditor(this); - #endif +#if TARGET_PLUGIN_USES_DSPCORE + initCores(); +#endif + +#ifdef TARGET_API_VST + /* if you have a GUI, need an Editor class... */ + #if TARGET_PLUGIN_HAS_GUI + editor = new GuitestEditor(this); #endif +#endif } PLUGIN::~PLUGIN() { diff --git a/polarizer/polarizer.cpp b/polarizer/polarizer.cpp index 3049b5bf..795fa805 100644 --- a/polarizer/polarizer.cpp +++ b/polarizer/polarizer.cpp @@ -38,7 +38,7 @@ Polarizer::Polarizer(TARGET_API_BASE_INSTANCE_TYPE inInstance) setpresetname(0, "twicky"); // default preset name - DFX_INIT_CORE(PolarizerDSP); + initCores(); } //----------------------------------------------------------------------------------------- diff --git a/slowft/slowft.cpp b/slowft/slowft.cpp index 14456383..d9c54538 100644 --- a/slowft/slowft.cpp +++ b/slowft/slowft.cpp @@ -56,10 +56,11 @@ PLUGIN::PLUGIN(TARGET_API_BASE_INSTANCE_TYPE inInstance) addchannelconfig(1, 1); /* mono */ #endif +#if TARGET_PLUGIN_USES_DSPCORE + initCores(); /* we need to manage DSP cores manually in VST */ +#endif + #ifdef TARGET_API_VST - #if TARGET_PLUGIN_USES_DSPCORE - DFX_INIT_CORE(SlowftDSP); /* we need to manage DSP cores manually in VST */ - #endif /* if you have a GUI, need an Editor class... */ #if TARGET_PLUGIN_HAS_GUI editor = new SlowftEditor(this); diff --git a/stub-dfxplugin/dfxplugin-stub.cpp b/stub-dfxplugin/dfxplugin-stub.cpp index 947ddd6c..ad2c5efe 100644 --- a/stub-dfxplugin/dfxplugin-stub.cpp +++ b/stub-dfxplugin/dfxplugin-stub.cpp @@ -99,7 +99,7 @@ DfxStub::DfxStub(TARGET_API_BASE_INSTANCE_TYPE inInstance) // API-specific stuff below #if TARGET_PLUGIN_USES_DSPCORE - DFX_INIT_CORE(DfxStubDSP); + initCores(); #endif #ifdef TARGET_API_VST #if TARGET_PLUGIN_HAS_GUI diff --git a/transverb/transverbformalities.cpp b/transverb/transverbformalities.cpp index 0fc89968..bfd36d19 100644 --- a/transverb/transverbformalities.cpp +++ b/transverb/transverbformalities.cpp @@ -80,7 +80,7 @@ Transverb::Transverb(TARGET_API_BASE_INSTANCE_TYPE inInstance) #if TARGET_PLUGIN_USES_DSPCORE - DFX_INIT_CORE(TransverbDSP); + initCores(); #endif } diff --git a/windowingstub/windowingstub.cpp b/windowingstub/windowingstub.cpp index e19d9236..9ed74ca6 100644 --- a/windowingstub/windowingstub.cpp +++ b/windowingstub/windowingstub.cpp @@ -56,10 +56,11 @@ PLUGIN::PLUGIN(TARGET_API_BASE_INSTANCE_TYPE inInstance) addchannelconfig(1, 1); /* mono */ #endif +#if TARGET_PLUGIN_USES_DSPCORE + initCores(); +#endif + #ifdef TARGET_API_VST - #if TARGET_PLUGIN_USES_DSPCORE - DFX_INIT_CORE(WindowingstubDSP); /* we need to manage DSP cores manually in VST */ - #endif /* if you have a GUI, need an Editor class... */ #if TARGET_PLUGIN_HAS_GUI editor = new WindowingstubEditor(this);