cmDspFx.c : Changed _cmDspAvailCh_Recv() to handle 'trigger' case where

no available channels are available.
This commit is contained in:
kevin 2013-12-10 16:27:15 -05:00
parent f41a6d6709
commit e7429a773c

View File

@ -5768,8 +5768,8 @@ struct cmDspClass_str* cmRouterClassCons( cmDspCtx_t* ctx )
// The gate[] output is designed to work with the gate[] input of Xfader. When // The gate[] output is designed to work with the gate[] input of Xfader. When
// availCh.gate[] goes high Xfader fades in, when availCh.gate[] goes low // availCh.gate[] goes high Xfader fades in, when availCh.gate[] goes low
// Xfader fades out. The dis[] channel is designed to connect from Xfader.state[]. // Xfader fades out. The dis[] channel is designed to connect from Xfader.state[].
// When Xfader.state[] goes low, when a fade-out is complete, the connected AvailCh // Xfader.state[] goes low when a fade-out is complete, the connected AvailCh
// is marked as available. // is then marked as available.
enum enum
{ {
kChCntAvId, kChCntAvId,
@ -5895,19 +5895,39 @@ cmDspRC_t _cmDspAvailCh_Recv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_
// if ch[i] is the first avail inactive channel // if ch[i] is the first avail inactive channel
if( fl && !activeFl ) if( fl && !activeFl )
{ {
cmDspSetUInt(ctx,inst,kChIdxAvId,i); // activate the available channel
cmDspSetBool(ctx, inst, p->baseDisInAvId + i, true); //cmDspSetUInt(ctx,inst,kChIdxAvId,j);
cmDspSetBool(ctx, inst, p->baseGateOutAvId + i, true); //cmDspSetBool(ctx, inst, p->baseDisInAvId + j, true);
//cmDspSetBool(ctx, inst, p->baseGateOutAvId + j, true);
j = i; j = i;
fl = false; fl = false;
} }
// if ch[i] is active - then request that it shutdown // if ch[i] is active - then request that it shutdown
if( activeFl && exclModeFl) //if( activeFl && exclModeFl)
cmDspSetBool(ctx, inst, p->baseGateOutAvId + i, false); // cmDspSetBool(ctx, inst, p->baseGateOutAvId + i, false);
} }
if( j==-1 )
cmDspInstErr(ctx,inst,kInvalidStateDspRC,"No available channels exist.");
else
{
// activate the available channel
cmDspSetUInt(ctx,inst,kChIdxAvId,j);
cmDspSetBool(ctx, inst, p->baseDisInAvId + j, true);
cmDspSetBool(ctx, inst, p->baseGateOutAvId + j, true);
if( exclModeFl )
{
for(i=0; i<p->chCnt; ++i)
if( i!=j && cmDspBool(inst,p->baseDisInAvId+i) )
cmDspSetBool(ctx,inst, p->baseGateOutAvId+i, false );
}
}
return rc; return rc;
} }