Mema
Memory Matrix — multi-channel audio matrix monitor and router
Loading...
Searching...
No Matches
MemaCommanders.cpp
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#include "MemaCommanders.h"
20
21
22namespace Mema
23{
24
25
29
33
37
41
42void MemaInputCommander::setInputMuteChangeCallback(const std::function<void(MemaInputCommander* sender, std::uint16_t, bool)>& callback)
43{
44 onInputMuteChangeCallback = callback;
45}
46
47void MemaInputCommander::setInputLevelChangeCallback(const std::function<void(MemaInputCommander* sender, std::uint16_t, float)>& callback)
48{
49 onInputLevelChangeCallback = callback;
50}
51
52void MemaInputCommander::setInputMutePollCallback(const std::function<void(MemaInputCommander* sender, std::uint16_t)>& callback)
53{
54 onInputMutePollCallback = callback;
55}
56
57void MemaInputCommander::setInputLevelPollCallback(const std::function<void(MemaInputCommander* sender, std::uint16_t)>& callback)
58{
59 onInputLevelPollCallback = callback;
60}
61
62void MemaInputCommander::inputMuteChange(std::uint16_t channel, bool muteState, MemaInputCommander* /*sender*/)
63{
64 if (onInputMuteChangeCallback)
65 onInputMuteChangeCallback(this, channel, muteState);
66}
67
68void MemaInputCommander::inputLevelChange(std::uint16_t channel, float levelValue, MemaInputCommander* /*sender*/)
69{
70 if (onInputLevelChangeCallback)
71 onInputLevelChangeCallback(this, channel, levelValue);
72}
73
74void MemaInputCommander::inputMutePoll(std::uint16_t channel, MemaInputCommander* /*sender*/)
75{
76 if (onInputMutePollCallback)
77 onInputMutePollCallback(this, channel);
78}
79
80void MemaInputCommander::inputLevelPoll(std::uint16_t channel, MemaInputCommander* /*sender*/)
81{
82 if (onInputLevelPollCallback)
83 onInputLevelPollCallback(this, channel);
84}
85
86
90
94
95void MemaOutputCommander::setOutputMuteChangeCallback(const std::function<void(MemaOutputCommander* /*sender*/, std::uint16_t, bool)>& callback)
96{
97 onOutputMuteChangeCallback = callback;
98}
99
100void MemaOutputCommander::setOutputLevelChangeCallback(const std::function<void(MemaOutputCommander* /*sender*/, std::uint16_t, float)>& callback)
101{
102 onOutputLevelChangeCallback = callback;
103}
104
105void MemaOutputCommander::setOutputMutePollCallback(const std::function<void(MemaOutputCommander* /*sender*/, std::uint16_t)>& callback)
106{
107 onOutputMutePollCallback = callback;
108}
109
110void MemaOutputCommander::setOutputLevelPollCallback(const std::function<void(MemaOutputCommander* /*sender*/, std::uint16_t)>& callback)
111{
112 onOutputLevelPollCallback = callback;
113}
114
115void MemaOutputCommander::outputMuteChange(std::uint16_t channel, bool muteState, MemaOutputCommander* /*sender*/)
116{
117 if (onOutputMuteChangeCallback)
118 onOutputMuteChangeCallback(nullptr, channel, muteState);
119}
120
121void MemaOutputCommander::outputLevelChange(std::uint16_t channel, float levelValue, MemaOutputCommander* /*sender*/)
122{
123 if (onOutputLevelChangeCallback)
124 onOutputLevelChangeCallback(nullptr, channel, levelValue);
125}
126
127void MemaOutputCommander::outputMutePoll(std::uint16_t channel, MemaOutputCommander* /*sender*/)
128{
129 if (onOutputMutePollCallback)
130 onOutputMutePollCallback(nullptr, channel);
131}
132
133void MemaOutputCommander::outputLevelPoll(std::uint16_t channel, MemaOutputCommander* /*sender*/)
134{
135 if (onOutputLevelPollCallback)
136 onOutputLevelPollCallback(nullptr, channel);
137}
138
139
143
147
148void MemaCrosspointCommander::setCrosspointEnabledChangeCallback(const std::function<void(MemaCrosspointCommander* sender, std::uint16_t, std::uint16_t, bool)>& callback)
149{
150 onCrosspointEnabledChangeCallback = callback;
151}
152
153void MemaCrosspointCommander::setCrosspointEnabledPollCallback(const std::function<void(MemaCrosspointCommander* sender, std::uint16_t, std::uint16_t)>& callback)
154{
155 onCrosspointEnabledPollCallback = callback;
156}
157
158void MemaCrosspointCommander::crosspointEnabledChange(std::uint16_t input, std::uint16_t output, bool enabledState, MemaCrosspointCommander* sender)
159{
160 if (onCrosspointEnabledChangeCallback)
161 onCrosspointEnabledChangeCallback(sender, input, output, enabledState);
162}
163
164void MemaCrosspointCommander::crosspointEnabledPoll(std::uint16_t input, std::uint16_t output, MemaCrosspointCommander* sender)
165{
166 if (onCrosspointEnabledPollCallback)
167 onCrosspointEnabledPollCallback(sender, input, output);
168}
169
170void MemaCrosspointCommander::setCrosspointFactorChangeCallback(const std::function<void(MemaCrosspointCommander* sender, std::uint16_t, std::uint16_t, float)>& callback)
171{
172 onCrosspointFactorChangeCallback = callback;
173}
174
175void MemaCrosspointCommander::setCrosspointFactorPollCallback(const std::function<void(MemaCrosspointCommander* sender, std::uint16_t, std::uint16_t)>& callback)
176{
177 onCrosspointFactorPollCallback = callback;
178}
179
180void MemaCrosspointCommander::crosspointFactorChange(std::uint16_t input, std::uint16_t output, float factor, MemaCrosspointCommander* sender)
181{
182 if (onCrosspointFactorChangeCallback)
183 onCrosspointFactorChangeCallback(sender, input, output, factor);
184}
185
186void MemaCrosspointCommander::crosspointFactorPoll(std::uint16_t input, std::uint16_t output, MemaCrosspointCommander* sender)
187{
188 if (onCrosspointFactorPollCallback)
189 onCrosspointFactorPollCallback(sender, input, output);
190}
191
192
197
202
203void MemaPluginCommander::setPluginParameterInfosChangeCallback(const std::function<void(MemaPluginCommander* sender, const std::vector<PluginParameterInfo>&, const std::string&)>& callback)
204{
205 onPluginParameterInfosChangeCallback = callback;
206}
207
209{
210 onPluginParameterInfosPollCallback = callback;
211}
212
213void MemaPluginCommander::pluginParameterInfosChange(const std::vector<PluginParameterInfo>& infos, const std::string& name, MemaPluginCommander* sender)
214{
215 if (onPluginParameterInfosChangeCallback)
216 onPluginParameterInfosChangeCallback(sender, infos, name);
217}
218
220{
221 if (onPluginParameterInfosPollCallback)
222 onPluginParameterInfosPollCallback(sender);
223}
224
225void MemaPluginCommander::setPluginParameterValueChangeCallback(const std::function<void(MemaPluginCommander* sender, std::uint16_t, std::string, float)>& callback)
226{
227 onPluginParameterValueChangeCallback = callback;
228}
229
230void MemaPluginCommander::setPluginParameterValuePollCallback(const std::function<void(MemaPluginCommander* sender, std::uint16_t, std::string)>& callback)
231{
232 onPluginParameterValuePollCallback = callback;
233}
234
235void MemaPluginCommander::pluginParameterValueChange(std::uint16_t index, std::string id, float currentValue, MemaPluginCommander* sender)
236{
237 if (onPluginParameterValueChangeCallback)
238 onPluginParameterValueChangeCallback(sender, index, id, currentValue);
239}
240
241void MemaPluginCommander::pluginParameterValuePoll(std::uint16_t index, std::string id, MemaPluginCommander * sender)
242{
243 if (onPluginParameterValuePollCallback)
244 onPluginParameterValuePollCallback(sender, index, id);
245}
246
247
248} // namespace Mema
void setCrosspointEnabledPollCallback(const std::function< void(MemaCrosspointCommander *sender, std::uint16_t, std::uint16_t)> &callback)
virtual ~MemaCrosspointCommander() override
void crosspointFactorPoll(std::uint16_t input, std::uint16_t output, MemaCrosspointCommander *sender)
void setCrosspointEnabledChangeCallback(const std::function< void(MemaCrosspointCommander *sender, std::uint16_t, std::uint16_t, bool)> &callback)
void crosspointEnabledChange(std::uint16_t input, std::uint16_t output, bool enabledState, MemaCrosspointCommander *sender)
void crosspointFactorChange(std::uint16_t input, std::uint16_t output, float factor, MemaCrosspointCommander *sender)
void crosspointEnabledPoll(std::uint16_t input, std::uint16_t output, MemaCrosspointCommander *sender)
void setCrosspointFactorPollCallback(const std::function< void(MemaCrosspointCommander *sender, std::uint16_t, std::uint16_t)> &callback)
void setCrosspointFactorChangeCallback(const std::function< void(MemaCrosspointCommander *sender, std::uint16_t, std::uint16_t, float)> &callback)
void inputLevelPoll(std::uint16_t channel, MemaInputCommander *sender)
virtual ~MemaInputCommander() override
void inputLevelChange(std::uint16_t channel, float levelValue, MemaInputCommander *sender)
void setInputMuteChangeCallback(const std::function< void(MemaInputCommander *sender, std::uint16_t, bool)> &callback)
void inputMuteChange(std::uint16_t channel, bool muteState, MemaInputCommander *sender)
void setInputLevelChangeCallback(const std::function< void(MemaInputCommander *sender, std::uint16_t, float)> &callback)
void inputMutePoll(std::uint16_t channel, MemaInputCommander *sender)
void setInputLevelPollCallback(const std::function< void(MemaInputCommander *sender, std::uint16_t)> &callback)
void setInputMutePollCallback(const std::function< void(MemaInputCommander *sender, std::uint16_t)> &callback)
void outputLevelChange(std::uint16_t channel, float levelValue, MemaOutputCommander *sender)
void outputMuteChange(std::uint16_t channel, bool muteState, MemaOutputCommander *sender)
void outputLevelPoll(std::uint16_t channel, MemaOutputCommander *sender)
void outputMutePoll(std::uint16_t channel, MemaOutputCommander *sender)
void setOutputMuteChangeCallback(const std::function< void(MemaOutputCommander *sender, std::uint16_t, bool)> &callback)
void setOutputLevelPollCallback(const std::function< void(MemaOutputCommander *sender, std::uint16_t)> &callback)
void setOutputLevelChangeCallback(const std::function< void(MemaOutputCommander *sender, std::uint16_t, float)> &callback)
virtual ~MemaOutputCommander() override
void setOutputMutePollCallback(const std::function< void(MemaOutputCommander *sender, std::uint16_t)> &callback)
void setPluginParameterValueChangeCallback(const std::function< void(MemaPluginCommander *sender, std::uint16_t, std::string, float)> &callback)
void setPluginParameterValuePollCallback(const std::function< void(MemaPluginCommander *sender, std::uint16_t, std::string)> &callback)
void setPluginParameterInfosChangeCallback(const std::function< void(MemaPluginCommander *sender, const std::vector< PluginParameterInfo > &, const std::string &name)> &callback)
void setPluginParameterInfosPollCallback(const std::function< void(MemaPluginCommander *sender)> &callback)
void pluginParameterValuePoll(std::uint16_t index, std::string id, MemaPluginCommander *sender)
void pluginParameterValueChange(std::uint16_t index, std::string id, float currentValue, MemaPluginCommander *sender)
void pluginParameterInfosPoll(MemaPluginCommander *sender)
void pluginParameterInfosChange(const std::vector< PluginParameterInfo > &, const std::string &, MemaPluginCommander *sender)
Definition Mema.cpp:27