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

Function prealloc_

Engine/insert.c:2586–2609  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2584}
2585
2586int prealloc_(CSOUND *csound, AOP *p, int instname)
2587{
2588 int n, a;
2589
2590 if (instname)
2591 n = (int) strarg2opcno(csound, ((STRINGDAT*)p->r)->data, 1,
2592 (*p->b == FL(0.0) ? 0 : 1));
2593 else {
2594 if (csound->ISSTRCOD(*p->r))
2595 n = (int) strarg2opcno(csound, get_arg_string(csound,*p->r), 1,
2596 (*p->b == FL(0.0) ? 0 : 1));
2597 else n = *p->r;
2598 }
2599
2600 if (UNLIKELY(n == NOT_AN_INSTRUMENT)) return NOTOK;
2601 if (csound->oparms->realtime)
2602 csoundSpinLock(&csound->alloc_spinlock);
2603 a = (int) *p->a - csound->engineState.instrtxtp[n]->active;
2604 for ( ; a > 0; a--)
2605 instance(csound, n);
2606 if (csound->oparms->realtime)
2607 csoundSpinUnLock(&csound->alloc_spinlock);
2608 return OK;
2609}
2610
2611int prealloc(CSOUND *csound, AOP *p){
2612 return prealloc_(csound,p,0);

Callers 2

preallocFunction · 0.85
prealloc_SFunction · 0.85

Calls 5

strarg2opcnoFunction · 0.85
get_arg_stringFunction · 0.85
csoundSpinLockFunction · 0.85
instanceFunction · 0.85
csoundSpinUnLockFunction · 0.85

Tested by

no test coverage detected