From 808d4fea316aa5fda1909a49a2341cad265b3b66 Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 26 Feb 2024 00:58:11 +0100 Subject: [PATCH] Cleanup some AU details Signed-off-by: falkTX --- distrho/src/DistrhoPluginAU.cpp | 22 ++++++++++++++-------- distrho/src/DistrhoPluginLV2export.cpp | 4 +++- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/distrho/src/DistrhoPluginAU.cpp b/distrho/src/DistrhoPluginAU.cpp index c060d512..a774f751 100644 --- a/distrho/src/DistrhoPluginAU.cpp +++ b/distrho/src/DistrhoPluginAU.cpp @@ -270,6 +270,10 @@ public: } } + std::memset(&fInputRenderCallback, 0, sizeof(fInputRenderCallback)); + fInputRenderCallback.inputProc = nullptr; + fInputRenderCallback.inputProcRefCon = nullptr; + #if DISTRHO_PLUGIN_WANT_MIDI_INPUT std::memset(&fMidiEvents, 0, sizeof(fMidiEvents)); #endif @@ -634,6 +638,7 @@ public: case kAudioUnitProperty_AudioChannelLayout: case kAudioUnitProperty_TailTime: case kAudioUnitProperty_SupportedChannelLayoutTags: + case kMusicDeviceProperty_DualSchedulingMode: DISTRHO_SAFE_ASSERT_UINT_RETURN(inElement == 0, inElement, kAudioUnitErr_InvalidElement); return kAudioUnitErr_InvalidProperty; } @@ -833,10 +838,8 @@ public: return noErr; case kAudioUnitProperty_SetRenderCallback: - d_stdout("WIP GetProperty(%d:%x:%s, %d:%s, %d, ...)", - inProp, inProp, AudioUnitPropertyID2Str(inProp), inScope, AudioUnitScope2Str(inScope), inElement); - // TODO - break; + std::memcpy(outData, &fInputRenderCallback, sizeof(AURenderCallbackStruct)); + return noErr; #if DISTRHO_PLUGIN_WANT_PROGRAMS case kAudioUnitProperty_FactoryPresets: @@ -1170,9 +1173,7 @@ public: DISTRHO_SAFE_ASSERT_UINT_RETURN(inScope == kAudioUnitScope_Input, inScope, kAudioUnitErr_InvalidScope); DISTRHO_SAFE_ASSERT_UINT_RETURN(inElement == 0, inElement, kAudioUnitErr_InvalidElement); DISTRHO_SAFE_ASSERT_UINT_RETURN(inDataSize == sizeof(AURenderCallbackStruct), inDataSize, kAudioUnitErr_InvalidPropertyValue); - d_stdout("WIP SetProperty(%d:%x:%s, %d:%s, %d, %p, %u)", - inProp, inProp, AudioUnitPropertyID2Str(inProp), inScope, AudioUnitScope2Str(inScope), inElement, inData, inDataSize); - // TODO + std::memcpy(&fInputRenderCallback, inData, sizeof(AURenderCallbackStruct)); return noErr; case kAudioUnitProperty_HostCallbacks: @@ -1229,10 +1230,10 @@ public: return noErr; case kAudioUnitProperty_MIDIOutputCallback: - #if DISTRHO_PLUGIN_WANT_MIDI_OUTPUT DISTRHO_SAFE_ASSERT_UINT_RETURN(inScope == kAudioUnitScope_Global, inScope, kAudioUnitErr_InvalidScope); DISTRHO_SAFE_ASSERT_UINT_RETURN(inElement == 0, inElement, kAudioUnitErr_InvalidElement); DISTRHO_SAFE_ASSERT_UINT_RETURN(inDataSize == sizeof(AUMIDIOutputCallbackStruct), inDataSize, kAudioUnitErr_InvalidPropertyValue); + #if DISTRHO_PLUGIN_WANT_MIDI_OUTPUT std::memcpy(&fMidiOutput, inData, sizeof(AUMIDIOutputCallbackStruct)); return noErr; #else @@ -1362,6 +1363,10 @@ public: #else return kAudioUnitErr_PropertyNotInUse; #endif + + // unwanted properties + case kMusicDeviceProperty_DualSchedulingMode: + return kAudioUnitErr_InvalidProperty; } d_stdout("TODO SetProperty(%d:%x:%s, %d:%s, %d, %p, %u)", @@ -1662,6 +1667,7 @@ private: // AUv2 related fields OSStatus fLastRenderError; PropertyListeners fPropertyListeners; + AURenderCallbackStruct fInputRenderCallback; Float64 fSampleRateForInput; #if DISTRHO_PLUGIN_NUM_OUTPUTS != 0 Float64 fSampleRateForOutput; diff --git a/distrho/src/DistrhoPluginLV2export.cpp b/distrho/src/DistrhoPluginLV2export.cpp index 2295fca7..5ae01fbd 100644 --- a/distrho/src/DistrhoPluginLV2export.cpp +++ b/distrho/src/DistrhoPluginLV2export.cpp @@ -1003,8 +1003,10 @@ void lv2_generate_ttl(const char* const basename) { const String license(plugin.getLicense()); + if (license.isEmpty()) + {} // Using URL as license - if (license.contains("://")) + else if (license.contains("://")) { pluginString += " doap:license <" + license + "> ;\n\n"; }