summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfalkTX <falktx@gmail.com>2019-01-28 21:32:49 +0000
committerfalkTX <falktx@gmail.com>2019-01-28 21:32:49 +0000
commit69633c12ab48c8fd57907929e6a093b97c2af131 (patch)
tree60bcab61934750b82e933706ae5e99ec3781a793
parentf34d282af0fcb203ff34bc24ac2a7816708c2912 (diff)
Automatically detect Rez flags; Add test prints
-rw-r--r--Makefile.plugins.mk31
-rw-r--r--distrho/src/DistrhoPluginAU.cpp18
-rw-r--r--examples/Gain/DistrhoPluginInfo.h3
-rw-r--r--examples/Gain/GainExamplePlugin.cpp4
4 files changed, 47 insertions, 9 deletions
diff --git a/Makefile.plugins.mk b/Makefile.plugins.mk
index 5c462f8a..41241a9d 100644
--- a/Makefile.plugins.mk
+++ b/Makefile.plugins.mk
@@ -92,6 +92,35 @@ AU_LINK_FLAGS = \
# -framework CoreAudio \
# ---------------------------------------------------------------------------------------------------------------------
+# Set flags for 'Rez', needed for AU
+
+ifneq ($(CROSS_COMPILING),true)
+
+# Use environment to find arch
+ifeq ($(shell echo ${CXXFLAGS} | grep -q -- -arch && echo true),true)
+
+ifeq ($(shell echo ${CXXFLAGS} | grep -q -- x86_64 && echo true),true)
+REZ_FLAGS += -arch x86_64 -d x86_64_YES
+endif
+
+ifeq ($(shell echo ${CXXFLAGS} | grep -q -- i386 && echo true),true)
+REZ_FLAGS += -arch i386 -d i386_YES
+endif
+
+else # No "-arch" in environment, automatically detect arch
+
+ifeq ($(shell gcc -dM -E - < /dev/null | grep -q -- __x86_64__ && echo true),true)
+REZ_FLAGS += -arch x86_64 -d x86_64_YES
+endif
+
+ifeq ($(shell gcc -dM -E - < /dev/null | grep -q -- __i386__ && echo true),true)
+REZ_FLAGS += -arch i386 -d i386_YES
+endif
+
+endif # CXXFLAGS
+endif # CROSS_COMPILING
+
+# ---------------------------------------------------------------------------------------------------------------------
# Handle UI stuff, disable UI support automatically
ifeq ($(FILES_UI),)
@@ -316,7 +345,6 @@ $(BUILD_DIR)/step1.rsrc: $(DPF_PATH)/distrho/src/DistrhoPluginAU.r $(BUILD_DIR)/
Rez $< \
-d SystemSevenOrLater=1 \
-useDF -script Roman \
- -d x86_64_YES -d i386_YES -arch x86_64 -arch i386 \
-i . \
-i $(BUILD_DIR) \
-i $(DPF_PATH)/distrho/src/CoreAudio106/AudioUnits/AUPublic \
@@ -326,6 +354,7 @@ $(BUILD_DIR)/step1.rsrc: $(DPF_PATH)/distrho/src/DistrhoPluginAU.r $(BUILD_DIR)/
-i $(DPF_PATH)/distrho/src/CoreAudio106/PublicUtility \
-I /Developer/SDKs/MacOSX10.6.sdk \
-I /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Versions/A/Headers \
+ $(REZ_FLAGS) \
-o $@
$(BUILD_DIR)/DistrhoPluginInfo.r: $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginAUexport.cpp.o
diff --git a/distrho/src/DistrhoPluginAU.cpp b/distrho/src/DistrhoPluginAU.cpp
index c31e9c08..1a53be1c 100644
--- a/distrho/src/DistrhoPluginAU.cpp
+++ b/distrho/src/DistrhoPluginAU.cpp
@@ -48,11 +48,14 @@ public:
PluginAU(AudioUnit component)
: AUEffectBase(component),
fLastValuesInit(),
- fPlugin(this, writeMidiCallback)
+ fPlugin(this, writeMidiCallback),
+ fNumChannels(0)
{
CreateElements();
- maxch = GetNumberOfChannels();
+ // FIXME this does not seem right
+ fNumChannels = GetNumberOfChannels();
+ DISTRHO_SAFE_ASSERT(fNumChannels == DISTRHO_PLUGIN_NUM_INPUTS);
AUElement* const globals = Globals();
DISTRHO_SAFE_ASSERT_RETURN(globals != nullptr,);
@@ -206,16 +209,15 @@ public:
AudioBufferList &outBuffer,
UInt32 inFramesToProcess) override
{
- UInt32 i;
- float *srcBuffer[maxch];
- float *destBuffer[maxch];
+ float* srcBuffer[fNumChannels];
+ float* destBuffer[fNumChannels];
- for (i = 0; i < maxch; i++) {
+ for (uint32_t i = 0; i < fNumChannels; ++i) {
srcBuffer[i] = (Float32 *)inBuffer.mBuffers[i].mData;
destBuffer[i] = (Float32 *)outBuffer.mBuffers[i].mData;
}
- for (i = 0; i < fPlugin.getParameterCount(); i++) {
+ for (uint32_t i = 0; i < fPlugin.getParameterCount(); ++i) {
SetParameter(i, GetParameter(i));
}
@@ -231,7 +233,7 @@ public:
private:
LastValuesInit fLastValuesInit;
PluginExporter fPlugin;
- UInt32 maxch;
+ uint32_t fNumChannels;
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PluginAU)
};
diff --git a/examples/Gain/DistrhoPluginInfo.h b/examples/Gain/DistrhoPluginInfo.h
index 39c42af8..f4fedac7 100644
--- a/examples/Gain/DistrhoPluginInfo.h
+++ b/examples/Gain/DistrhoPluginInfo.h
@@ -26,4 +26,7 @@
#define DISTRHO_PLUGIN_NUM_INPUTS 1
#define DISTRHO_PLUGIN_NUM_OUTPUTS 1
+#define DISTRHO_PLUGIN_AU_SUBTYPE 'gain'
+#define DISTRHO_PLUGIN_AU_MANUF 'dpf '
+
#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED
diff --git a/examples/Gain/GainExamplePlugin.cpp b/examples/Gain/GainExamplePlugin.cpp
index 351bcbda..18f631c1 100644
--- a/examples/Gain/GainExamplePlugin.cpp
+++ b/examples/Gain/GainExamplePlugin.cpp
@@ -117,6 +117,8 @@ protected:
parameter.ranges.def = 1.0f;
parameter.ranges.min = 0.0f;
parameter.ranges.max = 2.0f;
+
+ d_stdout("initParameter %u", index);
}
/* --------------------------------------------------------------------------------------------------------
@@ -128,6 +130,7 @@ protected:
*/
float getParameterValue(uint32_t index) const override
{
+ d_stdout("getParameterValue %u %f", index, fGain);
if (index != 0)
return 0.0f;
@@ -142,6 +145,7 @@ protected:
*/
void setParameterValue(uint32_t index, float value) override
{
+ d_stdout("setParameterValue %u %f", index, value);
if (index != 0)
return;