| 96 | } |
| 97 | |
| 98 | void NoteSorter::SetUpFromSaveData() |
| 99 | { |
| 100 | int numItems = mModuleSaveData.GetInt("num_items"); |
| 101 | int oldNumItems = (int)mDestinationCables.size(); |
| 102 | if (numItems > oldNumItems) |
| 103 | { |
| 104 | for (int i = oldNumItems; i < numItems; ++i) |
| 105 | { |
| 106 | mPitchEntry.push_back(new TextEntry(this, ("pitch " + ofToString(i)).c_str(), 8, 8 + i * 19, 5, &mPitch[i], -1, 127)); |
| 107 | auto* additionalCable = new AdditionalNoteCable(); |
| 108 | |
| 109 | additionalCable->SetPatchCableSource(new PatchCableSource(this, kConnectionType_Note)); |
| 110 | AddPatchCableSource(additionalCable->GetPatchCableSource()); |
| 111 | mDestinationCables.push_back(additionalCable); |
| 112 | } |
| 113 | } |
| 114 | else if (numItems < oldNumItems) |
| 115 | { |
| 116 | for (int i = oldNumItems - 1; i >= numItems; --i) |
| 117 | { |
| 118 | RemoveUIControl(mPitchEntry[i]); |
| 119 | RemovePatchCableSource(mDestinationCables[i]->GetPatchCableSource()); |
| 120 | } |
| 121 | mPitchEntry.resize(numItems); |
| 122 | mDestinationCables.resize(numItems); |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | void NoteSorter::SaveLayout(ofxJSONElement& moduleInfo) |
| 127 | { |
nothing calls this directly
no test coverage detected