| 447 | } |
| 448 | |
| 449 | void 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 | { |
nothing calls this directly
no test coverage detected