Mema
Memory Matrix — multi-channel audio matrix monitor and router
Loading...
Searching...
No Matches
MemaAppConfiguration.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
23#include <AppConfigurationBase.h>
24
25#define Mema_CONFIG_VERSION "1.0.0"
26
27namespace Mema
28{
29
33class MemaAppConfiguration : public JUCEAppBasics::AppConfigurationBase
34{
35
36public:
49 static juce::String getTagName(TagID ID)
50 {
51 switch(ID)
52 {
53 case PROCESSORCONFIG:
54 return "PROCESSORCONFIG";
55 case DEVCONFIG:
56 return "DEVICECONFIG";
57 case UICONFIG:
58 return "UICONFIG";
59 case PLUGINCONFIG:
60 return "PLUGINCONFIG";
61 case INPUTMUTES:
62 return "INPUTMUTES";
63 case OUTPUTMUTES:
64 return "OUTPUTMUTES";
65 case CROSSPOINTGAINS:
66 return "CROSSPOINTGAINS";
67 case PLUGINPARAM:
68 return "PLUGINPARAM";
69 default:
70 return "INVALID";
71 }
72 };
73
85 static juce::String getAttributeName(AttributeID ID)
86 {
87 switch (ID)
88 {
89 case ENABLED:
90 return "ENABLED";
91 case POST:
92 return "POST";
93 case PALETTESTYLE:
94 return "PALETTESTYLE";
95 case METERINGCOLOR:
96 return "METERINGCOLOR";
97 case IDX:
98 return "IDX";
99 case CONTROLLABLE:
100 return "CONTROLLABLE";
101 case PARAMORDER:
102 return "PARAMORDER";
103 default:
104 return "-";
105 }
106 };
107
108public:
110 explicit MemaAppConfiguration(const File &file);
111 ~MemaAppConfiguration() override;
112
114 bool isValid() override;
116 static bool isValid(const std::unique_ptr<juce::XmlElement>& xmlConfig);
117
119 bool ResetToDefault();
120
121protected:
123 bool HandleConfigVersionConflict(const Version& configVersionFound) override;
124
125private:
126
127 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(MemaAppConfiguration)
128};
129
130} // namespace Mema
XML-backed application configuration manager for the Mema audio matrix tool.
static juce::String getTagName(TagID ID)
TagID
XML element tag identifiers used when serialising/deserialising the configuration.
@ PLUGINCONFIG
Plugin host settings.
@ PROCESSORCONFIG
Audio processor settings.
@ CROSSPOINTGAINS
Crosspoint matrix gain values.
@ DEVCONFIG
Audio device configuration.
@ OUTPUTMUTES
Per-channel output mute states.
@ PLUGINPARAM
Individual plugin parameter entry.
@ UICONFIG
UI layout and appearance.
@ INPUTMUTES
Per-channel input mute states.
bool ResetToDefault()
Resets every value to factory defaults and triggers a dump.
static juce::String getAttributeName(AttributeID ID)
AttributeID
XML attribute identifiers used alongside TagID elements.
@ ENABLED
Boolean enabled flag.
@ METERINGCOLOR
Metering bar colour.
@ POST
Post-matrix plugin insertion flag.
@ PARAMORDER
Comma-separated list of parameter indices defining the display order.
@ CONTROLLABLE
Whether a plugin parameter is remotely controllable.
@ IDX
Channel or parameter index.
@ PALETTESTYLE
Look-and-feel palette style index.
bool isValid() override
Returns true when the loaded XML contains all required configuration nodes.
bool HandleConfigVersionConflict(const Version &configVersionFound) override
Called when the persisted config version differs from the current app version.