Mema
Memory Matrix — multi-channel audio matrix monitor and router
Loading...
Searching...
No Matches
MemaReComponent.h
Go to the documentation of this file.
1/* Copyright (c) 2025, 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
26
28
58class MemaReComponent : public juce::Component, juce::MessageListener
59{
60public:
68
69public:
71 ~MemaReComponent() override;
72
76 void setOutputPanningCtrlActive(const juce::AudioChannelSet& channelConfiguration);
80 void resetCtrl();
81
86
88 void setExternalAdmOscSettings(const int ADMOSCport, const juce::IPAddress& ADMOSCremoteIP, const int ADMOSCremotePort);
90 std::tuple<int, juce::IPAddress, int> getExternalAdmOscSettings();
91
92 //==============================================================================
94 void resized() override;
96 void paint(juce::Graphics& g) override;
97
98 //==============================================================================
100 void handleMessage(const Message& message) override;
101
102 //==============================================================================
103 std::function<void()> onExitClick;
104 std::function<void(const juce::MemoryBlock&)> onMessageReadyToSend;
105
106private:
107 //==============================================================================
108 std::unique_ptr<Mema::FaderbankControlComponent> m_faderbankCtrlComponent;
109 std::unique_ptr<Mema::PanningControlComponent> m_panningCtrlComponent;
110 std::unique_ptr<Mema::PluginControlComponent> m_pluginCtrlComponent;
111
112 //==============================================================================
113 RunningStatus m_runningStatus = RunningStatus::Inactive;
114 static constexpr int sc_connectionTimeout = 5000;
115
116 std::pair<int, int> m_currentIOCount = { 0, 0 };
117 std::map<std::uint16_t, bool> m_inputMuteStates = {};
118 std::map<std::uint16_t, bool> m_outputMuteStates = {};
119 std::map<std::uint16_t, std::map<std::uint16_t, bool>> m_crosspointStates = {};
120 std::map<std::uint16_t, std::map<std::uint16_t, float>> m_crosspointValues = {};
121
122 std::tuple<int, juce::IPAddress, int> m_externalAdmOscSettings = { 4001, juce::IPAddress::local(), 4002 };
123
124 float m_ioRatio = 0.5f;
125
126 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MemaReComponent)
127};
128
Central remote-control panel of the Mema.Re application.
~MemaReComponent() override
std::function< void()> onExitClick
Invoked when the user triggers a disconnection.
void resized() override
Lays out the active control component to fill the available area.
const Mema::FaderbankControlComponent::ControlsSize getControlsSize()
Returns the current control-element size setting.
void resetCtrl()
Resets all control components to their default/empty state.
RunningStatus
Lifecycle state of the remote-control panel driven by the network connection status.
@ Standby
Connection established but no state snapshot received yet.
@ Active
Actively receiving and sending control data to/from Mema.
@ Inactive
No TCP connection; component renders a placeholder.
void setOutputPanningCtrlActive(const juce::AudioChannelSet &channelConfiguration)
Switches to the 2-D spatial panning control for the given speaker layout.
void handleMessage(const Message &message) override
Dispatches inbound network messages to the appropriate control component.
void paint(juce::Graphics &g) override
Paints the background when no control mode is active.
void setFaderbankCtrlActive()
Switches to the faderbank (crosspoint slider/mute matrix) control mode.
void setPluginCtrlActive()
Switches to the plugin-parameter control mode.
void setControlsSize(const Mema::FaderbankControlComponent::ControlsSize &ctrlsSize)
Propagates a control-element size change (S/M/L) to the faderbank component.
void setExternalAdmOscSettings(const int ADMOSCport, const juce::IPAddress &ADMOSCremoteIP, const int ADMOSCremotePort)
Configures the ADM-OSC listener port and the remote-controller address used by the panning component.
std::function< void(const juce::MemoryBlock &)> onMessageReadyToSend
Invoked with a serialised message whenever a control value changes that must be sent to Mema.
std::tuple< int, juce::IPAddress, int > getExternalAdmOscSettings()
Returns the current ADM-OSC settings as {listenPort, remoteIP, remotePort}.
ControlsSize
Size category for rendered control elements.