From abad00a3080a0a1f2ceb43ef5d94c36dcb7347bb Mon Sep 17 00:00:00 2001 From: James Ball Date: Wed, 31 Jan 2024 17:08:00 +0000 Subject: [PATCH] Add button to open Audio/MIDI settings from MIDI section --- Source/MidiComponent.cpp | 10 ++++++++++ Source/MidiComponent.h | 1 + 2 files changed, 11 insertions(+) diff --git a/Source/MidiComponent.cpp b/Source/MidiComponent.cpp index 4e1861c..6ce5ee5 100644 --- a/Source/MidiComponent.cpp +++ b/Source/MidiComponent.cpp @@ -38,6 +38,13 @@ MidiComponent::MidiComponent(OscirenderAudioProcessor& p, OscirenderAudioProcess envelope.addListener(&audioProcessor); envelope.setGrid(EnvelopeComponent::GridBoth, EnvelopeComponent::GridNone, 0.1, 0.25); + if (juce::JUCEApplicationBase::isStandaloneApp()) { + addAndMakeVisible(midiSettingsButton); + midiSettingsButton.onClick = [this]() { + pluginEditor.openAudioSettings(); + }; + } + audioProcessor.attackTime->addListener(this); audioProcessor.attackLevel->addListener(this); audioProcessor.attackShape->addListener(this); @@ -105,6 +112,9 @@ void MidiComponent::resized() { midiToggle.setBounds(topRow.removeFromLeft(120)); topRow.removeFromLeft(80); voicesSlider.setBounds(topRow.removeFromLeft(250)); + if (midiSettingsButton.isVisible()) { + midiSettingsButton.setBounds(topRow.removeFromRight(160)); + } area.removeFromTop(5); keyboard.setBounds(area.removeFromBottom(50)); envelope.setBounds(area); diff --git a/Source/MidiComponent.h b/Source/MidiComponent.h index 3469967..ff272b1 100644 --- a/Source/MidiComponent.h +++ b/Source/MidiComponent.h @@ -22,6 +22,7 @@ private: juce::ToggleButton midiToggle{"Enable MIDI"}; juce::Slider voicesSlider; juce::Label voicesLabel; + juce::TextButton midiSettingsButton{"Audio/MIDI Settings..."}; juce::MidiKeyboardComponent keyboard{audioProcessor.keyboardState, juce::MidiKeyboardComponent::horizontalKeyboard}; EnvelopeContainerComponent envelope;