| 73 | } |
| 74 | |
| 75 | void CtrlrModulator::restoreState (const ValueTree &savedState) |
| 76 | { |
| 77 | setRestoreState (true); |
| 78 | modulatorTree.removeAllChildren (0); |
| 79 | |
| 80 | for (int i=0; i<savedState.getNumChildren(); i++) |
| 81 | { |
| 82 | if (savedState.getChild(i).hasType(Ids::component)) |
| 83 | { |
| 84 | setComponentType (savedState.getChild(i)); |
| 85 | } |
| 86 | |
| 87 | if (savedState.getChild(i).hasType(Ids::midi)) |
| 88 | { |
| 89 | if (getMidiMessagePtr()) |
| 90 | { |
| 91 | setMidiType (savedState.getChild(i)); |
| 92 | modulatorTree.addChild (processor.getMidiMessage().getMidiTree(), -1, 0); |
| 93 | } |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | for (int i=0; i<savedState.getNumProperties(); i++) |
| 98 | { |
| 99 | if (savedState.getPropertyName(i) == Ids::name) |
| 100 | { |
| 101 | modulatorTree.setProperty (Ids::name, owner.getUniqueModulatorName(savedState.getProperty(Ids::name)), 0); |
| 102 | } |
| 103 | else if (isDelayedProperty(savedState.getPropertyName(i))) |
| 104 | { |
| 105 | setDelayedProperty(savedState.getPropertyName(i), savedState.getProperty(savedState.getPropertyName(i))); |
| 106 | continue; |
| 107 | } |
| 108 | else if (savedState.getPropertyName(i) == Ids::modulatorValue |
| 109 | && owner.getCtrlrManagerOwner().getInstanceMode() == InstanceMulti) |
| 110 | { |
| 111 | /* |
| 112 | set the modulator value |
| 113 | First see if it has a component attached to check out radio groups |
| 114 | if (savedState.getChildWithName(Ids::component).isValid()) |
| 115 | { |
| 116 | ValueTree c = savedState.getChildWithName(Ids::component); |
| 117 | |
| 118 | If the component belongs to a radio group, only set the value |
| 119 | to the group member that has the TRUE value all others will be FALSE |
| 120 | if (((int)c.getProperty(Ids::componentRadioGroupId) > 0)) |
| 121 | { |
| 122 | if ((int)savedState.getProperty(Ids::modulatorValue) == 1) |
| 123 | { |
| 124 | processor.setValueFromGUI (savedState.getProperty(Ids::modulatorValue), true); |
| 125 | |
| 126 | This is something that should not be here, this should be called from the HOST |
| 127 | as setParameter() call but it doesn't get called with the value set to 1. |
| 128 | |
| 129 | Fuck if I know why, for now it stays here, i don't know if it's a good idea |
| 130 | i don't even know if it's an OK idea. But it seems to do the trick |
| 131 | |
| 132 |
no test coverage detected