From 2540c807d858404dceb2c1217b0f8ef580691053 Mon Sep 17 00:00:00 2001 From: attila Date: Tue, 4 Jun 2024 17:34:16 +0200 Subject: [PATCH] WebViewPluginDemo: Implement AudioProcessorEditor::getControlParameterIndex --- examples/Plugins/WebViewPluginDemo.h | 8 +++++ .../Plugins/WebViewPluginDemoGUI/src/App.js | 32 +++++++++++++++++-- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/examples/Plugins/WebViewPluginDemo.h b/examples/Plugins/WebViewPluginDemo.h index 04d58bded3..17a9f36b60 100644 --- a/examples/Plugins/WebViewPluginDemo.h +++ b/examples/Plugins/WebViewPluginDemo.h @@ -405,6 +405,11 @@ public: void paint (Graphics&) override; void resized() override; + int getControlParameterIndex (Component&) override + { + return controlParameterIndexReceiver.getControlParameterIndex(); + } + void timerCallback() override { static constexpr size_t numFramesBuffered = 5; @@ -437,6 +442,8 @@ private: WebToggleButtonRelay muteToggleRelay { webComponent, "muteToggle" }; WebComboBoxRelay filterTypeComboRelay { webComponent, "filterTypeCombo" }; + WebControlParameterIndexReceiver controlParameterIndexReceiver; + SinglePageBrowser webComponent { WebBrowserComponent::Options{} .withBackend (WebBrowserComponent::Options::Backend::webview2) .withWinWebView2Options (WebBrowserComponent::Options::WinWebView2{} @@ -445,6 +452,7 @@ private: .withOptionsFrom (cutoffSliderRelay) .withOptionsFrom (muteToggleRelay) .withOptionsFrom (filterTypeComboRelay) + .withOptionsFrom (controlParameterIndexReceiver) .withNativeFunction ("sayHello", [](auto& var, auto complete) { complete ("Hello " + var[0].toString()); diff --git a/examples/Plugins/WebViewPluginDemoGUI/src/App.js b/examples/Plugins/WebViewPluginDemoGUI/src/App.js index 0caad2c58b..c428eaa9ac 100644 --- a/examples/Plugins/WebViewPluginDemoGUI/src/App.js +++ b/examples/Plugins/WebViewPluginDemoGUI/src/App.js @@ -50,6 +50,9 @@ import * as Juce from "juce-framework-frontend"; import "./App.css"; +// Custom attributes in React must be in all lower case +const controlParameterIndexAnnotation = "controlparameterindex"; + function JuceSlider({ identifier, title }) { JuceSlider.propTypes = { identifier: PropTypes.string, @@ -94,7 +97,12 @@ function JuceSlider({ identifier, title }) { } return ( - + {properties.name}: {sliderState.getScaledValue()} {properties.label} @@ -146,7 +154,12 @@ function JuceCheckbox({ identifier }) { const cb = ; return ( - + @@ -185,7 +198,12 @@ function JuceComboBox({ identifier }) { }); return ( - + {properties.name}