MCPcopy Create free account
hub / github.com/asb2m10/dexed / CtrlOpSwitch

Class CtrlOpSwitch

Source/PluginParam.cpp:290–340  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

288};
289
290class CtrlOpSwitch : public Ctrl {
291 DexedAudioProcessor *processor;
292 char *value;
293public :
294 CtrlOpSwitch(String name, char *switchValue, DexedAudioProcessor *owner) : Ctrl(name) {
295 processor = owner;
296 value = switchValue;
297 }
298
299 void setValueHost(float f) {
300 if ( f == 0 )
301 *value = '0';
302 else
303 *value = '1';
304 updateDisplayName();
305
306 // the value is based on the controller
307 parent->setDxValue(155, -1);
308 }
309
310 float getValueHost() {
311 if ( *value == '0' )
312 return 0;
313 else
314 return 1;
315 }
316
317 String getValueDisplay() {
318 String ret;
319 ret << label << " " << (*value == '0' ? "OFF" : "ON");
320 return ret;
321 }
322
323 void updateComponent() {
324 if (button != NULL) {
325 if (*value == '0') {
326 button->setToggleState(false, dontSendNotification);
327 } else {
328 button->setToggleState(true, dontSendNotification);
329 }
330 }
331 }
332
333 void updateDisplayName() {
334 DexedAudioProcessorEditor *editor = (DexedAudioProcessorEditor *) parent->getActiveEditor();
335 if ( editor == NULL ) {
336 return;
337 }
338 editor->global.setParamMessage(getValueDisplay());
339 }
340};
341
342class CtrlMonoPoly : public Ctrl {
343 DexedAudioProcessor *processor;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected