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

Method LoadState

Source/PatchCableSource.cpp:749–791  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

747}
748
749void PatchCableSource::LoadState(FileStreamIn& in)
750{
751 bool doDummyLoad = false;
752 if (sIsLoadingModulePreset)
753 doDummyLoad = true;
754
755 if (!doDummyLoad)
756 ClearPatchCables();
757
758 int size;
759 in >> size;
760
761 for (int i = 0; i < size; ++i)
762 {
763 std::string path;
764 in >> path;
765
766 if (!doDummyLoad)
767 {
768 IClickable* target = TheSynth->FindModule(path, false);
769 if (target == nullptr)
770 {
771 try
772 {
773 target = TheSynth->FindUIControl(path);
774 }
775 catch (UnknownUIControlException& e)
776 {
777 }
778 }
779
780 if (TheSynth->IsDuplicatingModule() && mType == kConnectionType_Modulator)
781 target = nullptr; //TODO(Ryan) make it so that when you're duplicating a group, modulators preserve connections to the new copies of controls within that group
782
783 mPatchCables.push_back(new PatchCable(this));
784 assert(i == (int)mPatchCables.size() - 1);
785 SetPatchCableTarget(mPatchCables[i], target, false);
786 }
787 }
788
789 if (!doDummyLoad)
790 mOwner->PostRepatch(this, false);
791}
792
793void NoteHistory::AddEvent(double time, bool on, int data)
794{

Callers

nothing calls this directly

Calls 5

IsDuplicatingModuleMethod · 0.80
sizeMethod · 0.80
FindModuleMethod · 0.45
FindUIControlMethod · 0.45
PostRepatchMethod · 0.45

Tested by

no test coverage detected