|
@@ -1423,6 +1423,7 @@ enum
|
1423
|
1423
|
kMstrGateXfId,
|
1424
|
1424
|
kFadeInTimeMsXfId,
|
1425
|
1425
|
kFadeOutTimeMsXfId,
|
|
1426
|
+ kResetXfId,
|
1426
|
1427
|
kOnXfId,
|
1427
|
1428
|
kOffXfId,
|
1428
|
1429
|
kGateBaseXfId,
|
|
@@ -1453,6 +1454,7 @@ cmDspInst_t* _cmDspXfaderAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsigne
|
1453
|
1454
|
{ "mgate", kMstrGateXfId, 0, 0, kInDsvFl | kBoolDsvFl | kOptArgDsvFl, "Master gate - can be used to set all gates."},
|
1454
|
1455
|
{ "ims", kFadeInTimeMsXfId, 0, 0, kInDsvFl | kDoubleDsvFl | kOptArgDsvFl, "Fade in time in milliseonds."},
|
1455
|
1456
|
{ "oms", kFadeOutTimeMsXfId, 0, 0, kInDsvFl | kDoubleDsvFl | kOptArgDsvFl, "Fade out time in milliseonds."},
|
|
1457
|
+ { "reset", kResetXfId, 0, 0, kInDsvFl | kBoolDsvFl, "Jump to gate states rather than fade."},
|
1456
|
1458
|
{ "on", kOnXfId, 0, 0, kOutDsvFl | kSymDsvFl, "Send 'on' when all ch's transition from off to on."},
|
1457
|
1459
|
{ "off", kOffXfId, 0, 0, kOutDsvFl | kSymDsvFl, "Send 'off' when all ch's transition from on to off."},
|
1458
|
1460
|
};
|
|
@@ -1551,7 +1553,7 @@ cmDspRC_t _cmDspXfaderExec(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t*
|
1551
|
1553
|
cmSample_t* op = cmDspAudioBuf(ctx,inst,p->outBaseXfId+i,0);
|
1552
|
1554
|
const cmSample_t* ip = cmDspAudioBuf(ctx,inst,p->inBaseXfId+i,0);
|
1553
|
1555
|
cmSample_t gain = (cmSample_t)p->xfdp->chArray[i].ep_gain;
|
1554
|
|
-
|
|
1556
|
+
|
1555
|
1557
|
if( op != NULL )
|
1556
|
1558
|
{
|
1557
|
1559
|
if( ip == NULL )
|
|
@@ -1568,6 +1570,19 @@ cmDspRC_t _cmDspXfaderExec(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t*
|
1568
|
1570
|
|
1569
|
1571
|
// send the gain output
|
1570
|
1572
|
cmDspSetDouble(ctx,inst,p->gainBaseXfId+i,gain);
|
|
1573
|
+
|
|
1574
|
+ /*
|
|
1575
|
+ if( gain > 0 )
|
|
1576
|
+ printf("(%i %f %i %i %i %f)",
|
|
1577
|
+ i,
|
|
1578
|
+ gain,
|
|
1579
|
+ p->chGateV[i],
|
|
1580
|
+ cmDspBool(inst,p->stateBaseXfId+i),
|
|
1581
|
+ p->xfdp->chArray[i].gateFl,
|
|
1582
|
+ p->xfdp->chArray[i].gain);
|
|
1583
|
+ */
|
|
1584
|
+
|
|
1585
|
+
|
1571
|
1586
|
}
|
1572
|
1587
|
|
1573
|
1588
|
if( p->xfdp->onFl )
|
|
@@ -1611,6 +1626,22 @@ cmDspRC_t _cmDspXfaderRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t*
|
1611
|
1626
|
cmXfaderSetXfadeOutTime(p->xfdp,cmDspDouble(inst,kFadeOutTimeMsXfId));
|
1612
|
1627
|
break;
|
1613
|
1628
|
|
|
1629
|
+ case kResetXfId:
|
|
1630
|
+ {
|
|
1631
|
+ cmXfaderExec( p->xfdp, cmDspSamplesPerCycle(ctx), p->chGateV, p->chCnt );
|
|
1632
|
+ cmXfaderJumpToDestinationGain(p->xfdp);
|
|
1633
|
+ // force the chGateV[] to match the xfaders state
|
|
1634
|
+ int i;
|
|
1635
|
+ for(i=0; i<p->chCnt; ++i)
|
|
1636
|
+ {
|
|
1637
|
+ bool gateFl = p->xfdp->chArray[i].gateFl;
|
|
1638
|
+ p->chGateV[i] = gateFl;
|
|
1639
|
+ cmDspSetBool( ctx,inst,p->stateBaseXfId + i, gateFl);
|
|
1640
|
+ cmDspSetDouble(ctx,inst,p->gainBaseXfId + i, gateFl ? 1.0 : 0.0 );
|
|
1641
|
+ }
|
|
1642
|
+ }
|
|
1643
|
+ break;
|
|
1644
|
+
|
1614
|
1645
|
}
|
1615
|
1646
|
|
1616
|
1647
|
// record gate changes into p->chGateV[] for later use in _cmDspXfaderExec().
|
|
@@ -5744,6 +5775,7 @@ enum
|
5744
|
5775
|
kChCntAvId,
|
5745
|
5776
|
kModeAvId,
|
5746
|
5777
|
kTrigAvId,
|
|
5778
|
+ kResetAvId,
|
5747
|
5779
|
kChIdxAvId,
|
5748
|
5780
|
kBaseDisInAvId,
|
5749
|
5781
|
|
|
@@ -5789,6 +5821,7 @@ cmDspInst_t* _cmDspAvailCh_Alloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsig
|
5789
|
5821
|
1, "chs", kChCntAvId, 0, 0, kUIntDsvFl | kReqArgDsvFl, "Channel count.",
|
5790
|
5822
|
1, "mode", kModeAvId, 0, 0, kUIntDsvFl | kInDsvFl, "Mode: 0=exclusive (dflt) 1=multi",
|
5791
|
5823
|
1, "trig", kTrigAvId, 0, 0, kTypeDsvMask | kInDsvFl, "Trigger the unit to select the next available channel.",
|
|
5824
|
+ 1, "reset", kResetAvId, 0, 0, kBoolDsvFl | kInDsvFl | kOutDsvFl, "Reset to default state",
|
5792
|
5825
|
1, "ch", kChIdxAvId, 0, 0, kUIntDsvFl | kOutDsvFl, "Currently selected channel.",
|
5793
|
5826
|
chCnt, "dis", baseDisInAvId, 0, 0, kBoolDsvFl | kInDsvFl, "Disable channel gate",
|
5794
|
5827
|
chCnt, "gate", baseGateOutAvId, 0, 0, kBoolDsvFl | kOutDsvFl, "Active channel gate",
|
|
@@ -5831,14 +5864,32 @@ cmDspRC_t _cmDspAvailCh_Recv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_
|
5831
|
5864
|
|
5832
|
5865
|
bool exclModeFl = cmDspUInt(inst, kModeAvId ) == kExclusiveModeAvId;
|
5833
|
5866
|
|
|
5867
|
+ if( evt->dstVarId == kResetAvId )
|
|
5868
|
+ {
|
|
5869
|
+ unsigned i;
|
|
5870
|
+
|
|
5871
|
+ cmDspSetUInt(ctx,inst,kChIdxAvId,0);
|
|
5872
|
+
|
|
5873
|
+ for(i=0; i<p->chCnt; ++i)
|
|
5874
|
+ {
|
|
5875
|
+ bool fl = i==0;
|
|
5876
|
+ cmDspSetBool(ctx, inst, p->baseDisInAvId + i, !fl);
|
|
5877
|
+ cmDspSetBool(ctx, inst, p->baseGateOutAvId + i, fl);
|
|
5878
|
+ }
|
|
5879
|
+
|
|
5880
|
+ cmDspSetBool(ctx,inst, kResetAvId, false );
|
|
5881
|
+
|
|
5882
|
+ return rc;
|
|
5883
|
+ }
|
|
5884
|
+
|
5834
|
5885
|
// if this is a trigger
|
5835
|
5886
|
if( evt->dstVarId == kTrigAvId )
|
5836
|
5887
|
{
|
5837
|
|
- unsigned i;
|
|
5888
|
+ unsigned i,j=-1;
|
5838
|
5889
|
bool fl = true;
|
5839
|
5890
|
for(i=0; i<p->chCnt; ++i)
|
5840
|
5891
|
{
|
5841
|
|
- // the actual channel's active state is held in the 'dis' variable.
|
|
5892
|
+ // the channel's active state is held in the 'dis' variable.
|
5842
|
5893
|
bool activeFl = cmDspBool(inst,p->baseDisInAvId+i);
|
5843
|
5894
|
|
5844
|
5895
|
// if ch[i] is the first avail inactive channel
|
|
@@ -5847,6 +5898,7 @@ cmDspRC_t _cmDspAvailCh_Recv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_
|
5847
|
5898
|
cmDspSetUInt(ctx,inst,kChIdxAvId,i);
|
5848
|
5899
|
cmDspSetBool(ctx, inst, p->baseDisInAvId + i, true);
|
5849
|
5900
|
cmDspSetBool(ctx, inst, p->baseGateOutAvId + i, true);
|
|
5901
|
+ j = i;
|
5850
|
5902
|
fl = false;
|
5851
|
5903
|
}
|
5852
|
5904
|
|
|
@@ -5855,9 +5907,12 @@ cmDspRC_t _cmDspAvailCh_Recv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_
|
5855
|
5907
|
cmDspSetBool(ctx, inst, p->baseGateOutAvId + i, false);
|
5856
|
5908
|
|
5857
|
5909
|
}
|
|
5910
|
+
|
5858
|
5911
|
return rc;
|
5859
|
5912
|
}
|
5860
|
5913
|
|
|
5914
|
+
|
|
5915
|
+
|
5861
|
5916
|
// if this is an incoming disable message.
|
5862
|
5917
|
if( p->baseDisInAvId <= evt->dstVarId && evt->dstVarId < p->baseDisInAvId+p->chCnt && cmDsvGetBool(evt->valuePtr) == false)
|
5863
|
5918
|
{
|