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
60 //==========================================================================
61 std::function<void(int)> onCpuUsageUpdate;
62 std::function<void(const std::map<int, std::pair<double, bool>>&)> onNetworkUsageUpdate;
63 std::function<void(const JUCEAppBasics::SessionServiceTopology&)> onServiceDiscoveryTopologyUpdate;
64 std::function<void(juce::Rectangle<int>)> onEditorSizeChangeRequested;
65
67 void clearUICallbacks();
68
69 //==========================================================================
71 void performConfigurationDump() override;
73 void onConfigUpdated() override;
74
75 //==========================================================================
77 void propagateLookAndFeelChanged();
78
80 void setUIConfigState(const std::unique_ptr<juce::XmlElement>& uiConfigState);
82 const std::unique_ptr<juce::XmlElement>& getUIConfigState();
83
85 void triggerPromptLoadConfig();
87 void triggerPromptSaveConfig();
88
89 JUCE_DECLARE_SINGLETON(Mema, false)
90
91private:
92 std::unique_ptr<MemaProcessor> m_MemaProcessor;
93 std::unique_ptr<juce::XmlElement> m_MemaUIConfigCache;
94
95 std::unique_ptr<MemaProcessorEditor> m_audioVisuComponent;
96 std::unique_ptr<AudioSelectComponent> m_audioDeviceSelectComponent;
97
98 std::unique_ptr<MemaAppConfiguration> m_config;
99
100 std::unique_ptr<juce::FileChooser> m_loadSavefileChooser;
101
102 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(Mema)
103};
104
105};
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:63
std::function< void(juce::Rectangle< int >)> onEditorSizeChangeRequested
Called when the editor requests a resize.
Definition Mema.h:64
std::function< void(int)> onCpuUsageUpdate
Called when CPU load percentage changes.
Definition Mema.h:61
std::function< void(const std::map< int, std::pair< double, bool > > &)> onNetworkUsageUpdate
Called when network traffic metrics change.
Definition Mema.h:62
Definition Mema.cpp:27