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

Method OnModuleDeleted

Source/ModularSynth.cpp:1916–1945  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1914}
1915
1916void ModularSynth::OnModuleDeleted(IDrawableModule* module)
1917{
1918 if (!module->CanBeDeleted() || module->IsDeleted())
1919 return;
1920
1921 mDeletedModules.push_back(module);
1922
1923 mAudioThreadMutex.Lock("delete");
1924
1925 std::list<PatchCable*> cablesToRemove;
1926 for (auto* cable : mPatchCables)
1927 {
1928 if (cable->GetOwningModule() == module)
1929 cablesToRemove.push_back(cable);
1930 }
1931 for (auto* cable : cablesToRemove)
1932 RemoveFromVector(cable, mPatchCables);
1933
1934 RemoveFromVector(dynamic_cast<IAudioSource*>(module), mSources);
1935 RemoveFromVector(module, mLissajousDrawers);
1936 TheTransport->RemoveAudioPoller(dynamic_cast<IAudioPoller*>(module));
1937 //delete module; TODO(Ryan) deleting is hard... need to clear out everything with a reference to this, or switch to smart pointers
1938
1939 if (module == TheChaosEngine)
1940 TheChaosEngine = nullptr;
1941 if (module == TheLFOController)
1942 TheLFOController = nullptr;
1943
1944 mAudioThreadMutex.Unlock();
1945}
1946
1947void ModularSynth::MouseReleased(int intX, int intY, int button, const juce::MouseInputSource& source)
1948{

Callers 1

DeleteModuleMethod · 0.80

Calls 7

RemoveFromVectorFunction · 0.85
CanBeDeletedMethod · 0.80
IsDeletedMethod · 0.80
LockMethod · 0.80
GetOwningModuleMethod · 0.80
RemoveAudioPollerMethod · 0.80
UnlockMethod · 0.80

Tested by

no test coverage detected