MCPcopy Create free account
hub / github.com/BespokeSynth/BespokeSynth / SetUpFromSaveData

Method SetUpFromSaveData

Source/NoteRouter.cpp:147–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145}
146
147void NoteRouter::SetUpFromSaveData()
148{
149 int numItems = mModuleSaveData.GetInt("num_items");
150 int oldNumItems = (int)mDestinationCables.size();
151 if (numItems > oldNumItems)
152 {
153 for (int i = oldNumItems; i < numItems; ++i)
154 {
155 mRouteSelector->AddLabel(" ", i);
156 auto* additionalCable = new AdditionalNoteCable();
157 additionalCable->SetPatchCableSource(new PatchCableSource(this, kConnectionType_Note));
158 AddPatchCableSource(additionalCable->GetPatchCableSource());
159 mDestinationCables.push_back(additionalCable);
160 }
161 }
162 else if (numItems < oldNumItems)
163 {
164 for (int i = oldNumItems - 1; i >= numItems; --i)
165 {
166 mRouteSelector->RemoveLabel(i);
167 RemovePatchCableSource(mDestinationCables[i]->GetPatchCableSource());
168 }
169 mDestinationCables.resize(numItems);
170 }
171 mRadioButtonMode = mModuleSaveData.GetBool("radiobuttonmode");
172 mRouteSelector->SetMultiSelect(!mRadioButtonMode);
173 mOnlyShowActiveCables = mModuleSaveData.GetBool("only_show_active_cables");
174}
175
176void NoteRouter::SaveLayout(ofxJSONElement& moduleInfo)
177{

Callers

nothing calls this directly

Calls 9

GetIntMethod · 0.80
sizeMethod · 0.80
SetPatchCableSourceMethod · 0.80
resizeMethod · 0.80
GetBoolMethod · 0.80
SetMultiSelectMethod · 0.80
AddLabelMethod · 0.45
GetPatchCableSourceMethod · 0.45
RemoveLabelMethod · 0.45

Tested by

no test coverage detected