Browse Source

Automatically detect Rez flags; Add test prints

pull/121/head
falkTX 6 years ago
parent
commit
69633c12ab
4 changed files with 47 additions and 9 deletions
  1. +30
    -1
      Makefile.plugins.mk
  2. +10
    -8
      distrho/src/DistrhoPluginAU.cpp
  3. +3
    -0
      examples/Gain/DistrhoPluginInfo.h
  4. +4
    -0
      examples/Gain/GainExamplePlugin.cpp

+ 30
- 1
Makefile.plugins.mk View File

@@ -91,6 +91,35 @@ AU_LINK_FLAGS = \
# -I$(DPF_PATH)/distrho/src/CoreAudio106/AudioUnits/AUPublic/OtherBases # -I$(DPF_PATH)/distrho/src/CoreAudio106/AudioUnits/AUPublic/OtherBases
# -framework CoreAudio \ # -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 # Handle UI stuff, disable UI support automatically


@@ -316,7 +345,6 @@ $(BUILD_DIR)/step1.rsrc: $(DPF_PATH)/distrho/src/DistrhoPluginAU.r $(BUILD_DIR)/
Rez $< \ Rez $< \
-d SystemSevenOrLater=1 \ -d SystemSevenOrLater=1 \
-useDF -script Roman \ -useDF -script Roman \
-d x86_64_YES -d i386_YES -arch x86_64 -arch i386 \
-i . \ -i . \
-i $(BUILD_DIR) \ -i $(BUILD_DIR) \
-i $(DPF_PATH)/distrho/src/CoreAudio106/AudioUnits/AUPublic \ -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 $(DPF_PATH)/distrho/src/CoreAudio106/PublicUtility \
-I /Developer/SDKs/MacOSX10.6.sdk \ -I /Developer/SDKs/MacOSX10.6.sdk \
-I /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Versions/A/Headers \ -I /System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Versions/A/Headers \
$(REZ_FLAGS) \
-o $@ -o $@


$(BUILD_DIR)/DistrhoPluginInfo.r: $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginAUexport.cpp.o $(BUILD_DIR)/DistrhoPluginInfo.r: $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginAUexport.cpp.o


+ 10
- 8
distrho/src/DistrhoPluginAU.cpp View File

@@ -48,11 +48,14 @@ public:
PluginAU(AudioUnit component) PluginAU(AudioUnit component)
: AUEffectBase(component), : AUEffectBase(component),
fLastValuesInit(), fLastValuesInit(),
fPlugin(this, writeMidiCallback)
fPlugin(this, writeMidiCallback),
fNumChannels(0)
{ {
CreateElements(); CreateElements();


maxch = GetNumberOfChannels();
// FIXME this does not seem right
fNumChannels = GetNumberOfChannels();
DISTRHO_SAFE_ASSERT(fNumChannels == DISTRHO_PLUGIN_NUM_INPUTS);


AUElement* const globals = Globals(); AUElement* const globals = Globals();
DISTRHO_SAFE_ASSERT_RETURN(globals != nullptr,); DISTRHO_SAFE_ASSERT_RETURN(globals != nullptr,);
@@ -206,16 +209,15 @@ public:
AudioBufferList &outBuffer, AudioBufferList &outBuffer,
UInt32 inFramesToProcess) override 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; srcBuffer[i] = (Float32 *)inBuffer.mBuffers[i].mData;
destBuffer[i] = (Float32 *)outBuffer.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)); SetParameter(i, GetParameter(i));
} }


@@ -231,7 +233,7 @@ public:
private: private:
LastValuesInit fLastValuesInit; LastValuesInit fLastValuesInit;
PluginExporter fPlugin; PluginExporter fPlugin;
UInt32 maxch;
uint32_t fNumChannels;


DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PluginAU) DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PluginAU)
}; };


+ 3
- 0
examples/Gain/DistrhoPluginInfo.h View File

@@ -26,4 +26,7 @@
#define DISTRHO_PLUGIN_NUM_INPUTS 1 #define DISTRHO_PLUGIN_NUM_INPUTS 1
#define DISTRHO_PLUGIN_NUM_OUTPUTS 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 #endif // DISTRHO_PLUGIN_INFO_H_INCLUDED

+ 4
- 0
examples/Gain/GainExamplePlugin.cpp View File

@@ -117,6 +117,8 @@ protected:
parameter.ranges.def = 1.0f; parameter.ranges.def = 1.0f;
parameter.ranges.min = 0.0f; parameter.ranges.min = 0.0f;
parameter.ranges.max = 2.0f; parameter.ranges.max = 2.0f;

d_stdout("initParameter %u", index);
} }


/* -------------------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------------------
@@ -128,6 +130,7 @@ protected:
*/ */
float getParameterValue(uint32_t index) const override float getParameterValue(uint32_t index) const override
{ {
d_stdout("getParameterValue %u %f", index, fGain);
if (index != 0) if (index != 0)
return 0.0f; return 0.0f;


@@ -142,6 +145,7 @@ protected:
*/ */
void setParameterValue(uint32_t index, float value) override void setParameterValue(uint32_t index, float value) override
{ {
d_stdout("setParameterValue %u %f", index, value);
if (index != 0) if (index != 0)
return; return;




Loading…
Cancel
Save