Mema
Memory Matrix — multi-channel audio matrix monitor and router
Loading...
Searching...
No Matches
Mema.h
Go to the documentation of this file.
1/* Copyright (c) 2024, 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
25#include <ServiceTopologyManager.h>
26
27
28namespace Mema
29{
30
34class AudioSelectComponent;
35class MemaProcessorEditor;
36class MemaProcessor;
37class MemaRemoteWrapper;
38
42class Mema : public juce::Timer,
43 public MemaAppConfiguration::Dumper,
44 public MemaAppConfiguration::Watcher
45{
46public:
47 Mema();
48 ~Mema() override;
49
50 //==========================================================================
52 void timerCallback() override;
53
54 //==========================================================================
56 juce::Component* getMemaProcessorEditor();
58 juce::Component* getDeviceSetupComponent();
59
68 const std::unique_ptr<MemaProcessor>& getMemaProcessor() const;
69
70 //==========================================================================
71 std::function<void(int)> onCpuUsageUpdate;
72 std::function<void(const std::map<int, std::pair<double, bool>>&)> onNetworkUsageUpdate;
73 std::function<void(const JUCEAppBasics::SessionServiceTopology&)> onServiceDiscoveryTopologyUpdate;
74 std::function<void(juce::Rectangle<int>)> onEditorSizeChangeRequested;
75
77 void clearUICallbacks();
78
79 //==========================================================================
81 void performConfigurationDump() override;
83 void onConfigUpdated() override;
84
85 //==========================================================================
87 void propagateLookAndFeelChanged();
88
90 void setUIConfigState(const std::unique_ptr<juce::XmlElement>& uiConfigState);
92 const std::unique_ptr<juce::XmlElement>& getUIConfigState();
93
95 void triggerPromptLoadConfig();
97 void triggerPromptSaveConfig();
98
99 JUCE_DECLARE_SINGLETON(Mema, false)
100
101private:
102 std::unique_ptr<MemaProcessor> m_MemaProcessor;
103 std::unique_ptr<juce::XmlElement> m_MemaUIConfigCache;
104
105 std::unique_ptr<MemaProcessorEditor> m_audioVisuComponent;
106 std::unique_ptr<AudioSelectComponent> m_audioDeviceSelectComponent;
107
108 std::unique_ptr<MemaAppConfiguration> m_config;
109
110 std::unique_ptr<juce::FileChooser> m_loadSavefileChooser;
111
112 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(Mema)
113};
114
115};
XML-backed application configuration manager for the Mema audio matrix tool.
Top-level editor component for the Mema processor — composes the input, crosspoint,...
Core audio processor — owns the AudioDeviceManager, routing matrix, plugin host, and IPC server.
std::function< void(const JUCEAppBasics::SessionServiceTopology &)> onServiceDiscoveryTopologyUpdate
Called when the multicast service topology changes.
Definition Mema.h:73
std::function< void(juce::Rectangle< int >)> onEditorSizeChangeRequested
Called when the editor requests a resize.
Definition Mema.h:74
std::function< void(int)> onCpuUsageUpdate
Called when CPU load percentage changes.
Definition Mema.h:71
std::function< void(const std::map< int, std::pair< double, bool > > &)> onNetworkUsageUpdate
Called when network traffic metrics change.
Definition Mema.h:72