Mema
Memory Matrix — multi-channel audio matrix monitor and router
Loading...
Searching...
No Matches
PluginControlComponent.h
Go to the documentation of this file.
1/* Copyright (c) 2026, Christian Ahrens
2 *
3 * This file is part of Mema <https://github.com/ChristianAhrens/Mema>
4 *
5 * This tool is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU Lesser General Public License version 3.0 as published
7 * by the Free Software Foundation.
8 *
9 * This tool is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12 * details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this tool; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19#pragma once
20
21#include <JuceHeader.h>
22
24
26
27
31namespace JUCEAppBasics
32{
33 class ToggleStateSlider;
34}
35
36namespace Mema
37{
38
39
42{
43public:
46
47 //==============================================================================
48 void paint(Graphics&) override;
49 void resized() override;
50 void lookAndFeelChanged() override;
51
52 //==============================================================================
53 void resetCtrl() override;
54
55 //==============================================================================
56 void setControlsSize(const ControlsSize& ctrlsSize) override;
57
58 //==============================================================================
59 const std::string& getPluginName();
60 void setPluginName(const std::string& pluginName);
61
62 const std::vector<Mema::PluginParameterInfo>& getParameterInfos();
63 void setParameterInfos(const std::vector<Mema::PluginParameterInfo>& parameterInfos);
64
65 void setParameterValue(std::uint16_t index, std::string id, float value);
66
67 void setPluginEnabled(bool enabled);
68 void setPluginPrePost(bool post);
69
70 //==============================================================================
71 std::function<void(std::uint16_t, std::string, float)> onPluginParameterValueChanged;
72 std::function<void(bool)> onPluginEnabledChanged;
73 std::function<void(bool)> onPluginPrePostChanged;
74
75protected:
76 //==============================================================================
77 void rebuildControls();
78 void rebuildLayout();
79
80private:
81 //==============================================================================
82 std::unique_ptr<juce::Grid> m_parameterControlsGrid;
83
84 std::unique_ptr<juce::DrawableButton> m_enableButton;
85 std::unique_ptr<juce::TextButton> m_prePostButton;
86 std::unique_ptr<juce::Label> m_pluginNameLabel;
87 std::map<std::uint16_t, std::unique_ptr<juce::Label>> m_parameterNameLabels;
88 std::map<std::uint16_t, std::unique_ptr<juce::TextButton>> m_parameterValueButtons;
89 std::map<std::uint16_t, std::unique_ptr<JUCEAppBasics::ToggleStateSlider>> m_parameterValueSliders;
90 std::map<std::uint16_t, std::unique_ptr<juce::ComboBox>> m_parameterValueComboBoxes;
91
92 std::string m_pluginName;
93 std::vector<Mema::PluginParameterInfo> m_pluginParameterInfos;
94
95 juce::Rectangle<int> m_parameterBounds;
96
97 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PluginControlComponent)
98};
99
100
101}; // namespace Mema
Abstract base for all Mema.Re client control panels.
ControlsSize
Size category for rendered control elements.
std::function< void(bool)> onPluginEnabledChanged
void setControlsSize(const ControlsSize &ctrlsSize) override
std::function< void(std::uint16_t, std::string, float)> onPluginParameterValueChanged
void setParameterInfos(const std::vector< Mema::PluginParameterInfo > &parameterInfos)
void setParameterValue(std::uint16_t index, std::string id, float value)
const std::vector< Mema::PluginParameterInfo > & getParameterInfos()
std::function< void(bool)> onPluginPrePostChanged
void setPluginName(const std::string &pluginName)