Skip to content

Commit fb7dc2f

Browse files
committed
#33 Add effects control panel.
1 parent dd02cb7 commit fb7dc2f

File tree

7 files changed

+162
-2
lines changed

7 files changed

+162
-2
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ source_group(Source\\ui
131131
${CMAKE_CURRENT_SOURCE_DIR}/Source/ui/DivisionView.cpp
132132
${CMAKE_CURRENT_SOURCE_DIR}/Source/ui/GlobalTuningComponent.h
133133
${CMAKE_CURRENT_SOURCE_DIR}/Source/ui/GlobalTuningComponent.cpp
134+
${CMAKE_CURRENT_SOURCE_DIR}/Source/ui/FxComponent.h
135+
${CMAKE_CURRENT_SOURCE_DIR}/Source/ui/FxComponent.cpp
134136
${CMAKE_CURRENT_SOURCE_DIR}/Source/ui/SettingsComponent.h
135137
${CMAKE_CURRENT_SOURCE_DIR}/Source/ui/SettingsComponent.cpp
136138
${CMAKE_CURRENT_SOURCE_DIR}/Source/ui/MidiChannelsComponent.h

Resources/images/fx-hover.svg

Lines changed: 4 additions & 0 deletions
Loading

Resources/images/fx.svg

Lines changed: 4 additions & 0 deletions
Loading

Source/PluginEditor.cpp

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "aeolus/engine.h"
2121
#include "ui/CustomLookAndFeel.h"
2222
#include "ui/GlobalTuningComponent.h"
23+
#include "ui/FxComponent.h"
2324
#include "ui/SettingsComponent.h"
2425

2526
#include "PluginProcessor.h"
@@ -51,6 +52,7 @@ AeolusAudioProcessorEditor::AeolusAudioProcessorEditor (AeolusAudioProcessor& p)
5152
, _volumeLevelR{p.getEngine().getVolumeLevel().right, ui::LevelIndicator::Orientation::Horizontal}
5253
, _tuningButton{"tuningButton", DrawableButton::ImageFitted}
5354
, _settingsButton{"settingsButton", DrawableButton::ImageFitted}
55+
, _fxButton{"fxButton", DrawableButton::ImageFitted}
5456
, _mtsConnectedLabel{{}, "connected to MTS master"}
5557
, _mtsDisconnectedLabel{{}, "no MTS master found"}
5658
, _panicButton{"PANIC"}
@@ -124,6 +126,7 @@ AeolusAudioProcessorEditor::AeolusAudioProcessorEditor (AeolusAudioProcessor& p)
124126

125127
addAndMakeVisible(_tuningButton);
126128
addAndMakeVisible(_settingsButton);
129+
addAndMakeVisible(_fxButton);
127130

128131
auto loadSVG = [](const char* data, size_t size) -> std::unique_ptr<Drawable> {
129132
if (auto xml = parseXML(String::fromUTF8(data, (int)size))) {
@@ -194,7 +197,27 @@ AeolusAudioProcessorEditor::AeolusAudioProcessorEditor (AeolusAudioProcessor& p)
194197

195198
box.dismiss();
196199
};
200+
};
201+
202+
{
203+
auto normalIcon = loadSVG(BinaryData::fx_svg, BinaryData::fx_svgSize);
204+
auto hoverIcon = loadSVG(BinaryData::fxhover_svg, BinaryData::fxhover_svgSize);
205+
_fxButton.setImages(normalIcon.get(), hoverIcon.get());
206+
_fxButton.setMouseCursor(MouseCursor::PointingHandCursor);
207+
}
208+
209+
_fxButton.onClick = [this] {
210+
auto content = std::make_unique<ui::FxComponent>();
211+
content->setSize(240, 220);
212+
auto* contentPtr = content.get();
197213

214+
auto& box = CallOutBox::launchAsynchronously(std::move(content), _fxButton.getBounds(), this);
215+
contentPtr->onCancel = [&box] { box.dismiss(); };
216+
contentPtr->onOk = [&box, contentPtr] {
217+
// @todo Enable limiter and set its parameters
218+
//_audioProcessor.getEngine().setReverbWet(contentPtr->getReverbWet());
219+
box.dismiss();
220+
};
198221
};
199222

200223
addAndMakeVisible(_mtsConnectedLabel);
@@ -328,7 +351,8 @@ void AeolusAudioProcessorEditor::resized()
328351
_volumeLevelR.setBounds(_volumeSlider.getX() + 5, _volumeSlider.getY() + _volumeSlider.getHeight() - 4, _volumeSlider.getWidth() - 10, 2);
329352

330353
_tuningButton.setBounds(_volumeSlider.getRight() + 40, margin - 2, 24, 24);
331-
_settingsButton.setBounds(_tuningButton.getRight() + 20, margin - 2, 24, 24);
354+
_fxButton.setBounds(_tuningButton.getRight() + 20, margin - 2, 24, 24);
355+
_settingsButton.setBounds(_fxButton.getRight() + 20, margin - 2, 24, 24);
332356

333357
_mtsConnectedLabel.setBounds(_settingsButton.getRight() + 40, margin, 160, 20);
334358
_mtsDisconnectedLabel.setBounds(_mtsConnectedLabel.getBounds());
@@ -387,7 +411,7 @@ void AeolusAudioProcessorEditor::onUIScalingFactorChanged(float scalingPercent)
387411
const float scaling{ 1e-2f * scalingPercent };
388412

389413
setScaleFactor(scaling);
390-
414+
391415
float adjust{ scalingPercent / _uiScalingPercent };
392416

393417
comp->setSize(width * adjust, height * adjust);

Source/PluginEditor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ class AeolusAudioProcessorEditor : public juce::AudioProcessorEditor,
9696

9797
juce::DrawableButton _tuningButton;
9898
juce::DrawableButton _settingsButton;
99+
juce::DrawableButton _fxButton;
99100

100101
juce::Label _mtsConnectedLabel;
101102
juce::Label _mtsDisconnectedLabel;

Source/ui/FxComponent.cpp

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
// ----------------------------------------------------------------------------
2+
//
3+
// Copyright (C) 2025 Arthur Benilov <arthur.benilov@gmail.com>
4+
//
5+
// This program is free software; you can redistribute it and/or modify
6+
// it under the terms of the GNU General Public License as published by
7+
// the Free Software Foundation; either version 3 of the License, or
8+
// (at your option) any later version.
9+
//
10+
// This program is distributed in the hope that it will be useful,
11+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
// GNU General Public License for more details.
14+
//
15+
// You should have received a copy of the GNU General Public License
16+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
//
18+
// ----------------------------------------------------------------------------
19+
20+
#include "aeolus/engine.h"
21+
22+
#include "ui/FxComponent.h"
23+
24+
using namespace juce;
25+
26+
namespace ui {
27+
28+
FxComponent::FxComponent()
29+
: _fxLabel {{}, "Effects"}
30+
, _okButton{"OK"}
31+
, _cancelButton{"Cancel"}
32+
{
33+
auto* g = aeolus::EngineGlobal::getInstance();
34+
35+
addAndMakeVisible(_fxLabel);
36+
_fxLabel.setJustificationType(Justification::centred);
37+
_fxLabel.setColour(Label::textColourId, Colours::lightyellow);
38+
auto font = _fxLabel.getFont();
39+
font.setHeight(font.getHeight() * 1.2f);
40+
_fxLabel.setFont(font);
41+
42+
43+
addAndMakeVisible(_okButton);
44+
_okButton.onClick = [this] {
45+
if (onOk) onOk();
46+
};
47+
48+
addAndMakeVisible(_cancelButton);
49+
_cancelButton.onClick = [this] {
50+
if (onCancel) onCancel();
51+
};
52+
53+
_cancelButton.setColour(TextButton::buttonColourId, Colour(0x66, 0x66, 0x33));
54+
_okButton.setColour(TextButton::buttonColourId, Colour(0x66, 0x66, 0x33));
55+
}
56+
57+
void FxComponent::resized()
58+
{
59+
constexpr int margin = 6;
60+
61+
auto bounds = getLocalBounds();
62+
bounds.reduce(margin, margin);
63+
64+
_fxLabel.setBounds(bounds.removeFromTop(20));
65+
66+
bounds.removeFromTop(3 * margin);
67+
68+
auto row = bounds.removeFromTop(20);
69+
70+
row = bounds.removeFromBottom(20);
71+
_cancelButton.setBounds(row.removeFromRight(60));
72+
row.removeFromRight(margin);
73+
_okButton.setBounds(row.removeFromRight(60));
74+
}
75+
76+
77+
} // namespace ui

Source/ui/FxComponent.h

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// ----------------------------------------------------------------------------
2+
//
3+
// Copyright (C) 2025 Arthur Benilov <arthur.benilov@gmail.com>
4+
//
5+
// This program is free software; you can redistribute it and/or modify
6+
// it under the terms of the GNU General Public License as published by
7+
// the Free Software Foundation; either version 3 of the License, or
8+
// (at your option) any later version.
9+
//
10+
// This program is distributed in the hope that it will be useful,
11+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
// GNU General Public License for more details.
14+
//
15+
// You should have received a copy of the GNU General Public License
16+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
//
18+
// ----------------------------------------------------------------------------
19+
20+
#pragma once
21+
22+
#include <functional>
23+
#include "aeolus/globals.h"
24+
25+
namespace ui {
26+
27+
/**
28+
* Effects component (shown in a callout box when clicking the effects button).
29+
*/
30+
class FxComponent : public juce::Component
31+
{
32+
public:
33+
FxComponent();
34+
35+
void resized() override;
36+
37+
std::function<void()> onOk{};
38+
std::function<void()> onCancel{};
39+
40+
private:
41+
42+
juce::Label _fxLabel;
43+
44+
juce::TextButton _okButton;
45+
juce::TextButton _cancelButton;
46+
};
47+
48+
} // namespace ui

0 commit comments

Comments
 (0)