Mema
Memory Matrix — multi-channel audio matrix monitor and router
Loading...
Searching...
No Matches
MemaReAppConfiguration.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
23#include <AppConfigurationBase.h>
24
25#define Mema_CONFIG_VERSION "1.0.0"
26
27
42class MemaReAppConfiguration : public JUCEAppBasics::AppConfigurationBase
43{
44
45public:
60 static juce::String getTagName(TagID ID)
61 {
62 switch(ID)
63 {
65 return "CONNECTIONCONFIG";
67 return "SERVICEDESCRIPTION";
68 case VISUCONFIG:
69 return "VISUCONFIG";
70 case CONTROLFORMAT:
71 return "CONTROLFORMAT";
72 case CONTROLCOLOUR:
73 return "CONTROLCOLOUR";
74 case LOOKANDFEEL:
75 return "LOOKANDFEEL";
76 case CONTROLSSIZE:
77 return "CONTROLSSIZE";
78 case EXTCTRLCONFIG:
79 return "EXTCTRLCONFIG";
80 case ADMOSCHOST:
81 return "ADMOSCHOST";
82 case ADMOSCCLIENT:
83 return "ADMOSCCLIENT";
84 default:
85 return "INVALID";
86 }
87 };
88
91 {
95 };
96 static juce::String getAttributeName(AttributeID ID)
97 {
98 switch (ID)
99 {
100 case ENABLED:
101 return "ENABLED";
102 case IP:
103 return "IP";
104 case PORT:
105 return "PORT";
106 default:
107 return "-";
108 }
109 };
110
111public:
113 explicit MemaReAppConfiguration(const File &file);
114 ~MemaReAppConfiguration() override;
115
117 bool isValid() override;
119 static bool isValid(const std::unique_ptr<juce::XmlElement>& xmlConfig);
120
122 bool ResetToDefault();
123
124protected:
126 bool HandleConfigVersionConflict(const Version& configVersionFound) override;
127
128private:
129
130 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(MemaReAppConfiguration)
131};
132
XML-backed configuration manager for the Mema.Re remote-control application.
static juce::String getAttributeName(AttributeID ID)
TagID
XML element tag identifiers used when serialising/deserialising the configuration.
@ CONTROLFORMAT
Active control mode (faderbank, 2-D panning layout, plugin parameters).
@ ADMOSCCLIENT
ADM-OSC client (remote IP and port for outgoing messages).
@ CONTROLSSIZE
Size category for control widgets (S / M / L).
@ VISUCONFIG
Root element for visualisation/control settings.
@ LOOKANDFEEL
Active look-and-feel (follow host / dark / light).
@ ADMOSCHOST
ADM-OSC host (local UDP listen port).
@ EXTCTRLCONFIG
Root element for external ADM-OSC controller settings.
@ CONNECTIONCONFIG
Root element for TCP connection settings.
@ SERVICEDESCRIPTION
Stored multicast service descriptor of the last connected Mema instance.
@ CONTROLCOLOUR
User-selected accent colour for control elements.
bool ResetToDefault()
Resets every configuration value to its factory default and triggers a dump.
static juce::String getTagName(TagID ID)
bool HandleConfigVersionConflict(const Version &configVersionFound) override
Called when the persisted config version differs from the current app version.
AttributeID
XML attribute identifiers used alongside TagID elements.
@ PORT
UDP/TCP port number.
@ IP
IP address string (used for ADM-OSC remote client address).
@ ENABLED
Boolean flag indicating whether a feature or connection is active.
bool isValid() override
Returns true when the loaded XML contains all required Mema.Re configuration nodes.