mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-09 23:34:20 +00:00
WebViewPluginDemo: Implement AudioProcessorEditor::getControlParameterIndex
This commit is contained in:
parent
3339843f66
commit
2540c807d8
2 changed files with 37 additions and 3 deletions
|
|
@ -405,6 +405,11 @@ public:
|
||||||
void paint (Graphics&) override;
|
void paint (Graphics&) override;
|
||||||
void resized() override;
|
void resized() override;
|
||||||
|
|
||||||
|
int getControlParameterIndex (Component&) override
|
||||||
|
{
|
||||||
|
return controlParameterIndexReceiver.getControlParameterIndex();
|
||||||
|
}
|
||||||
|
|
||||||
void timerCallback() override
|
void timerCallback() override
|
||||||
{
|
{
|
||||||
static constexpr size_t numFramesBuffered = 5;
|
static constexpr size_t numFramesBuffered = 5;
|
||||||
|
|
@ -437,6 +442,8 @@ private:
|
||||||
WebToggleButtonRelay muteToggleRelay { webComponent, "muteToggle" };
|
WebToggleButtonRelay muteToggleRelay { webComponent, "muteToggle" };
|
||||||
WebComboBoxRelay filterTypeComboRelay { webComponent, "filterTypeCombo" };
|
WebComboBoxRelay filterTypeComboRelay { webComponent, "filterTypeCombo" };
|
||||||
|
|
||||||
|
WebControlParameterIndexReceiver controlParameterIndexReceiver;
|
||||||
|
|
||||||
SinglePageBrowser webComponent { WebBrowserComponent::Options{}
|
SinglePageBrowser webComponent { WebBrowserComponent::Options{}
|
||||||
.withBackend (WebBrowserComponent::Options::Backend::webview2)
|
.withBackend (WebBrowserComponent::Options::Backend::webview2)
|
||||||
.withWinWebView2Options (WebBrowserComponent::Options::WinWebView2{}
|
.withWinWebView2Options (WebBrowserComponent::Options::WinWebView2{}
|
||||||
|
|
@ -445,6 +452,7 @@ private:
|
||||||
.withOptionsFrom (cutoffSliderRelay)
|
.withOptionsFrom (cutoffSliderRelay)
|
||||||
.withOptionsFrom (muteToggleRelay)
|
.withOptionsFrom (muteToggleRelay)
|
||||||
.withOptionsFrom (filterTypeComboRelay)
|
.withOptionsFrom (filterTypeComboRelay)
|
||||||
|
.withOptionsFrom (controlParameterIndexReceiver)
|
||||||
.withNativeFunction ("sayHello", [](auto& var, auto complete)
|
.withNativeFunction ("sayHello", [](auto& var, auto complete)
|
||||||
{
|
{
|
||||||
complete ("Hello " + var[0].toString());
|
complete ("Hello " + var[0].toString());
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,9 @@ import * as Juce from "juce-framework-frontend";
|
||||||
|
|
||||||
import "./App.css";
|
import "./App.css";
|
||||||
|
|
||||||
|
// Custom attributes in React must be in all lower case
|
||||||
|
const controlParameterIndexAnnotation = "controlparameterindex";
|
||||||
|
|
||||||
function JuceSlider({ identifier, title }) {
|
function JuceSlider({ identifier, title }) {
|
||||||
JuceSlider.propTypes = {
|
JuceSlider.propTypes = {
|
||||||
identifier: PropTypes.string,
|
identifier: PropTypes.string,
|
||||||
|
|
@ -94,7 +97,12 @@ function JuceSlider({ identifier, title }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box
|
||||||
|
{...{
|
||||||
|
[controlParameterIndexAnnotation]:
|
||||||
|
sliderState.properties.parameterIndex,
|
||||||
|
}}
|
||||||
|
>
|
||||||
<Typography sx={{ mt: 1.5 }}>
|
<Typography sx={{ mt: 1.5 }}>
|
||||||
{properties.name}: {sliderState.getScaledValue()} {properties.label}
|
{properties.name}: {sliderState.getScaledValue()} {properties.label}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
@ -146,7 +154,12 @@ function JuceCheckbox({ identifier }) {
|
||||||
const cb = <Checkbox checked={value} onChange={handleChange} />;
|
const cb = <Checkbox checked={value} onChange={handleChange} />;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box
|
||||||
|
{...{
|
||||||
|
[controlParameterIndexAnnotation]:
|
||||||
|
checkboxState.properties.parameterIndex,
|
||||||
|
}}
|
||||||
|
>
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
<FormControlLabel control={cb} label={properties.name} />
|
<FormControlLabel control={cb} label={properties.name} />
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
@ -185,7 +198,12 @@ function JuceComboBox({ identifier }) {
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box
|
||||||
|
{...{
|
||||||
|
[controlParameterIndexAnnotation]:
|
||||||
|
comboBoxState.properties.parameterIndex,
|
||||||
|
}}
|
||||||
|
>
|
||||||
<FormControl fullWidth>
|
<FormControl fullWidth>
|
||||||
<InputLabel id={identifier}>{properties.name}</InputLabel>
|
<InputLabel id={identifier}>{properties.name}</InputLabel>
|
||||||
<Select
|
<Select
|
||||||
|
|
@ -360,6 +378,14 @@ function FreqBandInfo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
|
const controlParameterIndexUpdater = new Juce.ControlParameterIndexUpdater(
|
||||||
|
controlParameterIndexAnnotation
|
||||||
|
);
|
||||||
|
|
||||||
|
document.addEventListener("mousemove", (event) => {
|
||||||
|
controlParameterIndexUpdater.handleMouseMove(event);
|
||||||
|
});
|
||||||
|
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
const [snackbarMessage, setMessage] = useState("No message received yet");
|
const [snackbarMessage, setMessage] = useState("No message received yet");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue