From fe9b6c233db1e15638d573696cc155ca6aa7ce2f Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 5 Sep 2022 19:13:20 +0100 Subject: [PATCH] Fix previous commit, only use 1 audio port in clap for now --- cmake/DPF-plugin.cmake | 8 ++++---- distrho/src/DistrhoPluginCLAP.cpp | 23 +++++++++++------------ distrho/src/DistrhoPluginVST3.cpp | 2 +- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/cmake/DPF-plugin.cmake b/cmake/DPF-plugin.cmake index 858c49c8..e0f8edf1 100644 --- a/cmake/DPF-plugin.cmake +++ b/cmake/DPF-plugin.cmake @@ -336,9 +336,9 @@ function(dpf__build_vst2 NAME DGL_LIBRARY) OUTPUT_NAME "${NAME}" SUFFIX "") set(INFO_PLIST_PROJECT_NAME "${NAME}") - configure_file("${DPF_ROOT_DIR}/utils/plugin.vst/Contents/Info.plist" + configure_file("${DPF_ROOT_DIR}/utils/plugin.bundle/Contents/Info.plist" "${PROJECT_BINARY_DIR}/bin/${NAME}.vst/Contents/Info.plist" @ONLY) - file(COPY "${DPF_ROOT_DIR}/utils/plugin.vst/Contents/PkgInfo" + file(COPY "${DPF_ROOT_DIR}/utils/plugin.bundle/Contents/PkgInfo" DESTINATION "${PROJECT_BINARY_DIR}/bin/${NAME}.vst/Contents") endif() endfunction() @@ -425,9 +425,9 @@ function(dpf__build_vst3 NAME DGL_LIBRARY) if(APPLE) # Uses the same macOS bundle template as VST2 set(INFO_PLIST_PROJECT_NAME "${NAME}") - configure_file("${DPF_ROOT_DIR}/utils/plugin.vst/Contents/Info.plist" + configure_file("${DPF_ROOT_DIR}/utils/plugin.bundle/Contents/Info.plist" "${PROJECT_BINARY_DIR}/bin/${NAME}.vst3/Contents/Info.plist" @ONLY) - file(COPY "${DPF_ROOT_DIR}/utils/plugin.vst/Contents/PkgInfo" + file(COPY "${DPF_ROOT_DIR}/utils/plugin.bundle/Contents/PkgInfo" DESTINATION "${PROJECT_BINARY_DIR}/bin/${NAME}.vst3/Contents") endif() endfunction() diff --git a/distrho/src/DistrhoPluginCLAP.cpp b/distrho/src/DistrhoPluginCLAP.cpp index 881dad57..83afbb72 100644 --- a/distrho/src/DistrhoPluginCLAP.cpp +++ b/distrho/src/DistrhoPluginCLAP.cpp @@ -177,17 +177,17 @@ public: if (const uint32_t frames = process->frames_count) { - DISTRHO_SAFE_ASSERT_UINT2_RETURN(process->audio_inputs_count == DISTRHO_PLUGIN_NUM_INPUTS, - process->audio_inputs_count, DISTRHO_PLUGIN_NUM_INPUTS, false); - DISTRHO_SAFE_ASSERT_UINT2_RETURN(process->audio_outputs_count == DISTRHO_PLUGIN_NUM_OUTPUTS, - process->audio_outputs_count, DISTRHO_PLUGIN_NUM_OUTPUTS, false); - // TODO multi-port bus stuff + DISTRHO_SAFE_ASSERT_UINT_RETURN(process->audio_inputs_count == 0 || process->audio_inputs_count == 1, + process->audio_inputs_count, false); + DISTRHO_SAFE_ASSERT_UINT_RETURN(process->audio_outputs_count == 0 || process->audio_outputs_count == 1, + process->audio_outputs_count, false); + const float** inputs = process->audio_inputs != nullptr - ? const_cast(process->audio_inputs->data32) + ? const_cast(process->audio_inputs[0].data32) : nullptr; /**/ float** outputs = process->audio_outputs != nullptr - ? process->audio_inputs->data32 + ? process->audio_outputs[0].data32 : nullptr; fOutputEvents = process->out_events; @@ -266,7 +266,7 @@ static ScopedPointer sPlugin; static uint32_t clap_plugin_audio_ports_count(const clap_plugin_t*, const bool is_input) { - return is_input ? DISTRHO_PLUGIN_NUM_INPUTS : DISTRHO_PLUGIN_NUM_OUTPUTS; + return (is_input ? DISTRHO_PLUGIN_NUM_INPUTS : DISTRHO_PLUGIN_NUM_OUTPUTS) != 0 ? 1 : 0; } static bool clap_plugin_audio_ports_get(const clap_plugin_t*, @@ -277,6 +277,7 @@ static bool clap_plugin_audio_ports_get(const clap_plugin_t*, const uint32_t maxPortCount = is_input ? DISTRHO_PLUGIN_NUM_INPUTS : DISTRHO_PLUGIN_NUM_OUTPUTS; DISTRHO_SAFE_ASSERT_UINT2_RETURN(index < maxPortCount, index, maxPortCount, false); + // TODO use groups AudioPortWithBusId& audioPort(sPlugin->getAudioPort(is_input, index)); info->id = index; @@ -290,10 +291,8 @@ static bool clap_plugin_audio_ports_get(const clap_plugin_t*, // info->port_type = audioPort.hints & kAudioPortIsCV ? CLAP_PORT_CV : nullptr; info->port_type = nullptr; - info->in_place_pair = index < (is_input ? DISTRHO_PLUGIN_NUM_OUTPUTS : DISTRHO_PLUGIN_NUM_INPUTS) - ? index - : CLAP_INVALID_ID; - + info->in_place_pair = DISTRHO_PLUGIN_NUM_INPUTS == DISTRHO_PLUGIN_NUM_OUTPUTS ? index : CLAP_INVALID_ID; + return true; } diff --git a/distrho/src/DistrhoPluginVST3.cpp b/distrho/src/DistrhoPluginVST3.cpp index a49a0d00..7ce39b80 100644 --- a/distrho/src/DistrhoPluginVST3.cpp +++ b/distrho/src/DistrhoPluginVST3.cpp @@ -4952,7 +4952,7 @@ bool EXITFNNAME(void); bool EXITFNNAME(void) { - sPlugin = nullptr; + DISTRHO_NAMESPACE::sPlugin = nullptr; return true; }