commit dfc9e235c065c4a241d3e230587e6aca813d05f9
parent fc4ad6180b678fc92df61a2d2dee2f10207d064b
Author: falkTX <falktx@falktx.com>
Date: Sat, 17 Feb 2024 13:40:55 +0100
Another attempt at AU support
Signed-off-by: falkTX <falktx@falktx.com>
Diffstat:
8 files changed, 137 insertions(+), 9 deletions(-)
diff --git a/Makefile.plugins.mk b/Makefile.plugins.mk
@@ -296,6 +296,9 @@ static = $(TARGET_DIR)/$(NAME).a
ifeq ($(MACOS),true)
BUNDLE_RESOURCES = Info.plist PkgInfo Resources/empty.lproj
+au = $(TARGET_DIR)/$(NAME).component/Contents/MacOS/$(NAME)
+# aufiles += $(TARGET_DIR)/$(NAME).component/Contents/Resources/$(NAME).rsrc
+aufiles += $(BUNDLE_RESOURCES:%=$(TARGET_DIR)/$(NAME).component/Contents/%)
vst2files += $(BUNDLE_RESOURCES:%=$(TARGET_DIR)/$(NAME).vst/Contents/%)
vst3files += $(BUNDLE_RESOURCES:%=$(TARGET_DIR)/$(NAME).vst3/Contents/%)
clapfiles += $(BUNDLE_RESOURCES:%=$(TARGET_DIR)/$(NAME).clap/Contents/%)
@@ -316,6 +319,7 @@ endif
# Set plugin symbols to export
ifeq ($(MACOS),true)
+SYMBOLS_AU = -Wl,-exported_symbols_list,$(DPF_PATH)/utils/symbols/au.exp
SYMBOLS_LADSPA = -Wl,-exported_symbols_list,$(DPF_PATH)/utils/symbols/ladspa.exp
SYMBOLS_DSSI = -Wl,-exported_symbols_list,$(DPF_PATH)/utils/symbols/dssi.exp
SYMBOLS_LV2DSP = -Wl,-exported_symbols_list,$(DPF_PATH)/utils/symbols/lv2-dsp.exp
@@ -410,10 +414,11 @@ ifeq ($(DPF_BUILD_DIR),)
endif
rm -rf $(TARGET_DIR)/$(NAME)
rm -rf $(TARGET_DIR)/$(NAME)-*
+ rm -rf $(TARGET_DIR)/$(NAME).clap
+ rm -rf $(TARGET_DIR)/$(NAME).component
rm -rf $(TARGET_DIR)/$(NAME).lv2
rm -rf $(TARGET_DIR)/$(NAME).vst
rm -rf $(TARGET_DIR)/$(NAME).vst3
- rm -rf $(TARGET_DIR)/$(NAME).clap
# ---------------------------------------------------------------------------------------------------------------------
# DGL
@@ -680,6 +685,20 @@ endif
$(SILENT)$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(EXTRA_LIBS) $(EXTRA_DSP_LIBS) $(EXTRA_UI_LIBS) $(DGL_LIBS) $(CLAP_LIBS) $(SHARED) $(SYMBOLS_CLAP) -o $@
# ---------------------------------------------------------------------------------------------------------------------
+# AU
+
+au: $(au) $(aufiles)
+
+ifeq ($(HAVE_DGL),true)
+$(au): $(OBJS_DSP) $(OBJS_UI) $(BUILD_DIR)/DistrhoPluginMain_AU.cpp.o $(BUILD_DIR)/DistrhoUIMain_AU.cpp.o $(DGL_LIB)
+else
+$(au): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_AU.cpp.o
+endif
+ -@mkdir -p $(shell dirname $@)
+ @echo "Creating AU component for $(NAME)"
+ $(SILENT)$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(EXTRA_LIBS) $(EXTRA_DSP_LIBS) $(EXTRA_UI_LIBS) $(DGL_LIBS) -framework AudioUnit $(SHARED) $(SYMBOLS_AU) -o $@
+
+# ---------------------------------------------------------------------------------------------------------------------
# Shared
shared: $(shared)
@@ -741,6 +760,7 @@ endif
-include $(BUILD_DIR)/DistrhoPluginMain_VST2.cpp.d
-include $(BUILD_DIR)/DistrhoPluginMain_VST3.cpp.d
-include $(BUILD_DIR)/DistrhoPluginMain_CLAP.cpp.d
+-include $(BUILD_DIR)/DistrhoPluginMain_AU.cpp.d
-include $(BUILD_DIR)/DistrhoPluginMain_SHARED.cpp.d
-include $(BUILD_DIR)/DistrhoPluginMain_STATIC.cpp.d
@@ -750,6 +770,7 @@ endif
-include $(BUILD_DIR)/DistrhoUIMain_VST2.cpp.d
-include $(BUILD_DIR)/DistrhoUIMain_VST3.cpp.d
-include $(BUILD_DIR)/DistrhoUIMain_CLAP.cpp.d
+-include $(BUILD_DIR)/DistrhoUIMain_AU.cpp.d
-include $(BUILD_DIR)/DistrhoUIMain_SHARED.cpp.d
-include $(BUILD_DIR)/DistrhoUIMain_STATIC.cpp.d
diff --git a/distrho/DistrhoPlugin.hpp b/distrho/DistrhoPlugin.hpp
@@ -222,7 +222,7 @@ protected:
/**
Get the plugin unique Id.@n
- This value is used by LADSPA, DSSI, VST2 and VST3 plugin formats.
+ This value is used by LADSPA, DSSI, VST2, VST3 and AU plugin formats.
@see d_cconst()
*/
virtual int64_t getUniqueId() const = 0;
diff --git a/distrho/DistrhoPluginMain.cpp b/distrho/DistrhoPluginMain.cpp
@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
- * Copyright (C) 2012-2022 Filipe Coelho <falktx@falktx.com>
+ * Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
@@ -16,7 +16,9 @@
#include "src/DistrhoPlugin.cpp"
-#if defined(DISTRHO_PLUGIN_TARGET_CARLA)
+#if defined(DISTRHO_PLUGIN_TARGET_AU)
+# include "src/DistrhoPluginAU.cpp"
+#elif defined(DISTRHO_PLUGIN_TARGET_CARLA)
# include "src/DistrhoPluginCarla.cpp"
#elif defined(DISTRHO_PLUGIN_TARGET_CLAP)
# include "src/DistrhoPluginCLAP.cpp"
diff --git a/distrho/DistrhoUIMain.cpp b/distrho/DistrhoUIMain.cpp
@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
- * Copyright (C) 2012-2023 Filipe Coelho <falktx@falktx.com>
+ * Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
@@ -23,7 +23,9 @@
#if DISTRHO_PLUGIN_HAS_UI
-#if defined(DISTRHO_PLUGIN_TARGET_CARLA)
+#if defined(DISTRHO_PLUGIN_TARGET_AU)
+# define DISTRHO_PLUGIN_AND_UI_IN_SINGLE_OBJECT 1
+#elif defined(DISTRHO_PLUGIN_TARGET_CARLA)
# define DISTRHO_PLUGIN_AND_UI_IN_SINGLE_OBJECT 1
#elif defined(DISTRHO_PLUGIN_TARGET_CLAP)
# define DISTRHO_PLUGIN_AND_UI_IN_SINGLE_OBJECT 1
diff --git a/distrho/src/DistrhoPluginAU.cpp b/distrho/src/DistrhoPluginAU.cpp
@@ -0,0 +1,99 @@
+/*
+ * DISTRHO Plugin Framework (DPF)
+ * Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any purpose with
+ * or without fee is hereby granted, provided that the above copyright notice and this
+ * permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
+ * TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
+ * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "DistrhoPluginInternal.hpp"
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunused-parameter"
+
+#include "au/AUBase.h"
+
+#pragma clang diagnostic pop
+
+START_NAMESPACE_DISTRHO
+
+// --------------------------------------------------------------------------------------------------------------------
+
+class PluginAU : public AUBase
+{
+public:
+ PluginAU(AudioUnit component)
+ : AUBase(component, 0, 0)
+ {}
+
+protected:
+ bool CanScheduleParameters() const override
+ {
+ return false;
+ }
+
+ bool StreamFormatWritable (AudioUnitScope, AudioUnitElement) override
+ {
+ return false;
+ }
+
+ DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PluginAU)
+};
+
+END_NAMESPACE_DISTRHO
+
+// --------------------------------------------------------------------------------------------------------------------
+
+#ifndef verify
+# define verify(assertion) __Verify(assertion)
+#endif
+#ifndef verify_noerr
+# define verify_noerr(errorCode) __Verify_noErr(errorCode)
+#endif
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunused-parameter"
+#pragma clang diagnostic ignored "-Wunused-private-field"
+
+#include "au/AUBase.cpp"
+#include "au/AUBuffer.cpp"
+#include "au/AUDispatch.cpp"
+#include "au/AUInputElement.cpp"
+#include "au/AUMIDIBase.cpp"
+#include "au/AUOutputBase.cpp"
+#include "au/AUOutputElement.cpp"
+#include "au/AUScopeElement.cpp"
+#include "au/CAAUParameter.cpp"
+#include "au/CAAudioChannelLayout.cpp"
+#include "au/CAMutex.cpp"
+#include "au/CAStreamBasicDescription.cpp"
+#include "au/CAVectorUnit.cpp"
+#include "au/CarbonEventHandler.cpp"
+#include "au/ComponentBase.cpp"
+#include "au/MusicDeviceBase.cpp"
+
+#pragma clang diagnostic pop
+
+#undef verify
+#undef verify_noerr
+
+// --------------------------------------------------------------------------------------------------------------------
+
+DISTRHO_PLUGIN_EXPORT
+OSStatus PluginAUEntry(ComponentParameters*, PluginAU*);
+
+#if DISTRHO_PLUGIN_WANT_MIDI_INPUT || DISTRHO_PLUGIN_WANT_MIDI_OUTPUT
+AUDIOCOMPONENT_ENTRY(AUMIDIEffectFactory, PluginAU)
+#else
+AUDIOCOMPONENT_ENTRY(AUBaseFactory, PluginAU)
+#endif
+
+// --------------------------------------------------------------------------------------------------------------------
diff --git a/distrho/src/DistrhoUtils.cpp b/distrho/src/DistrhoUtils.cpp
@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
- * Copyright (C) 2012-2022 Filipe Coelho <falktx@falktx.com>
+ * Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
@@ -77,7 +77,9 @@ const char* getBinaryFilename()
const char* getPluginFormatName() noexcept
{
-#if defined(DISTRHO_PLUGIN_TARGET_CARLA)
+#if defined(DISTRHO_PLUGIN_TARGET_AU)
+ return "AudioUnit";
+#elif defined(DISTRHO_PLUGIN_TARGET_CARLA)
return "Carla";
#elif defined(DISTRHO_PLUGIN_TARGET_JACK)
#if defined(DISTRHO_OS_WASM)
@@ -110,7 +112,7 @@ const char* getResourcePath(const char* const bundlePath) noexcept
{
DISTRHO_SAFE_ASSERT_RETURN(bundlePath != nullptr, nullptr);
- #if defined(DISTRHO_PLUGIN_TARGET_JACK) || defined(DISTRHO_PLUGIN_TARGET_VST2) || defined(DISTRHO_PLUGIN_TARGET_CLAP)
+ #if defined(DISTRHO_PLUGIN_TARGET_AU) || defined(DISTRHO_PLUGIN_TARGET_JACK) || defined(DISTRHO_PLUGIN_TARGET_VST2) || defined(DISTRHO_PLUGIN_TARGET_CLAP)
static String resourcePath;
if (resourcePath.isEmpty())
diff --git a/examples/Parameters/Makefile b/examples/Parameters/Makefile
@@ -39,6 +39,7 @@ TARGETS += lv2_sep
TARGETS += vst
TARGETS += vst3
TARGETS += clap
+TARGETS += au
all: $(TARGETS)
diff --git a/utils/symbols/au.exp b/utils/symbols/au.exp
@@ -0,0 +1 @@
+_PluginAUEntry