Skip to content

Commit

Permalink
AU: always allow to set input element rate, fix build
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <[email protected]>
  • Loading branch information
falkTX committed Feb 26, 2024
1 parent d5f3a2b commit adc561b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 17 deletions.
4 changes: 1 addition & 3 deletions Makefile.plugins.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions cmake/DPF-plugin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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:>"
Expand Down
35 changes: 21 additions & 14 deletions distrho/src/DistrhoPluginAU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,15 +431,22 @@ class PluginAU
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);
Expand Down Expand Up @@ -1062,10 +1069,10 @@ class PluginAU
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);
Expand Down Expand Up @@ -1113,10 +1120,10 @@ class PluginAU
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);
Expand Down

0 comments on commit adc561b

Please sign in to comment.