From 0600003a37f2bd9e35d346b628129142c70fded9 Mon Sep 17 00:00:00 2001 From: Atsushi Eno Date: Fri, 16 Feb 2024 16:11:24 +0900 Subject: [PATCH] implement parameter update notification. context: https://github.com/atsushieno/aap-core/issues/130 Though aap-juce-byod does not seem to receive parameterInfoUpdated. What it receives is programChanged when we change the preset selection. --- .../aap_audio_processors/juceaap_AAPWrappers.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/aap-modules/aap_audio_processors/juceaap_AAPWrappers.cpp b/aap-modules/aap_audio_processors/juceaap_AAPWrappers.cpp index 1b809d8..4148d0d 100644 --- a/aap-modules/aap_audio_processors/juceaap_AAPWrappers.cpp +++ b/aap-modules/aap_audio_processors/juceaap_AAPWrappers.cpp @@ -39,7 +39,7 @@ extern "C" { int juce_aap_wrapper_last_error_code{0}; } // IF exists JUCE MIDI input buffer -> AAP MIDI input port nIn+nOut // IF exists JUCE MIDI output buffer -> AAP MIDI output port last -class JuceAAPWrapper : juce::AudioPlayHead { +class JuceAAPWrapper : juce::AudioPlayHead, juce::AudioProcessorListener { AndroidAudioPlugin *aap; const char *plugin_unique_id; int sample_rate; @@ -87,6 +87,8 @@ class JuceAAPWrapper : juce::AudioPlayHead { juce_processor = createPluginFilter(); buildParameterList(); + + juce_processor->addListener(this); } virtual ~JuceAAPWrapper() { @@ -187,6 +189,17 @@ class JuceAAPWrapper : juce::AudioPlayHead { } } + // juce::AudioProcessorListener implementation + void audioProcessorParameterChanged(juce::AudioProcessor* processor, int parameterIndex, float newValue) override { + } + void audioProcessorChanged(juce::AudioProcessor* processor, const juce::AudioProcessorListener::ChangeDetails &details) override { + if (details.parameterInfoChanged) { + auto ext = (aap_parameters_host_extension_t *) host.get_extension(&host, AAP_PARAMETERS_EXTENSION_URI); + if (ext) + ext->notify_parameters_changed(ext, &host); + } + } + void allocateBuffer(aap_buffer_t *aapBuffer) { if (!aapBuffer) { errno = juce_aap_wrapper_last_error_code = JUCEAAP_ERROR_INVALID_BUFFER;