MCPcopy Create free account
hub / github.com/christophhart/HISE / removeModule

Method removeModule

hi_scripting/scripting/api/ScriptingApiObjects.cpp:5296–5328  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5294
5295
5296bool ApiHelpers::ModuleHandler::removeModule(Processor* p)
5297{
5298 if (p == nullptr)
5299 return true;
5300
5301 if (p->getMainController()->getKillStateHandler().getCurrentThread() == MainController::KillStateHandler::TargetThread::AudioThread)
5302 {
5303 throw String("Effects can't be removed from the audio thread!");
5304 }
5305
5306 if (p != nullptr)
5307 {
5308 auto removeFunction = [](Processor* p)
5309 {
5310 auto c = dynamic_cast<Chain*>(p->getParentProcessor(false));
5311
5312 jassert(c != nullptr);
5313
5314 if (c == nullptr)
5315 return SafeFunctionCall::cancelled;
5316
5317 // Remove it but don't delete it
5318 c->getHandler()->remove(p, false);
5319
5320 return SafeFunctionCall::OK;
5321 };
5322
5323 parent->getMainController()->getGlobalAsyncModuleHandler().removeAsync(p, removeFunction);
5324 return true;
5325 }
5326 else
5327 return false;
5328}
5329
5330Processor* ApiHelpers::ModuleHandler::addModule(Chain* c, const String& type, const String& id, int index /*= -1*/)
5331{

Callers 2

removeModulatorMethod · 0.45
removeEffectMethod · 0.45

Calls 7

removeAsyncMethod · 0.80
StringClass · 0.50
getCurrentThreadMethod · 0.45
getMainControllerMethod · 0.45
getParentProcessorMethod · 0.45
removeMethod · 0.45
getHandlerMethod · 0.45

Tested by

no test coverage detected