MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / modifyReference

Method modifyReference

Source/Core/CtrlrModulator/CtrlrModulator.cpp:449–550  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

447}
448
449void CtrlrModulator::modifyReference(const int newValue)
450{
451 if (ctrlrModulatorReference)
452 {
453 if (getProperty(Ids::modulatorLinkedToModulatorProperty).toString() == COMBO_ITEM_NONE)
454 {
455 return;
456 }
457 else if (!Identifier::isValidIdentifier(getProperty(Ids::modulatorLinkedToModulatorProperty)))
458 {
459 _WRN("Modulator link is invalid, the referenced property \""+getProperty(Ids::modulatorLinkedToModulatorProperty).toString()+"\" is invalid");
460 return;
461 }
462
463 const String targetProperty = getProperty(Ids::modulatorLinkedToModulatorProperty);
464
465 if (targetProperty == Ids::modulatorValue.toString()) /* if the target property is the value */
466 {
467 if ((bool)getProperty(Ids::modulatorLinkedToModulatorSource) == true) /* true means we are using Numeric values */
468 {
469 ctrlrModulatorReference->getProcessor().setValueGeneric (CtrlrModulatorValue (processor.getValueForMidiMessage(newValue), CtrlrModulatorValue::changedByLink));
470 }
471 }
472 else /* the target property is not the value, treat it as string */
473 {
474 if ((int)getProperty (Ids::modulatorLinkedToComponent) == 1) /* modify the component not the modulator */
475 {
476 if (ctrlrModulatorReference->getComponent()) /* make sure the target modulator has a component */
477 {
478 if ((bool)getProperty(Ids::modulatorLinkedToModulatorSource) == true) /* true means we are using Numeric values */
479 {
480 ctrlrModulatorReference->getComponent()->setProperty (targetProperty, processor.getValueForMidiMessage(newValue));
481 }
482 else if (getComponent())/* otherwise fetch our components text and set it as the value of the target property */
483 {
484 ctrlrModulatorReference->getComponent()->setProperty (targetProperty, getComponent()->getComponentText());
485 }
486 }
487 }
488 if ((int)getProperty (Ids::modulatorLinkedToComponent) == 0) /* modify the target modulator */
489 {
490 if ((bool)getProperty(Ids::modulatorLinkedToModulatorSource) == true) /* true means we are using Numeric values */
491 {
492 ctrlrModulatorReference->setProperty (targetProperty, newValue);
493 }
494 else if (getComponent())/* otherwise fetch our components text and set it as the value of the target property */
495 {
496 ctrlrModulatorReference->setProperty (targetProperty, getComponent()->getComponentText());
497 }
498 }
499 if ((int)getProperty (Ids::modulatorLinkedToComponent) == 2) /* modify the target midi message */
500 {
501 if ((bool)getProperty(Ids::modulatorLinkedToModulatorSource) == true) /* true means we are using Numeric values */
502 {
503 if (ctrlrModulatorReference->getMidiMessagePtr())
504 {
505 if ((bool)getProperty(Ids::modulatorLinkedToModulatorSource) == true)
506 {

Callers

nothing calls this directly

Calls 10

CtrlrModulatorValueClass · 0.85
getComponentFunction · 0.85
setValueGenericMethod · 0.80
toStringMethod · 0.45
getProcessorMethod · 0.45
getComponentMethod · 0.45
setPropertyMethod · 0.45
getComponentTextMethod · 0.45
getMidiMessagePtrMethod · 0.45

Tested by

no test coverage detected