/
juggler.h
128 lines (94 loc) · 3.77 KB
/
juggler.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/* ----------------------------------------------------------------------------
FrutJUCE
========
Common classes for use with the JUCE library
Copyright (c) 2010-2018 Martin Zuther (http://www.mzuther.de/)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Thank you for using free software!
---------------------------------------------------------------------------- */
#ifndef __FRUT_PARAMETER_JUGGLER_H__
#define __FRUT_PARAMETER_JUGGLER_H__
/// Container for all parameters of a plug-in.
///
/// The methods of this class may be called on the audio thread, so
/// they are absolutely time-critical!
///
class Juggler
{
public:
Juggler(const String &settingsID,
int completeParameters,
int revealedParameters);
Parameter *getPluginParameter(int index);
String toString();
void add(Parameter *parameter,
int index);
void addProtected(Parameter *parameter,
int index);
void addCombined(parameter::ParCombined *parameter,
int switchIndex,
int parameterIndex);
int getNumParameters(bool includeHiddenParameters);
String getName(int index);
void setName(int index,
const String &newParameterName);
float getDefaultFloat(int index);
float getDefaultRealFloat(int index);
bool getDefaultBoolean(int index);
int getDefaultRealInteger(int index);
void setDefaultRealFloat(int index,
float newRealValue,
bool updateParameter);
float getFloat(int index);
void setFloat(int index,
float newValue);
float getRealFloat(int index);
void setRealFloat(int index,
float newRealValue);
int getRealInteger(int index);
void setRealInteger(int index,
int newRealValue);
bool getBoolean(int index);
String getText(int index);
void setText(int index, const String &newValue);
bool hasChanged(int index);
void clearChangeFlag(int index);
void loadFromXml(XmlElement *xmlDocument);
XmlElement storeAsXml();
protected:
#ifdef DEBUG
void assertParameter(int index,
bool wantModification);
#endif
int numberOfParameters_;
int numberOfRevealedParameters_;
String jugglerId_;
// This array deletes the contained parameters when the class is
// destructed. It holds the *real* parameter that is passed to
// the juggler. *Real* and *virtual* parameters only differ for
// the class *CombinedParameter* which creates *two* virtual
// parameters (switch and continuous) instead of one.
OwnedArray<Parameter> garbageCollector_;
// This array holds the *virtual* parameters. See the
// documentation of garbageCollector_ for more info.
Array<Parameter *> virtualParameters_;
// This array a Boolean for every *virtual* parameter. If the
// Boolean is *true*, the parameter may be modified, otherwise it
// will be handled as a constant.
Array<bool> mayModify_;
private:
JUCE_LEAK_DETECTOR(Juggler);
};
#endif // __FRUT_PARAMETER_JUGGLER_H__
// Local Variables:
// ispell-local-dictionary: "british"
// End: