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

Method SetUpFromSaveData

Source/NoteSorter.cpp:98–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96}
97
98void 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
126void NoteSorter::SaveLayout(ofxJSONElement& moduleInfo)
127{

Callers

nothing calls this directly

Calls 6

ofToStringFunction · 0.85
GetIntMethod · 0.80
sizeMethod · 0.80
SetPatchCableSourceMethod · 0.80
resizeMethod · 0.80
GetPatchCableSourceMethod · 0.45

Tested by

no test coverage detected