Skip to content

Commit

Permalink
implement parameter update notification.
Browse files Browse the repository at this point in the history
context: atsushieno/aap-core#130

Though aap-juce-byod does not seem to receive parameterInfoUpdated.
What it receives is programChanged when we change the preset selection.
  • Loading branch information
atsushieno committed Feb 16, 2024
1 parent f99ed5b commit 0600003
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion aap-modules/aap_audio_processors/juceaap_AAPWrappers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -87,6 +87,8 @@ class JuceAAPWrapper : juce::AudioPlayHead {
juce_processor = createPluginFilter();

buildParameterList();

juce_processor->addListener(this);
}

virtual ~JuceAAPWrapper() {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 0600003

Please sign in to comment.