Skip to content

Commit

Permalink
fold TARGET_PLUGIN_USES_VSTGUI into TARGET_PLUGIN_HAS_GUI (the former…
Browse files Browse the repository at this point in the history
… was redundant, as Tom mentioned in notes2020)

* cleaned out some additional obsolete macros: PLUGIN_EDITOR_ENTRY_POINT, DFXGUI_USE_COCOA_AU_VIEW, PLUGGUI, AU, ENABLE_VST_EXTENSION_IN_VSTGUI, VSTGUI_USES_UTF8, USE_LIBPNG
* also as Tom mentioned in notes2020, VST_FORCE_DEPRECATED can be enabled on all platforms as it is the minimum requirement for 64-bit code
  • Loading branch information
sophiapoirier committed Jul 26, 2020
1 parent a4b9ee7 commit e6bde1c
Show file tree
Hide file tree
Showing 14 changed files with 44 additions and 113 deletions.
6 changes: 3 additions & 3 deletions dfx-library/dfxplugin-audiounit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ This is where we connect the Audio Unit API to our DfxPlugin system.
#include "dfx-au-utilities.h"
#include "dfxmisc.h"

#if DFXGUI_USE_COCOA_AU_VIEW
#if TARGET_PLUGIN_HAS_GUI
#include "dfxgui-auviewfactory.h"
#endif

Expand Down Expand Up @@ -272,7 +272,7 @@ OSStatus DfxPlugin::GetPropertyInfo(AudioUnitPropertyID inPropertyID,
switch (inPropertyID)
{
case kAudioUnitProperty_CocoaUI:
#if DFXGUI_USE_COCOA_AU_VIEW
#if TARGET_PLUGIN_HAS_GUI
outDataSize = sizeof(AudioUnitCocoaViewInfo);
outWritable = false;
status = noErr;
Expand Down Expand Up @@ -417,7 +417,7 @@ OSStatus DfxPlugin::GetProperty(AudioUnitPropertyID inPropertyID,

switch (inPropertyID)
{
#if DFXGUI_USE_COCOA_AU_VIEW
#if TARGET_PLUGIN_HAS_GUI
case kAudioUnitProperty_CocoaUI:
{
auto const pluginBundle = CFBundleGetBundleWithIdentifier(CFSTR(PLUGIN_BUNDLE_IDENTIFIER));
Expand Down
4 changes: 2 additions & 2 deletions dfx-library/dfxplugin-audiounit.r
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*------------------------------------------------------------------------
Destroy FX Library is a collection of foundation code
for creating audio processing plug-ins.
Copyright (C) 2002-2009 Sophia Poirier
Copyright (C) 2002-2020 Sophia Poirier

This file is part of the Destroy FX Library (version 1.0).

Expand Down Expand Up @@ -106,7 +106,7 @@ This is our Audio Unit resource stuff.
#define DESCRIPTION PLUGIN_CREATOR_NAME_STRING" "PLUGIN_NAME_STRING" picturesque yet functional interface"
#endif

#define ENTRY_POINT PLUGIN_EDITOR_ENTRY_POINT
#define ENTRY_POINT "DGVstGuiAUViewEntry"

#include "AUResources.r"

Expand Down
6 changes: 1 addition & 5 deletions dfx-library/dfxplugin-base.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ To contact the author, use the contact form at http:https://destroyfx.org/

// using Digidesign's RTAS/AudioSuite API
#elif defined(TARGET_API_RTAS)
#ifdef TARGET_PLUGIN_USES_VSTGUI
#if TARGET_PLUGIN_HAS_GUI
#include "ITemplateProcess.h"
using TARGET_API_EDITOR_PARENT_INSTANCE_TYPE = ITemplateProcess*;
#else
Expand Down Expand Up @@ -148,10 +148,6 @@ To contact the author, use the contact form at http:https://destroyfx.org/
#error DFX_SUPPORT_OLD_VST_SETTINGS should be defined to 1, if defined
#endif

#if defined(TARGET_PLUGIN_USES_VSTGUI) && TARGET_PLUGIN_USES_VSTGUI - 0 != 1
#error TARGET_PLUGIN_USES_VSTGUI should be defined to 1, if defined
#endif


// Macros that we test with #if, and so should be defined to 1 or 0.

Expand Down
42 changes: 3 additions & 39 deletions dfx-library/dfxplugin-prefix.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*------------------------------------------------------------------------
Destroy FX Library is a collection of foundation code
for creating audio processing plug-ins.
Copyright (C) 2009-2012 Sophia Poirier
Copyright (C) 2009-2020 Sophia Poirier and Tom Murphy 7
This file is part of the Destroy FX Library (version 1.0).
Expand Down Expand Up @@ -77,33 +77,11 @@ This file should be included by any prefix header that you use for your plugin.
#endif


/*-----------------------------------------------------------------------------*/
/* Audio Unit stuff */
#ifdef TARGET_API_AUDIOUNIT
#define DFXGUI_USE_COCOA_AU_VIEW TARGET_PLUGIN_HAS_GUI && __LP64__
#define TARGET_PLUGIN_USES_VSTGUI 1
#ifdef TARGET_PLUGIN_USES_VSTGUI
#define PLUGGUI 1
#define AU 1
#define PLUGIN_EDITOR_ENTRY_POINT "DGVstGuiAUViewEntry"
#endif
#endif


/*-----------------------------------------------------------------------------*/
/* VST stuff */
#ifdef TARGET_API_VST
/* the Mac x86 baseline VST API version is VST 2.4 */
#ifndef VST_FORCE_DEPRECATED
#if defined(__MACH__) && !__ppc__
#define VST_FORCE_DEPRECATED 1
#else
#define VST_FORCE_DEPRECATED 0
#endif
#endif

#define TARGET_PLUGIN_USES_VSTGUI 1
#define ENABLE_VST_EXTENSION_IN_VSTGUI 0
/* require VST 2.4 (the first version with 64-bit executable support) */
#define VST_FORCE_DEPRECATED 1
#endif


Expand All @@ -113,20 +91,6 @@ This file should be included by any prefix header that you use for your plugin.
#ifdef __MACH__
#include "../ProToolsSDK/AlturaPorts/TDMPlugIns/common/Mac/CommonPlugInHeaders.pch"
#endif

#define TARGET_PLUGIN_USES_VSTGUI 1
#define PLUGGUI 1
#endif


/*-----------------------------------------------------------------------------*/
/* VSTGUI stuff */
#ifdef TARGET_PLUGIN_USES_VSTGUI
#if _WIN32
#define VSTGUI_USES_UTF8 0
#define USE_LIBPNG 1
#define WINDOWS 1
#endif
#endif


Expand Down
17 changes: 8 additions & 9 deletions dfx-library/dfxplugin-rtas.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*------------------------------------------------------------------------
Destroy FX Library is a collection of foundation code
for creating audio processing plug-ins.
Copyright (C) 2009-2019 Sophia Poirier
Copyright (C) 2009-2020 Sophia Poirier
This file is part of the Destroy FX Library (version 1.0).
Expand Down Expand Up @@ -49,7 +49,7 @@ This is where we connect the RTAS/AudioSuite API to our DfxPlugin system.
//#include "FicPluginEnums.h"
#include "PlugInUtils.h"

#ifndef TARGET_PLUGIN_USES_VSTGUI
#if !TARGET_PLUGIN_HAS_GUI
#include "CClippingView.h"
#include "CGainMeterView.h"
#include "CNoResourceView.h"
Expand Down Expand Up @@ -125,7 +125,7 @@ void DfxPlugin::DoTokenIdle()
{
CEffectProcess::DoTokenIdle();

#ifdef TARGET_PLUGIN_USES_VSTGUI
#if TARGET_PLUGIN_HAS_GUI
if (mCustomUI_p)
{
// if ( !IsAS() || (IsAS() && (GetASPreviewState() == previewState_Off)) )
Expand Down Expand Up @@ -590,7 +590,7 @@ void DfxPlugin::RenderAudio(float ** inAudioStreams, float ** outAudioStreams, l
//-----------------------------------------------------------------------------
CPlugInView * DfxPlugin::CreateCPlugInView()
{
#ifdef TARGET_PLUGIN_USES_VSTGUI
#if TARGET_PLUGIN_HAS_GUI
CNoResourceView * ui = NULL;
try
{
Expand Down Expand Up @@ -643,7 +643,7 @@ CPlugInView * DfxPlugin::CreateCPlugInView()
#endif
}

#ifdef TARGET_PLUGIN_USES_VSTGUI
#if TARGET_PLUGIN_HAS_GUI

//-----------------------------------------------------------------------------
void DfxPlugin::GetViewRect(Rect * outViewRect)
Expand Down Expand Up @@ -794,8 +794,7 @@ void DfxPlugin::SetViewOrigin(Point anOrigin)
}
#endif

#endif
// TARGET_PLUGIN_USES_VSTGUI
#endif // TARGET_PLUGIN_HAS_GUI



Expand Down Expand Up @@ -872,7 +871,7 @@ void DfxEffectGroup::Initialize()
{
CEffectGroup::Initialize();

#ifdef TARGET_PLUGIN_USES_VSTGUI
#if TARGET_PLUGIN_HAS_GUI
CCustomView::AddNewViewProc("NoUIView", CreateCTemplateNoUIView);
#else
// CGainMeterView doesn't have a RegisterView() method, so we have to do this stuff instead:
Expand All @@ -896,7 +895,7 @@ void DfxEffectGroup::dfx_AddEffectType(CEffectType * inEffectType)
inEffectType->DefineSampleRateSupport(eSupports48kAnd96kAnd192k);
inEffectType->AddGestalt(pluginGestalt_CanBypass);
inEffectType->AddGestalt(pluginGestalt_SupportsClipMeter);
#ifdef TARGET_PLUGIN_USES_VSTGUI
#if TARGET_PLUGIN_HAS_GUI
inEffectType->AddGestalt(pluginGestalt_DoesNotUseDigiUI);
#endif

Expand Down
6 changes: 0 additions & 6 deletions dfx-library/dfxplugin-vst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@ void DfxPlugin::resume()
{
updatesamplerate();

#if TARGET_PLUGIN_USES_MIDI
#if !VST_FORCE_DEPRECATED
wantEvents();
#endif
#endif

// VST doesn't have initialize and cleanup methods like Audio Unit does,
// so we need to call this here
if (!mIsInitialized)
Expand Down
28 changes: 10 additions & 18 deletions dfx-library/dfxplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ This is our class for E-Z plugin-making and E-Z multiple-API support.
#include "dfx-au-utilities.h"
#endif

#if defined(TARGET_API_VST) && TARGET_PLUGIN_HAS_GUI && defined(TARGET_PLUGIN_USES_VSTGUI)
#if defined(TARGET_API_VST) && TARGET_PLUGIN_HAS_GUI
// If using the VST GUI interface, we need the class definition
// for AEffGUIEditor so that we can send it parameter changes.
#include "aeffguieditor.h"
Expand All @@ -53,7 +53,7 @@ This is our class for E-Z plugin-making and E-Z multiple-API support.

#ifdef TARGET_API_RTAS
#include "ConvertUtils.h"
#if TARGET_PLUGIN_HAS_GUI && defined(TARGET_PLUGIN_USES_VSTGUI)
#if TARGET_PLUGIN_HAS_GUI
extern void* gThisModule;
#endif
#endif
Expand Down Expand Up @@ -199,9 +199,6 @@ DfxPlugin::DfxPlugin(
setNumInputs(VST_NUM_INPUTS);
setNumOutputs(VST_NUM_OUTPUTS);

#if !VST_FORCE_DEPRECATED
canProcessReplacing(); // supports replacing audio output
#endif
TARGET_API_BASE_CLASS::setProgram(0); // set the current preset number to 0

// check to see if the host supports sending tempo and time information to VST plugins
Expand Down Expand Up @@ -229,12 +226,12 @@ DfxPlugin::DfxPlugin(
// end VST stuff

#ifdef TARGET_API_RTAS
#ifdef TARGET_PLUGIN_USES_VSTGUI
#if TARGET_PLUGIN_HAS_GUI
mPIWinRect.top = mPIWinRect.left = mPIWinRect.bottom = mPIWinRect.right = 0;
#if TARGET_OS_WIN32
mModuleHandle_p = gThisModule; // extern from DLLMain.cpp; HINSTANCE of the DLL
#endif
#endif
#endif
#endif
// end RTAS stuff
}
Expand Down Expand Up @@ -271,16 +268,15 @@ void DfxPlugin::do_PreDestructor()
// VST doesn't have initialize and cleanup methods like Audio Unit does,
// so we need to call this manually here
do_cleanup();
#endif

#ifdef TARGET_API_VST
#if TARGET_PLUGIN_HAS_GUI
// The destructor of AudioEffect will delete editor if it's non-null, but
// it looks like DfxGuiEditor wants to be able to still access the effect
// during its own destructor. Maybe it's just wong that it's doing that,
// but if not, then we should destroy the editor now before the effect
// instance becomes invalid.
if (auto *e = editor) {
if (auto* e = editor)
{
setEditor(nullptr);
delete e;
}
Expand All @@ -289,10 +285,6 @@ void DfxPlugin::do_PreDestructor()
}


DfxPlugin::~DfxPlugin() {
}


//-----------------------------------------------------------------------------
// non-virtual function that calls initialize() and insures that some stuff happens
long DfxPlugin::do_initialize()
Expand Down Expand Up @@ -601,7 +593,6 @@ void DfxPlugin::postupdate_parameter(long inParameterIndex)

#ifdef TARGET_API_VST
#if TARGET_PLUGIN_HAS_GUI
#ifdef TARGET_PLUGIN_USES_VSTGUI
if (auto const guiEditor = dynamic_cast<VSTGUI::AEffGUIEditor*>(getEditor()))
{
guiEditor->setParameter(inParameterIndex, getparameter_gen(inParameterIndex));
Expand All @@ -610,7 +601,6 @@ void DfxPlugin::postupdate_parameter(long inParameterIndex)
#warning "implementation missing"
assert(false); // XXX TODO: we will need something for our GUI class here
#endif
#endif
#endif

#ifdef TARGET_API_RTAS
Expand Down Expand Up @@ -1179,6 +1169,8 @@ void DfxPlugin::incrementSmoothedAudioValues(DfxPluginCore* owner)
{
std::for_each(mSmoothedAudioValues.cbegin(), mSmoothedAudioValues.cend(), [owner](auto& value)
{
// TODO: is the !owner test vestigial? and now confusing, per the comment in the header declaration?
// (very careful testing required if changed because incorrect managed smoothing stuff has insidious consequences)
if (!owner || (owner == value.second))
{
value.first->inc();
Expand Down Expand Up @@ -1862,7 +1854,7 @@ void DfxPlugin::postupdate_midilearn()
PropertyChanged(dfx::kPluginProperty_MidiLearn, kAudioUnitScope_Global, AudioUnitElement(0));
#endif

#if defined(TARGET_API_VST) && TARGET_PLUGIN_HAS_GUI && defined(TARGET_PLUGIN_USES_VSTGUI)
#if defined(TARGET_API_VST) && TARGET_PLUGIN_HAS_GUI
if (auto const guiEditor = dynamic_cast<DfxGuiEditor*>(getEditor()))
{
guiEditor->HandleMidiLearnChange();
Expand All @@ -1877,7 +1869,7 @@ void DfxPlugin::postupdate_midilearner()
PropertyChanged(dfx::kPluginProperty_MidiLearner, kAudioUnitScope_Global, AudioUnitElement(0));
#endif

#if defined(TARGET_API_VST) && TARGET_PLUGIN_HAS_GUI && defined(TARGET_PLUGIN_USES_VSTGUI)
#if defined(TARGET_API_VST) && TARGET_PLUGIN_HAS_GUI
if (auto const guiEditor = dynamic_cast<DfxGuiEditor*>(getEditor()))
{
guiEditor->HandleMidiLearnerChange();
Expand Down

0 comments on commit e6bde1c

Please sign in to comment.