| 153 | } |
| 154 | |
| 155 | void AudioRouter::SetUpFromSaveData() |
| 156 | { |
| 157 | int numItems = mModuleSaveData.GetInt("num_items"); |
| 158 | int oldNumItems = (int)mDestinationCables.size(); |
| 159 | if (numItems > oldNumItems) |
| 160 | { |
| 161 | for (int i = oldNumItems; i < numItems; ++i) |
| 162 | { |
| 163 | mRouteSelector->AddLabel(" ", i); |
| 164 | auto* additionalCable = new PatchCableSource(this, kConnectionType_Audio); |
| 165 | AddPatchCableSource(additionalCable); |
| 166 | mDestinationCables.push_back(additionalCable); |
| 167 | } |
| 168 | } |
| 169 | else if (numItems < oldNumItems) |
| 170 | { |
| 171 | for (int i = oldNumItems - 1; i >= numItems; --i) |
| 172 | { |
| 173 | mRouteSelector->RemoveLabel(i); |
| 174 | RemovePatchCableSource(mDestinationCables[i]); |
| 175 | } |
| 176 | mDestinationCables.resize(numItems); |
| 177 | } |
| 178 | mOnlyShowActiveCable = mModuleSaveData.GetBool("only_show_active_cable"); |
| 179 | } |
| 180 | |
| 181 | void AudioRouter::SaveLayout(ofxJSONElement& moduleInfo) |
| 182 | { |