Browse Source

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

no available channels are available.
master
kevin 11 years ago
parent
commit
e7429a773c
1 changed files with 28 additions and 8 deletions
  1. 28
    8
      dsp/cmDspFx.c

+ 28
- 8
dsp/cmDspFx.c View File

@@ -5768,8 +5768,8 @@ struct cmDspClass_str* cmRouterClassCons( cmDspCtx_t* ctx )
5768 5768
 //   The gate[] output is designed to work with the gate[] input of Xfader.  When
5769 5769
 //   availCh.gate[] goes high Xfader fades in, when availCh.gate[] goes low
5770 5770
 //   Xfader fades out.  The dis[] channel is designed to connect from Xfader.state[].
5771
-//   When Xfader.state[] goes low, when a fade-out is complete, the connected AvailCh 
5772
-//   is marked as available. 
5771
+//   Xfader.state[] goes low when a fade-out is complete, the connected AvailCh 
5772
+//   is then marked as available. 
5773 5773
 enum
5774 5774
 {
5775 5775
   kChCntAvId,
@@ -5895,19 +5895,39 @@ cmDspRC_t _cmDspAvailCh_Recv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_
5895 5895
       // if ch[i] is the first avail inactive channel
5896 5896
       if( fl && !activeFl )
5897 5897
       {
5898
-        cmDspSetUInt(ctx,inst,kChIdxAvId,i);
5899
-        cmDspSetBool(ctx, inst, p->baseDisInAvId   + i, true);
5900
-        cmDspSetBool(ctx, inst, p->baseGateOutAvId + i, true);
5901
-        j = i;
5898
+        // activate the available channel
5899
+        //cmDspSetUInt(ctx,inst,kChIdxAvId,j);
5900
+        //cmDspSetBool(ctx, inst, p->baseDisInAvId   + j, true);
5901
+        //cmDspSetBool(ctx, inst, p->baseGateOutAvId + j, true);
5902
+
5903
+        j  = i;
5902 5904
         fl = false;
5903 5905
       }
5904 5906
 
5905 5907
       // if ch[i] is active - then request that it shutdown 
5906
-      if( activeFl && exclModeFl)
5907
-        cmDspSetBool(ctx, inst, p->baseGateOutAvId + i, false);
5908
+      //if( activeFl && exclModeFl)
5909
+      //  cmDspSetBool(ctx, inst, p->baseGateOutAvId + i, false);
5910
+
5911
+    }
5912
+
5913
+    if( j==-1 )
5914
+      cmDspInstErr(ctx,inst,kInvalidStateDspRC,"No available channels exist.");
5915
+    else
5916
+    {
5917
+      // activate the available channel
5918
+      cmDspSetUInt(ctx,inst,kChIdxAvId,j);
5919
+      cmDspSetBool(ctx, inst, p->baseDisInAvId   + j, true);
5920
+      cmDspSetBool(ctx, inst, p->baseGateOutAvId + j, true);
5908 5921
 
5922
+      if( exclModeFl )
5923
+      {
5924
+        for(i=0; i<p->chCnt; ++i)
5925
+          if( i!=j && cmDspBool(inst,p->baseDisInAvId+i) )
5926
+            cmDspSetBool(ctx,inst, p->baseGateOutAvId+i, false );
5927
+      }
5909 5928
     }
5910 5929
 
5930
+    
5911 5931
     return rc;
5912 5932
   }
5913 5933
 

Loading…
Cancel
Save