Mema
Memory Matrix — multi-channel audio matrix monitor and router
Loading...
Searching...
No Matches
MemaMoAppConfiguration.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
41class MemaMoAppConfiguration : public JUCEAppBasics::AppConfigurationBase
42{
43
44public:
55 static juce::String getTagName(TagID ID)
56 {
57 switch(ID)
58 {
60 return "CONNECTIONCONFIG";
62 return "SERVICEDESCRIPTION";
63 case VISUCONFIG:
64 return "VISUCONFIG";
65 case OUTPUTVISUTYPE:
66 return "OUTPUTVISUTYPE";
67 case METERINGCOLOUR:
68 return "METERINGCOLOUR";
69 case LOOKANDFEEL:
70 return "LOOKANDFEEL";
71 default:
72 return "INVALID";
73 }
74 };
75
78 {
81 };
82 static juce::String getAttributeName(AttributeID ID)
83 {
84 switch (ID)
85 {
86 case ENABLED:
87 return "ENABLED";
88 case COUNT:
89 return "COUNT";
90 default:
91 return "-";
92 }
93 };
94
95public:
97 explicit MemaMoAppConfiguration(const File &file);
98 ~MemaMoAppConfiguration() override;
99
101 bool isValid() override;
103 static bool isValid(const std::unique_ptr<juce::XmlElement>& xmlConfig);
104
106 bool ResetToDefault();
107
108protected:
110 bool HandleConfigVersionConflict(const Version& configVersionFound) override;
111
112private:
113
114 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(MemaMoAppConfiguration)
115};
116
XML-backed configuration manager for the Mema.Mo monitor application.
TagID
XML element tag identifiers used when serialising/deserialising the configuration.
@ METERINGCOLOUR
User-selected metering bar colour.
@ OUTPUTVISUTYPE
Active output visualisation mode (meterbridge, 2-D field, waveform, …).
@ VISUCONFIG
Root element for visualisation settings.
@ LOOKANDFEEL
Active look-and-feel (follow host / dark / light).
@ SERVICEDESCRIPTION
Stores the multicast service descriptor of the last connected Mema instance.
@ CONNECTIONCONFIG
Root element for connection settings (host, port).
static juce::String getAttributeName(AttributeID ID)
bool ResetToDefault()
Resets every configuration value to its factory default and triggers a dump.
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.
@ COUNT
Integer storing a channel or item count.
@ ENABLED
Boolean flag indicating whether a feature or connection is active.
bool isValid() override
Returns true when the loaded XML contains all required Mema.Mo configuration nodes.
static juce::String getTagName(TagID ID)