21#include <JuceHeader.h>
25#include <ServiceTopologyManager.h>
62 public MemaMoAppConfiguration::Dumper,
63 public MemaMoAppConfiguration::Watcher
118 void paint(juce::Graphics&
g)
override;
153 class InterprocessConnectionImpl :
public juce::InterprocessConnection
156 InterprocessConnectionImpl() : juce::InterprocessConnection() {};
157 virtual ~InterprocessConnectionImpl() {
disconnect(); };
160 void connectionMade()
override {
if (onConnectionMade) onConnectionMade(); };
163 void connectionLost()
override {
if (onConnectionLost) onConnectionLost(); };
176 bool RetryConnectToSocket() {
181 std::function<
void()> onConnectionMade;
182 std::function<
void()> onConnectionLost;
186 juce::String m_hostName;
187 int m_portNumber = 0;
191 void handleSettingsMenuResult(
int selectedId);
192 void handleSettingsLookAndFeelMenuResult(
int selectedId);
193 void handleSettingsOutputVisuTypeMenuResult(
int selectedId);
194 void handleSettingsMeteringColourMenuResult(
int selectedId);
195 void handleSettingsFullscreenModeToggleResult();
198 void applyMeteringColour();
200 void toggleFullscreenMode();
202 std::optional<int> getNumVisibleChannels();
204 void setStatus(
const Status&
s);
207 void connectToMema();
210 JUCEAppBasics::SessionMasterAwareService m_selectedService;
211 std::unique_ptr<InterprocessConnectionImpl> m_networkConnection;
213 std::unique_ptr<MemaMoComponent> m_monitorComponent;
214 std::unique_ptr<MemaClientDiscoverComponent> m_discoverComponent;
215 std::unique_ptr<MemaClientConnectingComponent> m_connectingComponent;
217 std::unique_ptr<juce::DrawableButton> m_settingsButton;
218 std::map<int, std::pair<std::string, int>> m_settingsItems;
219 int m_settingsHostLookAndFeelId = -1;
221 std::unique_ptr<juce::DrawableButton> m_disconnectButton;
223 std::unique_ptr<juce::DrawableButton> m_aboutButton;
224 std::unique_ptr<AboutComponent> m_aboutComponent;
226 Status m_currentStatus = Status::Discovering;
228 juce::Colour m_meteringColour = juce::Colours::forestgreen;
230 std::unique_ptr<MemaMoAppConfiguration> m_config;
Top-level application component for Mema.Mo (MenubarMatrixMonitor).
void paint(juce::Graphics &g) override
Paints the background and any status overlay.
void performConfigurationDump() override
Serialises the current configuration to the XML file on disk.
std::function< void(int, bool)> onPaletteStyleChange
Called when the user changes the look-and-feel or metering colour.
void resized() override
Lays out the active child component to fill the window.
MemaMoSettingsOption
Identifiers for all user-configurable settings exposed via the settings popup menu.
@ OutputVisuType_LRS
3-channel Left/Right/Surround 2-D field.
@ OutputVisuType_5point0
5.0 surround 2-D field.
@ OutputVisuType_LCRS
4-channel LCRS 2-D field.
@ OutputVisuType_Waveform
Scrolling waveform plot.
@ OutputVisuType_Spectrum
FFT frequency-spectrum display.
@ OutputVisuType_Meterbridge
Level-bar meterbridge (default).
@ OutputVisuType_7point1
7.1 surround 2-D field.
@ OutputVisuType_Quadrophonic
Classic 4-channel quadrophonic 2-D field.
@ OutputVisuType_7point0
7.0 surround 2-D field.
@ MeteringColour_Pink
Pink metering bars.
@ MeteringColour_Blue
Blue metering bars.
@ MeteringColour_Green
Green metering bars (default).
@ OutputVisuType_5point1point2
5.1.2 with two height channels.
@ OutputVisuType_9point1point6
9.1.6 ATMOS full-3D layout.
@ MeteringColour_Red
Red metering bars.
@ MeteringColour_Laser
High-visibility laser-green metering bars.
@ OutputVisuType_7point1point4
7.1.4 Dolby Atmos layout.
@ OutputVisuType_5point1
5.1 surround 2-D field.
@ LookAndFeel_Light
Force light look-and-feel.
@ LookAndFeel_FollowHost
Match the host OS appearance.
@ LookAndFeel_Dark
Force dark look-and-feel.
@ FullscreenWindowMode
Toggle between popup and fullscreen window mode.
Status
Connection/application phase driven by the TCP session lifecycle.
@ Connecting
TCP handshake in progress.
@ Monitoring
Connected and actively receiving audio data.
@ Discovering
Searching for Mema instances via multicast.
void lookAndFeelChanged() override
Propagates a look-and-feel change to all owned child components.
bool keyPressed(const juce::KeyPress &key) override
Handles keyboard shortcuts (e.g. Escape to disconnect).
void applySettingsOption(const MemaMoSettingsOption &option)
Applies a settings menu selection, updating look-and-feel, visualisation type, or colour.
void onConfigUpdated() override
Reacts to external configuration changes.
bool isFullscreenEnabled()
Returns whether the window is currently displayed in fullscreen mode.
void timerCallback() override
Periodic callback used to retry TCP connections and poll network status.
std::function< void(bool)> onSetFullscreenWindow
Called to request a fullscreen/windowed transition from the application shell.
~MainComponent() override
Central monitoring panel of the Mema.Mo application.