DPF

DISTRHO Plugin Framework
Log | Files | Refs | Submodules | README | LICENSE

commit db7ee14af9895ac4e878426571c38ab95cb56672
parent a34cb73ccf7090367193aad90620ecec71b3d597
Author: falkTX <falktx@falktx.com>
Date:   Mon, 26 Feb 2024 13:08:20 +0100

AU: always allow to set input element rate, fix build

Signed-off-by: falkTX <falktx@falktx.com>

Diffstat:
MMakefile.plugins.mk | 4+---
Mcmake/DPF-plugin.cmake | 2++
Mdistrho/src/DistrhoPluginAU.cpp | 35+++++++++++++++++++++--------------
3 files changed, 24 insertions(+), 17 deletions(-)

diff --git a/Makefile.plugins.mk b/Makefile.plugins.mk @@ -693,9 +693,7 @@ $(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 AudioToolbox -framework CoreFoundation $(SHARED) $(SYMBOLS_AU) -o $@ - -# -framework AudioUnit + $(SILENT)$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(EXTRA_LIBS) $(EXTRA_DSP_LIBS) $(EXTRA_UI_LIBS) $(DGL_LIBS) -framework AudioToolbox -framework AudioUnit -framework CoreFoundation $(SHARED) $(SYMBOLS_AU) -o $@ # --------------------------------------------------------------------------------------------------------------------- # Export diff --git a/cmake/DPF-plugin.cmake b/cmake/DPF-plugin.cmake @@ -561,12 +561,14 @@ function(dpf__build_au NAME HAS_UI) dpf__add_ui_main("${NAME}-au" "au" "${HAS_UI}") dpf__set_module_export_list("${NAME}-au" "au") find_library(APPLE_AUDIOTOOLBOX_FRAMEWORK "AudioToolbox") + find_library(APPLE_AUDIOUNIT_FRAMEWORK "AudioUnit") find_library(APPLE_COREFOUNDATION_FRAMEWORK "CoreFoundation") target_compile_options("${NAME}-au" PRIVATE "-ObjC++") target_link_libraries("${NAME}-au" PRIVATE "${NAME}-dsp" "${NAME}-ui" "${APPLE_AUDIOTOOLBOX_FRAMEWORK}" + "${APPLE_AUDIOUNIT_FRAMEWORK}" "${APPLE_COREFOUNDATION_FRAMEWORK}") set_target_properties("${NAME}-au" PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin/${NAME}.component/Contents/MacOS/$<0:>" diff --git a/distrho/src/DistrhoPluginAU.cpp b/distrho/src/DistrhoPluginAU.cpp @@ -431,15 +431,22 @@ public: return noErr; case kAudioUnitProperty_SampleRate: - #if DISTRHO_PLUGIN_NUM_INPUTS == 0 && DISTRHO_PLUGIN_NUM_OUTPUTS != 0 - DISTRHO_SAFE_ASSERT_UINT_RETURN(inScope == kAudioUnitScope_Output, inScope, kAudioUnitErr_InvalidScope); - #else - DISTRHO_SAFE_ASSERT_UINT_RETURN(inScope == kAudioUnitScope_Input || inScope == kAudioUnitScope_Output, inScope, kAudioUnitErr_InvalidScope); - #endif DISTRHO_SAFE_ASSERT_UINT_RETURN(inElement == 0, inElement, kAudioUnitErr_InvalidElement); - outDataSize = sizeof(Float64); - outWritable = true; - return noErr; + if (inScope == kAudioUnitScope_Input) + { + outDataSize = sizeof(Float64); + outWritable = true; + return noErr; + } + #if DISTRHO_PLUGIN_NUM_OUTPUTS != 0 + if (inScope == kAudioUnitScope_Output) + { + outDataSize = sizeof(Float64); + outWritable = true; + return noErr; + } + #endif + return kAudioUnitErr_InvalidScope; case kAudioUnitProperty_ParameterList: DISTRHO_SAFE_ASSERT_UINT_RETURN(inElement == 0, inElement, kAudioUnitErr_InvalidElement); @@ -1062,10 +1069,10 @@ public: return noErr; case kAudioUnitProperty_SampleRate: - #if DISTRHO_PLUGIN_NUM_INPUTS == 0 && DISTRHO_PLUGIN_NUM_OUTPUTS != 0 - DISTRHO_SAFE_ASSERT_UINT_RETURN(inScope == kAudioUnitScope_Output, inScope, kAudioUnitErr_InvalidScope); - #else + #if DISTRHO_PLUGIN_NUM_OUTPUTS != 0 DISTRHO_SAFE_ASSERT_UINT_RETURN(inScope == kAudioUnitScope_Input || inScope == kAudioUnitScope_Output, inScope, kAudioUnitErr_InvalidScope); + #else + DISTRHO_SAFE_ASSERT_UINT_RETURN(inScope == kAudioUnitScope_Input, inScope, kAudioUnitErr_InvalidScope); #endif DISTRHO_SAFE_ASSERT_UINT_RETURN(inElement == 0, inElement, kAudioUnitErr_InvalidElement); DISTRHO_SAFE_ASSERT_UINT_RETURN(inDataSize == sizeof(Float64), inDataSize, kAudioUnitErr_InvalidPropertyValue); @@ -1113,10 +1120,10 @@ public: return kAudioUnitErr_InvalidScope; case kAudioUnitProperty_StreamFormat: - #if DISTRHO_PLUGIN_NUM_INPUTS == 0 && DISTRHO_PLUGIN_NUM_OUTPUTS != 0 - DISTRHO_SAFE_ASSERT_UINT_RETURN(inScope == kAudioUnitScope_Output, inScope, kAudioUnitErr_InvalidScope); - #else + #if DISTRHO_PLUGIN_NUM_OUTPUTS != 0 DISTRHO_SAFE_ASSERT_UINT_RETURN(inScope == kAudioUnitScope_Input || inScope == kAudioUnitScope_Output, inScope, kAudioUnitErr_InvalidScope); + #else + DISTRHO_SAFE_ASSERT_UINT_RETURN(inScope == kAudioUnitScope_Input, inScope, kAudioUnitErr_InvalidScope); #endif DISTRHO_SAFE_ASSERT_UINT_RETURN(inElement == 0, inElement, kAudioUnitErr_InvalidElement); DISTRHO_SAFE_ASSERT_UINT_RETURN(inDataSize == sizeof(AudioStreamBasicDescription), inDataSize, kAudioUnitErr_InvalidPropertyValue);