MCPcopy Create free account
hub / github.com/csound/csound / csoundKillInstanceInternal

Function csoundKillInstanceInternal

Engine/insert.c:2722–2757  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2720}
2721
2722int csoundKillInstanceInternal(CSOUND *csound, MYFLT instr, char *instrName,
2723 int mode, int allow_release, int async)
2724{
2725 INSDS *ip;
2726 int insno;
2727
2728 if (instrName) {
2729 instr = named_instr_find(csound, instrName);
2730 insno = (int) instr;
2731 } else insno = instr;
2732
2733 if (UNLIKELY(insno < 1 || insno > (int) csound->engineState.maxinsno ||
2734 csound->engineState.instrtxtp[insno] == NULL)) {
2735 return CSOUND_ERROR;
2736 }
2737
2738 if (UNLIKELY(mode < 0 || mode > 15 || (mode & 3) == 3)) {
2739 csoundUnlockMutex(csound->API_lock);
2740 return CSOUND_ERROR;
2741 }
2742 ip = &(csound->actanchor);
2743
2744 while ((ip = ip->nxtact) != NULL && (int) ip->insno != insno);
2745 if (UNLIKELY(ip == NULL)) {
2746 return CSOUND_ERROR;
2747 }
2748
2749 if (!async) {
2750 csoundLockMutex(csound->API_lock);
2751 killInstance(csound, instr, insno, ip, mode, allow_release);
2752 csoundUnlockMutex(csound->API_lock);
2753 }
2754 else
2755 killInstance_enqueue(csound, instr, insno, ip, mode, allow_release);
2756 return CSOUND_SUCCESS;
2757}

Callers 2

csoundKillInstanceFunction · 0.85
csoundKillInstanceAsyncFunction · 0.85

Calls 5

named_instr_findFunction · 0.85
csoundUnlockMutexFunction · 0.85
csoundLockMutexFunction · 0.85
killInstanceFunction · 0.85
killInstance_enqueueFunction · 0.85

Tested by

no test coverage detected