Merge branch 'develop' of gitea.larke.org:klarke/libcm into develop
This commit is contained in:
commit
47d4dda2b0
17
.gitignore
vendored
17
.gitignore
vendored
@ -1,3 +1,20 @@
|
||||
Makefile.in
|
||||
.DS_Store
|
||||
aclocal.m4
|
||||
config.h.in
|
||||
config.h.in~
|
||||
configure
|
||||
Makefile.in
|
||||
|
||||
autom4te.cache
|
||||
build-aux
|
||||
|
||||
m4/libtool.m4
|
||||
m4/lt~obsolete.m4
|
||||
m4/libtool.m4
|
||||
m4/ltoptions.m4
|
||||
m4/ltsugar.m4
|
||||
m4/ltversion.m4
|
||||
m4/lt~obsolete.m4
|
||||
m4/.DS_Store
|
||||
|
||||
|
@ -355,9 +355,14 @@ cmAdRC_t _cmAdParseSysJsonTree( cmAd_t* p )
|
||||
cmAudioSysArgs_t* asap = &p->asCfgArray[i].cfg.ssArray[j].args;
|
||||
const cmJsonNode_t* argsNodePtr = cmJsonArrayElementC(ssArrayNodePtr,j);
|
||||
|
||||
asap->inDevIdx = cmInvalidIdx;
|
||||
asap->outDevIdx = cmInvalidIdx;
|
||||
asap->inDevLabel = NULL;
|
||||
asap->outDevLabel = NULL;
|
||||
|
||||
if((jsRC = cmJsonMemberValues( argsNodePtr, &errLabelPtr,
|
||||
"inDevIdx", kIntTId, &asap->inDevIdx,
|
||||
"outDevIdx", kIntTId, &asap->outDevIdx,
|
||||
"inDevLabel", kStringTId, &asap->inDevLabel,
|
||||
"outDevLabel", kStringTId, &asap->outDevLabel,
|
||||
"syncToInputFl", kTrueTId, &asap->syncInputFl,
|
||||
"msgQueueByteCnt", kIntTId, &asap->msgQueueByteCnt,
|
||||
"devFramesPerCycle", kIntTId, &asap->devFramesPerCycle,
|
||||
@ -443,6 +448,35 @@ cmAdRC_t _cmAdCreateAggDevices( cmAd_t* p )
|
||||
return rc;
|
||||
}
|
||||
|
||||
cmAdRC_t _cmAdResolveDeviceLabels( cmAd_t* p )
|
||||
{
|
||||
cmAdRC_t rc = kOkAdRC;
|
||||
unsigned i,j;
|
||||
|
||||
// for each cmAsAudioSysCfg record in audioSysCfgArray[]
|
||||
for(i=0; i<p->asCfgCnt; ++i)
|
||||
{
|
||||
// for each audio system sub-subsystem
|
||||
for(j=0; j<p->asCfgArray[i].cfg.ssCnt; ++j)
|
||||
{
|
||||
cmAudioSysArgs_t* asap = &p->asCfgArray[i].cfg.ssArray[j].args;
|
||||
if((asap->inDevIdx = cmApDeviceLabelToIndex( asap->inDevLabel )) == cmInvalidId )
|
||||
{
|
||||
rc = cmErrMsg(&p->err,kInvalidAudioDevIdxAdRC,"The audio input device '%s' could not be found.", cmStringNullGuard(asap->inDevLabel));
|
||||
goto errLabel;
|
||||
}
|
||||
|
||||
if((asap->outDevIdx = cmApDeviceLabelToIndex( asap->outDevLabel )) == cmInvalidId )
|
||||
{
|
||||
rc = cmErrMsg(&p->err,kInvalidAudioDevIdxAdRC,"The audio input device '%s' could not be found.", cmStringNullGuard(asap->inDevLabel));
|
||||
goto errLabel;
|
||||
}
|
||||
}
|
||||
}
|
||||
errLabel:
|
||||
return rc;
|
||||
}
|
||||
|
||||
cmAdRC_t _cmAdCreateNrtDevices( cmAd_t* p )
|
||||
{
|
||||
cmAdRC_t rc = kOkAdRC;
|
||||
@ -721,6 +755,7 @@ cmAdRC_t cmAudDspAlloc( cmCtx_t* ctx, cmAdH_t* hp, cmMsgSendFuncPtr_t cbFunc, vo
|
||||
if((rc = _cmAdParseSysJsonTree(p)) != kOkAdRC )
|
||||
goto errLabel;
|
||||
|
||||
|
||||
// create the aggregate device
|
||||
if( _cmAdCreateAggDevices(p) != kOkAdRC )
|
||||
goto errLabel;
|
||||
@ -740,6 +775,12 @@ cmAdRC_t cmAudDspAlloc( cmCtx_t* ctx, cmAdH_t* hp, cmMsgSendFuncPtr_t cbFunc, vo
|
||||
goto errLabel;
|
||||
}
|
||||
|
||||
if( _cmAdResolveDeviceLabels(p) != kOkApRC )
|
||||
{
|
||||
rc = cmErrMsg(&p->err,kAudioPortFailAdRC,"Audio device labels could not be resolved..");
|
||||
goto errLabel;
|
||||
}
|
||||
|
||||
// initialize the audio buffer
|
||||
if( cmApBufInitialize( cmApDeviceCount(), p->meterMs ) != kOkApRC )
|
||||
{
|
||||
|
@ -27,7 +27,8 @@ extern "C" {
|
||||
kAggDevCreateFailAdRC,
|
||||
kNrtDevSysFailAdRC,
|
||||
kAfpDevSysFailAdRC,
|
||||
kNetSysFailAdRC
|
||||
kNetSysFailAdRC,
|
||||
kInvalidAudioDevIdxAdRC
|
||||
};
|
||||
|
||||
|
||||
|
@ -189,6 +189,10 @@ cmApRC_t cmApNrtAllocate( cmRpt_t* rpt )
|
||||
cmApRC_t cmApNrtFree()
|
||||
{
|
||||
cmApRC_t rc = kOkApRC;
|
||||
|
||||
if( _cmNrt == NULL )
|
||||
return rc;
|
||||
|
||||
cmApNrtDev_t* dp = _cmNrt->devs;
|
||||
while( dp != NULL )
|
||||
{
|
||||
|
@ -131,8 +131,10 @@ extern "C" {
|
||||
typedef struct cmAudioSysArgs_str
|
||||
{
|
||||
cmRpt_t* rpt; // system console object
|
||||
unsigned inDevIdx; // input audio device
|
||||
unsigned outDevIdx; // output audio device
|
||||
const cmChar_t* inDevLabel; // input audio device text label
|
||||
const cmChar_t* outDevLabel; // output audio device text label
|
||||
unsigned inDevIdx; // input audio device index
|
||||
unsigned outDevIdx; // output audio device index
|
||||
bool syncInputFl; // true/false sync the DSP update callbacks with audio input/output
|
||||
unsigned msgQueueByteCnt; // Size of the internal msg queue used to buffer msgs arriving via cmAudioSysDeliverMsg().
|
||||
unsigned devFramesPerCycle; // (512) Audio device samples per channel per device update buffer.
|
||||
|
45
src/cmPP_NARG.h
Normal file
45
src/cmPP_NARG.h
Normal file
@ -0,0 +1,45 @@
|
||||
#ifndef cmPP_NARG_H
|
||||
#define cmPP_NARG_H
|
||||
|
||||
|
||||
// Taken from here:
|
||||
// https://groups.google.com/forum/#!topic/comp.std.c/d-6Mj5Lko_s
|
||||
// and here:
|
||||
// https://stackoverflow.com/questions/4421681/how-to-count-the-number-of-arguments-passed-to-a-function-that-accepts-a-variabl
|
||||
|
||||
#define PP_NARG(...) \
|
||||
PP_NARG_(__VA_ARGS__,PP_RSEQ_N())
|
||||
|
||||
#define PP_NARG_(...) \
|
||||
PP_128TH_ARG(__VA_ARGS__)
|
||||
|
||||
#define PP_128TH_ARG( \
|
||||
_1, _2, _3, _4, _5, _6, _7, _8, _9,_10, \
|
||||
_11,_12,_13,_14,_15,_16,_17,_18,_19,_20, \
|
||||
_21,_22,_23,_24,_25,_26,_27,_28,_29,_30, \
|
||||
_31,_32,_33,_34,_35,_36,_37,_38,_39,_40, \
|
||||
_41,_42,_43,_44,_45,_46,_47,_48,_49,_50, \
|
||||
_51,_52,_53,_54,_55,_56,_57,_58,_59,_60, \
|
||||
_61,_62,_63,_64,_65,_66,_67,_68,_69,_70, \
|
||||
_71,_72,_73,_74,_75,_76,_77,_78,_79,_80, \
|
||||
_81,_82,_83,_84,_85,_86,_87,_88,_89,_90, \
|
||||
_91,_92,_93,_94,_95,_96,_97,_98,_99,_100, \
|
||||
_101,_102,_103,_104,_105,_106,_107,_108,_109,_110, \
|
||||
_111,_112,_113,_114,_115,_116,_117,_118,_119,_120, \
|
||||
_121,_122,_123,_124,_125,_126,_127,N,...) N
|
||||
#define PP_RSEQ_N() \
|
||||
127,126,125,124,123,122,121,120, \
|
||||
119,118,117,116,115,114,113,112,111,110, \
|
||||
109,108,107,106,105,104,103,102,101,100, \
|
||||
99,98,97,96,95,94,93,92,91,90, \
|
||||
89,88,87,86,85,84,83,82,81,80, \
|
||||
79,78,77,76,75,74,73,72,71,70, \
|
||||
69,68,67,66,65,64,63,62,61,60, \
|
||||
59,58,57,56,55,54,53,52,51,50, \
|
||||
49,48,47,46,45,44,43,42,41,40, \
|
||||
39,38,37,36,35,34,33,32,31,30, \
|
||||
29,28,27,26,25,24,23,22,21,20, \
|
||||
19,18,17,16,15,14,13,12,11,10, \
|
||||
9,8,7,6,5,4,3,2,1,0
|
||||
|
||||
#endif
|
@ -1067,6 +1067,7 @@ enum
|
||||
{
|
||||
kChAoId,
|
||||
kGainAoId,
|
||||
kEnableAoId,
|
||||
kInAoId
|
||||
};
|
||||
|
||||
@ -1075,6 +1076,8 @@ cmDspClass_t _cmAudioOutDC;
|
||||
typedef struct
|
||||
{
|
||||
cmDspInst_t inst;
|
||||
unsigned onSymId;
|
||||
unsigned offSymId;
|
||||
} cmDspAudioOut_t;
|
||||
|
||||
cmDspInst_t* _cmDspAudioOutAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsigned storeSymId, unsigned instSymId, unsigned id, unsigned va_cnt, va_list vl )
|
||||
@ -1082,16 +1085,21 @@ cmDspInst_t* _cmDspAudioOutAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsig
|
||||
cmDspVarArg_t args[] =
|
||||
{
|
||||
{ "ch", kChAoId, 0, 0, kInDsvFl | kUIntDsvFl | kReqArgDsvFl, "Audio output channel index"},
|
||||
{ "gain",kGainAoId,0, 0, kInDsvFl | kDoubleDsvFl | kOptArgDsvFl, "Output gain multiplier"},
|
||||
{ "gain", kGainAoId, 0, 0, kInDsvFl | kDoubleDsvFl | kOptArgDsvFl, "Output gain multiplier"},
|
||||
{ "enable",kEnableAoId,0, 0, kInDsvFl | kSymDsvFl | kOptArgDsvFl, "Enable: on off"},
|
||||
{ "in", kInAoId, 0, 1, kInDsvFl | kAudioBufDsvFl, "Audio input" },
|
||||
{ NULL, 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
cmDspAudioOut_t* p = cmDspInstAlloc(cmDspAudioOut_t,ctx,classPtr,args,instSymId,id,storeSymId,va_cnt,vl);
|
||||
|
||||
p->offSymId = cmSymTblRegisterStaticSymbol(ctx->stH,"off");
|
||||
p->onSymId = cmSymTblRegisterStaticSymbol(ctx->stH,"on");
|
||||
|
||||
|
||||
cmDspSetDefaultUInt( ctx, &p->inst, kChAoId, 0, 0);
|
||||
cmDspSetDefaultDouble( ctx, &p->inst, kGainAoId, 0, 1.0);
|
||||
cmDspSetDefaultSymbol( ctx, &p->inst, kEnableAoId, p->onSymId );
|
||||
|
||||
return &p->inst;
|
||||
}
|
||||
@ -1107,7 +1115,9 @@ cmDspRC_t _cmDspAudioOutReset(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt
|
||||
cmDspRC_t _cmDspAudioOutExec(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t* evt )
|
||||
{
|
||||
cmDspRC_t rc = kOkDspRC;
|
||||
cmDspAudioOut_t* p = (cmDspAudioOut_t*)inst;
|
||||
unsigned chIdx = cmDspUInt(inst,kChAoId);
|
||||
bool enableFl = cmDspSymbol(inst,kEnableAoId) == p->onSymId;
|
||||
unsigned oChCnt = ctx->ctx->oChCnt;
|
||||
double gain = cmDspDouble(inst,kGainAoId);
|
||||
|
||||
@ -1132,7 +1142,7 @@ cmDspRC_t _cmDspAudioOutExec(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_
|
||||
|
||||
// if this channel is disabled or set to pass-through then chArray[chIdx] will be NULL
|
||||
if( ctx->ctx->oChArray[chIdx] != NULL )
|
||||
cmVOS_MultVVS(ctx->ctx->oChArray[chIdx],n,sp,(cmSample_t)gain);
|
||||
cmVOS_MultVVS(ctx->ctx->oChArray[chIdx],n,sp, (cmSample_t)(enableFl ? gain : 0));
|
||||
|
||||
return kOkDspRC;
|
||||
}
|
||||
@ -1154,6 +1164,11 @@ cmDspRC_t _cmDspAudioOutRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_
|
||||
case kGainAoId:
|
||||
cmDspSetEvent(ctx,inst,evt);
|
||||
break;
|
||||
|
||||
case kEnableAoId:
|
||||
cmDspSetEvent(ctx,inst,evt);
|
||||
break;
|
||||
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
@ -2907,6 +2922,7 @@ enum
|
||||
kLoopWtId,
|
||||
kBegWtId,
|
||||
kEndWtId,
|
||||
kChWtId,
|
||||
kCmdWtId,
|
||||
kOtWtId,
|
||||
kGainWtId,
|
||||
@ -2951,6 +2967,7 @@ typedef struct
|
||||
cmAudioFileH_t afH; // current audio file handle
|
||||
int nxtBegSmpIdx; // the beg/end sample index to use with the next filename to arrive at port 'fn'
|
||||
int nxtEndSmpIdx; //
|
||||
unsigned nxtChIdx;
|
||||
cmThreadH_t thH;
|
||||
bool loadFileFl;
|
||||
cmDspCtx_t* ctx;
|
||||
@ -2976,6 +2993,7 @@ cmDspInst_t* _cmDspWaveTableAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsi
|
||||
{ "loop", kLoopWtId, 0, 0, kInDsvFl | kIntDsvFl | kOptArgDsvFl, "-1=loop forever >0=loop count (dflt:-1)"},
|
||||
{ "beg", kBegWtId, 0, 0, kInDsvFl | kIntDsvFl | kOptArgDsvFl, "File begin sample index" },
|
||||
{ "end", kEndWtId, 0, 0, kInDsvFl | kIntDsvFl | kOptArgDsvFl, "File end sample index (-1=play all)" },
|
||||
{ "ch", kChWtId, 0, 0, kInDsvFl | kUIntDsvFl | kOptArgDsvFl, "File channel index 0=left, 1=right" },
|
||||
{ "cmd", kCmdWtId, 0, 0, kInDsvFl | kSymDsvFl | kOptArgDsvFl, "Command: on off"},
|
||||
{ "ot", kOtWtId, 0, 0, kInDsvFl | kUIntDsvFl | kOptArgDsvFl, "Overtone count"},
|
||||
{ "gain", kGainWtId, 0, 0, kInDsvFl | kDoubleDsvFl|kOptArgDsvFl, "Gain"},
|
||||
@ -3005,6 +3023,7 @@ cmDspInst_t* _cmDspWaveTableAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsi
|
||||
cmDspSetDefaultInt( ctx, &p->inst, kLoopWtId, 0, -1 );
|
||||
cmDspSetDefaultInt( ctx, &p->inst, kBegWtId, 0, 0 );
|
||||
cmDspSetDefaultInt( ctx, &p->inst, kEndWtId, 0, -1 );
|
||||
cmDspSetDefaultUInt( ctx, &p->inst, kChWtId, 0, 0 );
|
||||
cmDspSetDefaultSymbol(ctx, &p->inst, kCmdWtId, p->onSymId );
|
||||
cmDspSetDefaultUInt( ctx, &p->inst, kOtWtId, 0, 5 );
|
||||
cmDspSetDefaultDouble(ctx, &p->inst, kGainWtId, 0, 1.0 );
|
||||
@ -3038,10 +3057,9 @@ cmDspRC_t _cmDspWaveTableFree(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt
|
||||
// mode then the the function will automatically begin reading from the begining of the
|
||||
// file segment. If the end of the file segment is encountered and the wave table is not
|
||||
// in loop mode then the empty portion of wt[] will be set to zero.
|
||||
cmDspRC_t _cmDspWaveTableReadBlock( cmDspCtx_t* ctx, cmDspWaveTable_t* p, cmSample_t* wt, unsigned rdSmpCnt, int begSmpIdx, int endSmpIdx, int maxLoopCnt )
|
||||
cmDspRC_t _cmDspWaveTableReadBlock( cmDspCtx_t* ctx, cmDspWaveTable_t* p, cmSample_t* wt, unsigned rdSmpCnt, unsigned chIdx, int begSmpIdx, int endSmpIdx, int maxLoopCnt )
|
||||
{
|
||||
unsigned actFrmCnt = 0;
|
||||
unsigned chIdx = 0;
|
||||
unsigned chCnt = 1;
|
||||
unsigned fn = endSmpIdx - p->fi + 1; // count of samples between p->fi and endSmpIdx
|
||||
unsigned n0 = rdSmpCnt;
|
||||
@ -3117,9 +3135,10 @@ cmDspRC_t _cmDspWaveTableReadAudioFile( cmDspCtx_t* ctx, cmDspWaveTable_t* p, un
|
||||
{
|
||||
unsigned n0 = rdSmpCnt;
|
||||
unsigned n1 = 0;
|
||||
int begSmpIdx = cmDspInt(&p->inst,kBegWtId);
|
||||
int endSmpIdx = cmDspInt(&p->inst,kEndWtId);
|
||||
int maxLoopCnt= cmDspInt(&p->inst,kLoopWtId);
|
||||
int begSmpIdx = cmDspInt( &p->inst,kBegWtId);
|
||||
int endSmpIdx = cmDspInt( &p->inst,kEndWtId);
|
||||
unsigned chIdx = cmDspUInt(&p->inst,kChWtId);
|
||||
int maxLoopCnt= cmDspInt( &p->inst,kLoopWtId);
|
||||
|
||||
if( endSmpIdx < begSmpIdx )
|
||||
endSmpIdx = p->fn-1;
|
||||
@ -3137,7 +3156,7 @@ cmDspRC_t _cmDspWaveTableReadAudioFile( cmDspCtx_t* ctx, cmDspWaveTable_t* p, un
|
||||
if( p->doneFl )
|
||||
cmVOS_Zero(p->wt + p->wti,n0);
|
||||
else
|
||||
if( _cmDspWaveTableReadBlock(ctx, p, p->wt+p->wti, n0,begSmpIdx,endSmpIdx,maxLoopCnt ) != kOkDspRC )
|
||||
if( _cmDspWaveTableReadBlock(ctx, p, p->wt+p->wti, n0, chIdx, begSmpIdx,endSmpIdx,maxLoopCnt ) != kOkDspRC )
|
||||
return cmDspInstErr(ctx,&p->inst,kVarNotValidDspRC,"An error occured while reading the wave table file.");
|
||||
|
||||
p->wtn -= n0; // decrease the count of available samples
|
||||
@ -3149,7 +3168,7 @@ cmDspRC_t _cmDspWaveTableReadAudioFile( cmDspCtx_t* ctx, cmDspWaveTable_t* p, un
|
||||
if( p->doneFl )
|
||||
cmVOS_Zero(p->wt,n1);
|
||||
else
|
||||
if( _cmDspWaveTableReadBlock(ctx, p, p->wt, n1,begSmpIdx,endSmpIdx,maxLoopCnt ) != kOkDspRC )
|
||||
if( _cmDspWaveTableReadBlock(ctx, p, p->wt, n1, chIdx, begSmpIdx,endSmpIdx,maxLoopCnt ) != kOkDspRC )
|
||||
return cmDspInstErr(ctx,&p->inst,kVarNotValidDspRC,"An error occured while reading the wave table file.");
|
||||
|
||||
p->wtn -= n1; // decrease the count of available samples
|
||||
@ -3382,6 +3401,7 @@ cmDspRC_t _cmDspWaveTableReset(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEv
|
||||
|
||||
p->nxtBegSmpIdx = cmDspInt(&p->inst,kBegWtId);
|
||||
p->nxtEndSmpIdx = cmDspInt(&p->inst,kEndWtId);
|
||||
p->nxtChIdx = cmDspUInt(&p->inst,kChWtId);
|
||||
|
||||
return _cmDspWaveTableCreateTable(ctx,p);
|
||||
|
||||
@ -3490,6 +3510,7 @@ cmDspRC_t _cmDspWaveTableRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt
|
||||
cmDspSetEvent(ctx,inst,evt); // set the file name variable
|
||||
cmDspSetInt(ctx,inst,kBegWtId,p->nxtBegSmpIdx); // set the beg/end smp idx var's from the stored nxtBeg/EndSmpIdx values
|
||||
cmDspSetInt(ctx,inst,kEndWtId,p->nxtEndSmpIdx); //
|
||||
cmDspSetUInt(ctx,inst,kChWtId, p->nxtChIdx); //
|
||||
cmDspSetUInt(ctx,inst,kShapeWtId,kFileWtId); // switch to file mode
|
||||
rc = _cmDspWaveTableCreateTable(ctx,p); // reload the wavetable
|
||||
}
|
||||
@ -3506,6 +3527,11 @@ cmDspRC_t _cmDspWaveTableRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt
|
||||
p->nxtEndSmpIdx = cmDsvGetInt(evt->valuePtr);
|
||||
break;
|
||||
|
||||
case kChWtId:
|
||||
// store for next incoming file name msg
|
||||
p->nxtChIdx = cmDsvGetUInt(evt->valuePtr);
|
||||
break;
|
||||
|
||||
case kShapeWtId:
|
||||
if( cmDsvGetUInt(evt->valuePtr) < kShapeWtCnt )
|
||||
{
|
||||
@ -5546,6 +5572,7 @@ cmDspClassConsFunc_t _cmDspClassBuiltInArray[] =
|
||||
cm1UpClassCons,
|
||||
cmGateToSymClassCons,
|
||||
cmPortToSymClassCons,
|
||||
cmIntToSymClassCons,
|
||||
cmRouterClassCons,
|
||||
cmAvailChClassCons,
|
||||
|
||||
|
@ -5587,6 +5587,7 @@ cmDspInst_t* _cmDspPortToSym_Alloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, uns
|
||||
// register the symbol
|
||||
symIdArray[i] = cmSymTblRegisterSymbol(ctx->stH,symLabel);
|
||||
|
||||
// input port - any msg in this port will generate an output from 'out' as well as the associated output port
|
||||
cmDspArgSetup(ctx, args+kBaseInPtsId+i, symLabel, cmInvalidId, kBaseInPtsId+i, 0, 0, kInDsvFl | kTypeDsvMask, cmTsPrintfH(ctx->lhH,"%s Input.",symLabel) );
|
||||
|
||||
cmDspArgSetup(ctx, args+baseOutPtsId+i, symLabel, cmInvalidId, baseOutPtsId+i, 0, 0, kOutDsvFl | kSymDsvFl, cmTsPrintfH(ctx->lhH,"%s Output.",symLabel) );
|
||||
@ -5631,7 +5632,7 @@ cmDspRC_t _cmDspPortToSym_Recv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEv
|
||||
unsigned idx = evt->dstVarId - kBaseInPtsId;
|
||||
assert( idx < p->symIdCnt );
|
||||
cmDspSetSymbol(ctx,inst,p->baseOutPtsId + idx, p->symIdArray[idx]);
|
||||
return cmDspSetSymbol(ctx,inst,kOutPtsId,p->symIdArray[ evt->dstVarId - kBaseInPtsId ]);
|
||||
return cmDspSetSymbol(ctx,inst,kOutPtsId, p->symIdArray[idx]);
|
||||
}
|
||||
|
||||
return rc;
|
||||
@ -5652,6 +5653,178 @@ cmDspClass_t* cmPortToSymClassCons( cmDspCtx_t* ctx )
|
||||
return &_cmPortToSym_DC;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
//)
|
||||
//( { label:cmDspIntToSym file_desc:"Send a pre-defined symbol every time a message arrives a given input port." kw:[sunit] }
|
||||
enum
|
||||
{
|
||||
kInItsId,
|
||||
kOutItsId,
|
||||
kBaseInItsId
|
||||
};
|
||||
|
||||
cmDspClass_t _cmIntToSym_DC;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
cmDspInst_t inst;
|
||||
int* intArray;
|
||||
unsigned* symIdArray;
|
||||
unsigned symIdCnt;
|
||||
unsigned baseIntItsId;
|
||||
unsigned baseOutItsId;
|
||||
|
||||
} cmDspIntToSym_t;
|
||||
|
||||
cmDspInst_t* _cmDspIntToSym_Alloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsigned storeSymId, unsigned instSymId, unsigned id, unsigned va_cnt, va_list vl )
|
||||
{
|
||||
va_list vl1;
|
||||
va_copy(vl1,vl);
|
||||
|
||||
if( va_cnt < 2 || va_cnt % 2 !=0 )
|
||||
{
|
||||
va_end(vl1);
|
||||
cmDspClassErr(ctx,classPtr,kVarArgParseFailDspRC,"The 'IntToSym' constructor argument list must contain at least one int/symbol pair and all pairs must be complete.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
unsigned symCnt = va_cnt/2;
|
||||
unsigned argCnt = 2 + 3*symCnt;
|
||||
cmDspVarArg_t args[argCnt+1];
|
||||
|
||||
unsigned* symIdArray = cmMemAllocZ(unsigned,symCnt);
|
||||
int* intArray = cmMemAllocZ(int,symCnt);
|
||||
unsigned baseIntItsId = kBaseInItsId + symCnt;
|
||||
unsigned baseOutItsId = baseIntItsId + symCnt;
|
||||
|
||||
// setup the integer input and symbol output port arg recd
|
||||
cmDspArgSetup(ctx,args, "in", cmInvalidId, kInItsId, 0, 0, kInDsvFl | kIntDsvFl, "Integer input" );
|
||||
cmDspArgSetup(ctx,args+1,"out", cmInvalidId, kOutItsId, 0, 0, kOutDsvFl | kSymDsvFl, "Output" );
|
||||
|
||||
unsigned i;
|
||||
|
||||
for(i=0; i<symCnt; ++i)
|
||||
{
|
||||
// get the integer value
|
||||
intArray[i] = va_arg(vl,int);
|
||||
|
||||
// get the symbol label
|
||||
const cmChar_t* symLabel = va_arg(vl,const char*);
|
||||
assert( symLabel != NULL );
|
||||
|
||||
unsigned intLabelN = (symLabel==NULL ? 0 : strlen(symLabel)) + 5;
|
||||
cmChar_t intLabel[ intLabelN ];
|
||||
snprintf(intLabel,intLabelN,"%s%s", symLabel==NULL ? "" : symLabel, "-int" );
|
||||
|
||||
// register the symbol
|
||||
symIdArray[i] = cmSymTblRegisterSymbol(ctx->stH,symLabel);
|
||||
|
||||
// trigger port associated with this symbol (any msg on this port will trigger an output)
|
||||
cmDspArgSetup(ctx, args+kBaseInItsId+i, symLabel, cmInvalidId, kBaseInItsId+i, 0, 0, kInDsvFl | kTypeDsvMask, cmTsPrintfH(ctx->lhH,"%s Input.",symLabel) );
|
||||
|
||||
// this port is used to set the integer value associated with this symbol
|
||||
cmDspArgSetup(ctx, args+baseIntItsId+i, intLabel, cmInvalidId, baseIntItsId+i, 0, 0, kInDsvFl | kIntDsvFl, cmTsPrintfH(ctx->lhH,"Set the integer value associated with %s.",symLabel) );
|
||||
|
||||
// symbol output port - when ever this symbol is sent out it will go out this port as well as the 'out' port
|
||||
cmDspArgSetup(ctx, args+baseOutItsId+i, symLabel, cmInvalidId, baseOutItsId+i, 0, 0, kOutDsvFl | kSymDsvFl, cmTsPrintfH(ctx->lhH,"%s Output.",symLabel) );
|
||||
|
||||
|
||||
}
|
||||
|
||||
cmDspArgSetupNull(args + argCnt);
|
||||
|
||||
cmDspIntToSym_t* p = cmDspInstAlloc(cmDspIntToSym_t,ctx,classPtr,args,instSymId,id,storeSymId,0,vl1);
|
||||
|
||||
p->symIdCnt = symCnt;
|
||||
p->intArray = intArray;
|
||||
p->symIdArray = symIdArray;
|
||||
p->baseOutItsId = baseOutItsId;
|
||||
p->baseIntItsId = baseIntItsId;
|
||||
|
||||
cmDspSetDefaultSymbol(ctx,&p->inst,kOutItsId,cmInvalidId);
|
||||
|
||||
va_end(vl1);
|
||||
|
||||
return &p->inst;
|
||||
}
|
||||
cmDspRC_t _cmDspIntToSym_Free(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t* evt )
|
||||
{
|
||||
cmDspIntToSym_t* p = (cmDspIntToSym_t*)inst;
|
||||
cmMemFree(p->symIdArray);
|
||||
return kOkDspRC;
|
||||
}
|
||||
|
||||
cmDspRC_t _cmDspIntToSym_Reset(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t* evt )
|
||||
{
|
||||
return cmDspApplyAllDefaults(ctx,inst);
|
||||
}
|
||||
|
||||
cmDspRC_t _cmDspIntToSymSendOut( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned idx )
|
||||
{
|
||||
cmDspIntToSym_t* p = (cmDspIntToSym_t*)inst;
|
||||
assert( idx < p->symIdCnt );
|
||||
cmDspSetSymbol(ctx,inst,p->baseOutItsId + idx, p->symIdArray[idx]);
|
||||
return cmDspSetSymbol(ctx, inst, kOutItsId, p->symIdArray[ idx ]);
|
||||
}
|
||||
|
||||
|
||||
cmDspRC_t _cmDspIntToSym_Recv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t* evt )
|
||||
{
|
||||
cmDspRC_t rc = kOkDspRC;
|
||||
cmDspIntToSym_t* p = (cmDspIntToSym_t*)inst;
|
||||
|
||||
// if an integer arrived at 'in'
|
||||
if( evt->dstVarId == kInItsId )
|
||||
{
|
||||
cmDspSetEvent(ctx,inst,evt);
|
||||
|
||||
unsigned i;
|
||||
int intVal = cmDspInt(inst,kInItsId);
|
||||
|
||||
for(i=0; i<p->symIdCnt; ++i)
|
||||
if( intVal == p->intArray[i] )
|
||||
{
|
||||
rc = _cmDspIntToSymSendOut( ctx, inst, i );
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// if a msg of any type is recieved on an input port - send out the associated symbol
|
||||
if( kBaseInItsId <= evt->dstVarId && evt->dstVarId < kBaseInItsId + p->symIdCnt )
|
||||
{
|
||||
_cmDspIntToSymSendOut( ctx, inst, evt->dstVarId - kBaseInItsId );
|
||||
}
|
||||
else
|
||||
|
||||
// if this is a new interger value for this symbol
|
||||
if( p->baseIntItsId <= evt->dstVarId && evt->dstVarId < p->baseIntItsId + p->symIdCnt )
|
||||
{
|
||||
cmDspSetEvent(ctx,inst,evt);
|
||||
|
||||
p->intArray[ evt->dstVarId - p->baseIntItsId ] = cmDspInt( inst, evt->dstVarId );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
cmDspClass_t* cmIntToSymClassCons( cmDspCtx_t* ctx )
|
||||
{
|
||||
cmDspClassSetup(&_cmIntToSym_DC,ctx,"IntToSym",
|
||||
NULL,
|
||||
_cmDspIntToSym_Alloc,
|
||||
_cmDspIntToSym_Free,
|
||||
_cmDspIntToSym_Reset,
|
||||
NULL,
|
||||
_cmDspIntToSym_Recv,
|
||||
NULL,NULL,
|
||||
"If a message of any kind is received on a port then send the symbol associated with the port.");
|
||||
|
||||
return &_cmIntToSym_DC;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
//)
|
||||
//( { label:cmDspRouter file_desc:"Route the input value to one of multiple output ports." kw:[sunit] }
|
||||
|
@ -36,6 +36,7 @@ extern "C" {
|
||||
struct cmDspClass_str* cm1UpClassCons( cmDspCtx_t* ctx );
|
||||
struct cmDspClass_str* cmGateToSymClassCons( cmDspCtx_t* ctx );
|
||||
struct cmDspClass_str* cmPortToSymClassCons( cmDspCtx_t* ctx );
|
||||
struct cmDspClass_str* cmIntToSymClassCons( cmDspCtx_t* ctx );
|
||||
struct cmDspClass_str* cmRouterClassCons( cmDspCtx_t* ctx );
|
||||
struct cmDspClass_str* cmAvailChClassCons( cmDspCtx_t* ctx );
|
||||
struct cmDspClass_str* cmPresetClassCons( cmDspCtx_t* ctx );
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "cmTime.h"
|
||||
#include "cmAudioSys.h"
|
||||
#include "cmProcObj.h"
|
||||
#include "cmPP_NARG.h"
|
||||
#include "cmDspCtx.h"
|
||||
#include "cmDspClass.h"
|
||||
#include "cmDspSys.h"
|
||||
@ -2870,36 +2871,77 @@ cmDspRC_t _cmDspSysPgm_PortToSym( cmDspSysH_t h, void** userPtrPtr )
|
||||
{
|
||||
cmDspRC_t rc = kOkDspRC;
|
||||
|
||||
cmDspInst_t* btn0 = cmDspSysAllocButton( h, "Btn0", 0.0 );
|
||||
cmDspInst_t* btn1 = cmDspSysAllocButton( h, "Btn1", 0.0 );
|
||||
cmDspInst_t* btn2 = cmDspSysAllocButton( h, "Btn2", 0.0 );
|
||||
inst_t* btn0 = button( "Btn0", 0.0 );
|
||||
inst_t* btn1 = button( "Btn1", 0.0 );
|
||||
inst_t* btn2 = button( "Btn2", 0.0 );
|
||||
|
||||
cmDspInst_t* pts = cmDspSysAllocInst( h, "PortToSym", NULL, 3, "one", "two", "three");
|
||||
inst_t* pts = inst( "PortToSym", NULL, "one", "two", "three");
|
||||
|
||||
cmDspInst_t* pr0 = cmDspSysAllocInst( h, "Printer", NULL, 1, "0:" );
|
||||
cmDspInst_t* pr1 = cmDspSysAllocInst( h, "Printer", NULL, 1, "1:" );
|
||||
inst_t* pr0 = inst( "Printer", NULL, "sym:" );
|
||||
inst_t* pr1 = inst( "Printer", NULL, "btn:" );
|
||||
inst_t* pr2 = inst( "Printer", NULL, "out:" );
|
||||
|
||||
// check for allocation errors
|
||||
if((rc = cmDspSysLastRC(h)) != kOkDspRC )
|
||||
goto errLabel;
|
||||
|
||||
cmDspSysInstallCb( h, btn0, "out", pts, "one",NULL);
|
||||
cmDspSysInstallCb( h, btn1, "out", pts, "two",NULL);
|
||||
cmDspSysInstallCb( h, btn2, "out", pts, "three",NULL);
|
||||
event( btn0, out, pts, one );
|
||||
event( btn1, out, pts, two );
|
||||
event( btn2, out, pts, three );
|
||||
|
||||
cmDspSysInstallCb( h, btn0, "out", pr1, "in",NULL);
|
||||
cmDspSysInstallCb( h, btn1, "out", pr1, "in",NULL);
|
||||
cmDspSysInstallCb( h, btn2, "out", pr1, "in",NULL);
|
||||
|
||||
cmDspSysInstallCb( h, pts, "one", pr0, "in", NULL );
|
||||
cmDspSysInstallCb( h, pts, "two", pr0, "in", NULL );
|
||||
cmDspSysInstallCb( h, pts, "three", pr0, "in", NULL );
|
||||
event( btn0, out, pr1, in );
|
||||
event( btn1, out, pr1, in );
|
||||
event( btn2, out, pr1, in );
|
||||
|
||||
event( pts, one, pr0, in );
|
||||
event( pts, two, pr0, in );
|
||||
event( pts, three, pr0, in );
|
||||
event( pts, out, pr2, in );
|
||||
|
||||
errLabel:
|
||||
return rc;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//)
|
||||
//( { label:cmDspPgm_IntToSym file_desc:"IntToSym example program." kw:[spgm] }
|
||||
cmDspRC_t _cmDspSysPgm_IntToSym( cmDspSysH_t h, void** userPtrPtr )
|
||||
{
|
||||
cmDspRC_t rc = kOkDspRC;
|
||||
|
||||
inst_t* sel0 = scalar( "Sel0", 0.0, 10.0, 1.0, 1.0 );
|
||||
inst_t* sel1 = scalar( "Sel1", 0.0, 10.0, 1.0, 1.0 );
|
||||
inst_t* sel2 = scalar( "Sel2", 0.0, 10.0, 1.0, 1.0 );
|
||||
inst_t* val = scalar( "Val", 0.0, 10.0, 1.0, 1.0 );
|
||||
|
||||
inst_t* pts = inst( "IntToSym", NULL, 0, "one", 0, "two", 0, "three");
|
||||
|
||||
inst_t* pr0 = inst( "Printer", NULL, "val:" );
|
||||
inst_t* pr1 = inst( "Printer", NULL, "sym:" );
|
||||
inst_t* pr2 = inst( "Printer", NULL, "out:" );
|
||||
|
||||
// check for allocation errors
|
||||
if((rc = cmDspSysLastRC(h)) != kOkDspRC )
|
||||
goto errLabel;
|
||||
|
||||
event( sel0, val, pts, one-int );
|
||||
event( sel1, val, pts, two-int );
|
||||
event( sel2, val, pts, three-int );
|
||||
|
||||
event( val, val, pts, in );
|
||||
event( val, val, pr0, in );
|
||||
|
||||
event( pts, one, pr1, in );
|
||||
event( pts, two, pr1, in );
|
||||
event( pts, three, pr1, in );
|
||||
|
||||
event( pts, out, pr2, in );
|
||||
|
||||
errLabel:
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//)
|
||||
//( { label:cmDspPgm_Line file_desc:"Line generator example program." kw:[spgm] }
|
||||
@ -3288,6 +3330,7 @@ _cmDspSysPgm_t _cmDspSysPgmArray[] =
|
||||
{ "line", _cmDspSysPgm_Line, NULL, NULL },
|
||||
{ "1Up", _cmDspSysPgm_1Up, NULL, NULL },
|
||||
{ "PortToSym", _cmDspSysPgm_PortToSym, NULL, NULL },
|
||||
{ "IntToSym", _cmDspSysPgm_IntToSym, NULL, NULL },
|
||||
{ "preset", _cmDspSysPgm_Preset, NULL, NULL },
|
||||
{ "rsrcWr", _cmDspSysPgm_RsrcWr, NULL, NULL },
|
||||
{ "router", _cmDspSysPgm_Router, NULL, NULL },
|
||||
|
@ -62,27 +62,22 @@ cmDspRC_t _cmDspSysPgm_TimeLineLiteAf(cmDspSysH_t h, void** userPtrPtr )
|
||||
//int baseAudioInCh = 0; // 2;
|
||||
int baseAudioOutCh = 0;// 2;
|
||||
|
||||
//cmDspInst_t* ai0 = cmDspSysAllocInst(h,"AudioIn", NULL, 1, baseAudioInCh + 0);
|
||||
//cmDspInst_t* ai1 = cmDspSysAllocInst(h,"AudioIn", NULL, 1, baseAudioInCh + 1);
|
||||
//cmDspInst_t* mip = cmDspSysAllocInst(h,"MidiIn", NULL, 2, "MOTU - Traveler mk3", "MIDI Port");
|
||||
//cmDspInst_t* mip = cmDspSysAllocInst(h,"MidiIn", NULL, 2, "Apple Inc. - IAC Driver", "Bus 1");
|
||||
|
||||
cmDspInst_t* tlp = cmDspSysAllocInst(h,"TimeLine", "tl", 2, r.tlFn, r.tlPrefixPath );
|
||||
cmDspInst_t* scp = cmDspSysAllocInst(h,"Score", "sc", 1, r.scFn );
|
||||
cmDspInst_t* pts = cmDspSysAllocInst(h,"PortToSym", NULL, 2, "on", "off" );
|
||||
|
||||
cmDspInst_t* php = cmDspSysAllocInst(h,"Phasor", NULL, 0 );
|
||||
cmDspInst_t* wtp = cmDspSysAllocInst(h,"WaveTable",NULL, 2, ((int)cmDspSysSampleRate(h)), 1 );
|
||||
cmDspInst_t* wt0 = cmDspSysAllocInst(h,"WaveTable", NULL, 7, ((int)cmDspSysSampleRate(h)), 1, NULL, -1, 0, -1, 0 );
|
||||
cmDspInst_t* wt1 = cmDspSysAllocInst(h,"WaveTable", NULL, 7, ((int)cmDspSysSampleRate(h)), 1, NULL, -1, 0, -1, 1 );
|
||||
|
||||
|
||||
cmDspInst_t* mfp = cmDspSysAllocInst(h,"MidiFilePlay",NULL, 0 );
|
||||
cmDspInst_t* nmp = cmDspSysAllocInst(h,"NanoMap", NULL, 0 );
|
||||
//cmDspInst_t* pic = cmDspSysAllocInst(h,"Picadae", NULL, 0 );
|
||||
cmDspInst_t* mop = cmDspSysAllocInst(h,"MidiOut", NULL, 2, "Fastlane","Fastlane MIDI A" );
|
||||
cmDspInst_t* mo2p = cmDspSysAllocInst(h,"MidiOut", NULL, 2, "Fastlane","Fastlane MIDI B");
|
||||
cmDspInst_t* sfp = cmDspSysAllocInst(h,"ScFol", NULL, 5, r.scFn, sfBufCnt, sfMaxWndCnt, sfMinVel, sfEnaMeasFl );
|
||||
cmDspInst_t* amp = cmDspSysAllocInst(h,"ActiveMeas", NULL, 1, 100 );
|
||||
cmDspInst_t* modp = cmDspSysAllocInst(h,"ScMod", NULL, 2, r.modFn, "m1" );
|
||||
cmDspInst_t* its = cmDspSysAllocInst(h,"IntToSym", NULL, 2, 0, "off");
|
||||
|
||||
unsigned preGrpSymId = cmDspSysPresetRegisterGroup(h,"tl");
|
||||
unsigned cmpPreGrpSymId = cmDspSysPresetRegisterGroup(h,"tl_cmp");
|
||||
@ -95,14 +90,14 @@ cmDspRC_t _cmDspSysPgm_TimeLineLiteAf(cmDspSysH_t h, void** userPtrPtr )
|
||||
cmDspSysNewPage(h,"Controls-1");
|
||||
_cmDspSys_TlXformChain(h, &c1, preGrpSymId, cmpPreGrpSymId, amp, modp, 1, 1 );
|
||||
|
||||
cmDspInst_t* lmix = cmDspSysAllocInst(h, "AMix", NULL, 1, 2 );
|
||||
cmDspInst_t* rmix = cmDspSysAllocInst(h, "AMix", NULL, 1, 2 );
|
||||
|
||||
cmDspInst_t* ao0 = cmDspSysAllocInst(h,"AudioOut", NULL, 1, baseAudioOutCh+2 ); // 4 Piano 1 Output
|
||||
cmDspInst_t* ao1 = cmDspSysAllocInst(h,"AudioOut", NULL, 1, baseAudioOutCh+3 ); // 5 2
|
||||
cmDspInst_t* ao2 = cmDspSysAllocInst(h,"AudioOut", NULL, 1, baseAudioOutCh+0 ); // 2 Transform 1 OUtput
|
||||
cmDspInst_t* ao3 = cmDspSysAllocInst(h,"AudioOut", NULL, 1, baseAudioOutCh+1 ); // 3 2
|
||||
cmDspInst_t* ao0 = cmDspSysAllocInst(h,"AudioOut", NULL, 1, baseAudioOutCh+0 );
|
||||
cmDspInst_t* ao1 = cmDspSysAllocInst(h,"AudioOut", NULL, 1, baseAudioOutCh+1 );
|
||||
|
||||
cmDspSysNewPage(h,"Main");
|
||||
cmDspInst_t* notesOffb= cmDspSysAllocInst(h,"Button", "notesOff", 2, kButtonDuiId, 1.0 );
|
||||
//cmDspInst_t* notesOffb= cmDspSysAllocInst(h,"Button", "notesOff", 2, kButtonDuiId, 1.0 );
|
||||
cmDspInst_t* onb = cmDspSysAllocInst(h,"Button", "start", 2, kButtonDuiId, 1.0 );
|
||||
cmDspInst_t* offb = cmDspSysAllocInst(h,"Button", "stop", 2, kButtonDuiId, 1.0 );
|
||||
cmDspInst_t* mod_sel = cmDspSysAllocMsgList(h, NULL, "mod_sel", 1 );
|
||||
@ -115,11 +110,7 @@ cmDspRC_t _cmDspSysPgm_TimeLineLiteAf(cmDspSysH_t h, void** userPtrPtr )
|
||||
// Record <-> Live switches
|
||||
cmDspInst_t* tlRt = cmDspSysAllocInst(h,"Router", NULL, 2, 2, 0); // time line swich
|
||||
cmDspInst_t* mfpRt = cmDspSysAllocInst(h,"Router", NULL, 2, 2, 0);
|
||||
//cmDspInst_t* amRt = cmDspSysAllocInst(h,"Router", NULL, 2, 2, 0);
|
||||
|
||||
//cmDspSysNewColumn(h,0);
|
||||
//cmDspInst_t* igain0 = cmDspSysAllocInst(h,"Scalar", "In Gain-0", 5, kNumberDuiId, 0.0, 100.0,0.01, 1.0 );
|
||||
//cmDspInst_t* igain1 = cmDspSysAllocInst(h,"Scalar", "In Gain-1", 5, kNumberDuiId, 0.0, 100.0,0.01, 1.0 );
|
||||
|
||||
//cmDspSysNewColumn(h,0);
|
||||
cmDspInst_t* ogain0 = cmDspSysAllocInst(h,"Scalar", "Dry Out Gain-0", 5, kNumberDuiId, 0.0, 10.0,0.01, 1.0 );
|
||||
@ -127,6 +118,16 @@ cmDspRC_t _cmDspSysPgm_TimeLineLiteAf(cmDspSysH_t h, void** userPtrPtr )
|
||||
cmDspInst_t* ogain2 = cmDspSysAllocInst(h,"Scalar", "Wet Out Gain-2", 5, kNumberDuiId, 0.0, 10.0,0.01, 1.0 );
|
||||
cmDspInst_t* ogain3 = cmDspSysAllocInst(h,"Scalar", "Wet Out Gain-3", 5, kNumberDuiId, 0.0, 10.0,0.01, 1.0 );
|
||||
|
||||
cmDspInst_t* ogainW = cmDspSysAllocInst(h,"Scalar", "Wet Master", 5, kNumberDuiId, 0.0, 10.0,0.01, 1.0 );
|
||||
cmDspInst_t* ogainD = cmDspSysAllocInst(h,"Scalar", "Dry Master", 5, kNumberDuiId, 0.0, 10.0,0.01, 1.0 );
|
||||
|
||||
cmDspInst_t* gmult0 = cmDspSysAllocInst(h,"ScalarOp", NULL, 6, 2, "*", "in-0", 1.0, "in-1", 1.0 );
|
||||
cmDspInst_t* gmult1 = cmDspSysAllocInst(h,"ScalarOp", NULL, 6, 2, "*", "in-0", 1.0, "in-1", 1.0 );
|
||||
cmDspInst_t* gmult2 = cmDspSysAllocInst(h,"ScalarOp", NULL, 6, 2, "*", "in-0", 1.0, "in-1", 1.0 );
|
||||
cmDspInst_t* gmult3 = cmDspSysAllocInst(h,"ScalarOp", NULL, 6, 2, "*", "in-0", 1.0, "in-1", 1.0 );
|
||||
|
||||
|
||||
|
||||
// Audio file recording
|
||||
cmDspInst_t* recdGain= cmDspSysAllocInst(h,"Scalar", "Recd Gain", 5, kNumberDuiId, 0.0, 100.0,0.01, 1.5 );
|
||||
cmDspInst_t* recdChk = cmDspSysAllocInst(h,"Button", "Record", 2, kCheckDuiId, 0.0 );
|
||||
@ -135,7 +136,8 @@ cmDspRC_t _cmDspSysPgm_TimeLineLiteAf(cmDspSysH_t h, void** userPtrPtr )
|
||||
cmDspInst_t* mi0p = cmDspSysAllocInst(h,"AMeter","In 0", 0);
|
||||
cmDspInst_t* mi1p = cmDspSysAllocInst(h,"AMeter","In 1", 0);
|
||||
|
||||
cmDspInst_t* meas = cmDspSysAllocInst(h,"Scalar", "Meas", 5, kNumberDuiId, 1.0, 59.0,1.0, 1.0 );
|
||||
cmDspInst_t* meas = cmDspSysAllocInst(h,"Scalar", "Begin Meas", 5, kNumberDuiId, 1.0, 1000.0, 1.0, 1.0 );
|
||||
cmDspInst_t* emeas = cmDspSysAllocInst(h,"Scalar", "End Meas", 5, kNumberDuiId, 1.0, 1000.0, 1.0, 1.0 );
|
||||
cmDspSysInstallCb( h, meas, "val", scp, "meas", NULL);
|
||||
cmDspSysInstallCb( h, meas, "val", tlp, "meas", NULL);
|
||||
|
||||
@ -173,37 +175,34 @@ cmDspRC_t _cmDspSysPgm_TimeLineLiteAf(cmDspSysH_t h, void** userPtrPtr )
|
||||
cmDspSysInstallCb(h, recdPtS, "out", afop, "sel", NULL );
|
||||
|
||||
// Audio connections
|
||||
cmDspSysConnectAudio(h, php, "out", wt0, "phs" ); // phasor -> wave table
|
||||
cmDspSysConnectAudio(h, php, "out", wt1, "phs" ); //
|
||||
|
||||
cmDspSysConnectAudio(h, php, "out", wtp, "phs" ); // phasor -> wave table
|
||||
cmDspSysConnectAudio(h, wtp, "out", ao0, "in" ); // wave table -> audio out (dry output)
|
||||
cmDspSysConnectAudio(h, wtp, "out", ao1, "in" ); //
|
||||
cmDspSysConnectAudio(h, wt0, "out", lmix, "in-0" ); // wave table -> audio out (dry output)
|
||||
cmDspSysConnectAudio(h, wt1, "out", rmix, "in-0" ); //
|
||||
|
||||
//cmDspSysConnectAudio( h, ai0, "out", ao0, "in" ); // dry signal through
|
||||
//cmDspSysConnectAudio( h, ai1, "out", ao1, "in" ); //
|
||||
|
||||
//cmDspSysConnectAudio( h, ai0, "out", mi0p, "in" ); //
|
||||
//cmDspSysConnectAudio( h, ai0, "out", c0.kr0, "in" ); // ain -> ch0.kr0
|
||||
//cmDspSysConnectAudio( h, ai0, "out", c0.kr1, "in" ); // ain -> ch0.kr1
|
||||
|
||||
cmDspSysConnectAudio( h, wtp, "out", mi0p, "in" ); //
|
||||
cmDspSysConnectAudio( h, wtp, "out", c0.kr0, "in" ); // ain -> ch0.kr0
|
||||
cmDspSysConnectAudio( h, wtp, "out", c0.kr1, "in" ); // ain -> ch0.kr1
|
||||
//cmDspSysConnectAudio(h, wt0, "out", lmix, "in-1" ); // wave table -> audio out (dry output)
|
||||
//cmDspSysConnectAudio(h, wt1, "out", rmix, "in-1" ); //
|
||||
|
||||
|
||||
cmDspSysConnectAudio( h, c0.cmp,"out", ao2, "in" ); // ch0.cmp -> aout
|
||||
cmDspSysConnectAudio( h, wt0, "out", mi0p, "in" ); //
|
||||
cmDspSysConnectAudio( h, wt0, "out", c0.kr0, "in" ); // ain -> ch0.kr0
|
||||
cmDspSysConnectAudio( h, wt0, "out", c0.kr1, "in" ); // ain -> ch0.kr1
|
||||
|
||||
|
||||
cmDspSysConnectAudio( h, c0.cmp,"out", lmix, "in-1" ); // ch0.cmp -> aout
|
||||
cmDspSysConnectAudio( h, c0.cmp,"out", afop, "in0"); // ch0.cmp -> audio_file_out
|
||||
|
||||
//cmDspSysConnectAudio( h, ai1, "out", mi1p, "in" ); //
|
||||
//cmDspSysConnectAudio( h, ai1, "out", c1.kr0, "in" ); // ain -> ch1.kr0
|
||||
//cmDspSysConnectAudio( h, ai1, "out", c1.kr1, "in" ); // ain -> ch1.kr1
|
||||
|
||||
cmDspSysConnectAudio( h, wtp, "out", mi1p, "in" ); //
|
||||
cmDspSysConnectAudio( h, wtp, "out", c1.kr0, "in" ); // ain -> ch1.kr0
|
||||
cmDspSysConnectAudio( h, wtp, "out", c1.kr1, "in" ); // ain -> ch1.kr1
|
||||
cmDspSysConnectAudio( h, wt1, "out", mi1p, "in" ); //
|
||||
cmDspSysConnectAudio( h, wt1, "out", c1.kr0, "in" ); // ain -> ch1.kr0
|
||||
cmDspSysConnectAudio( h, wt1, "out", c1.kr1, "in" ); // ain -> ch1.kr1
|
||||
|
||||
cmDspSysConnectAudio( h, c1.cmp,"out", ao3, "in" ); // ch1.cmp -> aout
|
||||
cmDspSysConnectAudio( h, c1.cmp,"out", rmix, "in-1" ); // ch1.cmp -> aout
|
||||
cmDspSysConnectAudio( h, c1.cmp,"out", afop, "in1"); // ch1.cmp ->audio_file_out
|
||||
|
||||
cmDspSysConnectAudio( h, lmix, "out", ao0, "in" );
|
||||
cmDspSysConnectAudio( h, rmix, "out", ao1, "in" );
|
||||
|
||||
|
||||
cmDspSysInstallCb( h, clrBtn, "sym", amp, "cmd", NULL ); // clear active meas.
|
||||
@ -252,8 +251,9 @@ cmDspRC_t _cmDspSysPgm_TimeLineLiteAf(cmDspSysH_t h, void** userPtrPtr )
|
||||
cmDspSysInstallCb( h, sfp, "vcost",prt, "in", NULL ); //
|
||||
cmDspSysInstallCb( h, sfp, "vtyp", prc, "in", NULL ); //
|
||||
*/
|
||||
|
||||
// wave-table to time-line cursor
|
||||
//cmDspSysInstallCb( h, wtp, "fidx",tlp, "curs", NULL);
|
||||
cmDspSysInstallCb( h, wt0, "fidx",tlp, "curs", NULL);
|
||||
|
||||
cmDspSysInstallCb(h, prePath, "out", tlp, "path", NULL );
|
||||
|
||||
@ -267,7 +267,8 @@ cmDspRC_t _cmDspSysPgm_TimeLineLiteAf(cmDspSysH_t h, void** userPtrPtr )
|
||||
cmDspSysInstallCb(h, mfpRt,"s-out-0",mfp, "sel", NULL );
|
||||
|
||||
cmDspSysInstallCb(h, onb, "sym", pts, "on", NULL );
|
||||
cmDspSysInstallCb(h, pts, "on", wtp, "cmd", NULL );
|
||||
cmDspSysInstallCb(h, pts, "on", wt0, "cmd", NULL );
|
||||
cmDspSysInstallCb(h, pts, "on", wt1, "cmd", NULL );
|
||||
cmDspSysInstallCb(h, pts, "on", modp, "cmd", NULL );
|
||||
cmDspSysInstallCb(h, onb, "sym", amCmd, "rewind", NULL );
|
||||
cmDspSysInstallCb(h, onb, "out", c0.achan,"reset", NULL );
|
||||
@ -279,10 +280,9 @@ cmDspRC_t _cmDspSysPgm_TimeLineLiteAf(cmDspSysH_t h, void** userPtrPtr )
|
||||
cmDspSysInstallCb(h, tlp, "mfn", pts, "off", NULL ); // Prevents WT start on new audio file from TL.
|
||||
cmDspSysInstallCb(h, offb, "sym", mfp, "sel", NULL );
|
||||
cmDspSysInstallCb(h, offb, "sym", pts, "off", NULL );
|
||||
cmDspSysInstallCb(h, pts, "off", wtp, "cmd", NULL );
|
||||
cmDspSysInstallCb(h, pts, "off", wt0, "cmd", NULL );
|
||||
cmDspSysInstallCb(h, pts, "off", wt1, "cmd", NULL );
|
||||
cmDspSysInstallCb(h, pts, "off", modp,"cmd", NULL );
|
||||
cmDspSysInstallCb(h, offb, "sym", mop, "reset", NULL );
|
||||
cmDspSysInstallCb(h, offb, "sym", mo2p,"reset", NULL );
|
||||
|
||||
|
||||
// time-line to MIDI file player selection
|
||||
@ -292,9 +292,13 @@ cmDspRC_t _cmDspSysPgm_TimeLineLiteAf(cmDspSysH_t h, void** userPtrPtr )
|
||||
|
||||
|
||||
// time-line to Audio file player selection
|
||||
cmDspSysInstallCb(h, tlp, "absi", wtp, "beg", NULL );
|
||||
cmDspSysInstallCb(h, tlp, "aesi", wtp, "end", NULL );
|
||||
cmDspSysInstallCb(h, tlp, "afn", wtp, "fn", NULL );
|
||||
cmDspSysInstallCb(h, tlp, "absi", wt0, "beg", NULL );
|
||||
cmDspSysInstallCb(h, tlp, "aesi", wt0, "end", NULL );
|
||||
cmDspSysInstallCb(h, tlp, "afn", wt0, "fn", NULL );
|
||||
|
||||
cmDspSysInstallCb(h, tlp, "absi", wt1, "beg", NULL );
|
||||
cmDspSysInstallCb(h, tlp, "aesi", wt1, "end", NULL );
|
||||
cmDspSysInstallCb(h, tlp, "afn", wt1, "fn", NULL );
|
||||
|
||||
// score to score follower - to set initial search location
|
||||
cmDspSysInstallCb(h, scp, "sel", sfp, "index", NULL );
|
||||
@ -309,29 +313,22 @@ cmDspRC_t _cmDspSysPgm_TimeLineLiteAf(cmDspSysH_t h, void** userPtrPtr )
|
||||
|
||||
cmDspSysInstallCb(h, msrc, "d1", sfp, "d1", NULL );
|
||||
cmDspSysInstallCb(h, msrc, "d1", nmp, "d1", NULL );
|
||||
cmDspSysInstallCb(h, nmp, "d1", mop, "d1", NULL );
|
||||
//cmDspSysInstallCb(h, nmp, "d1", pic, "d1", NULL );
|
||||
//cmDspSysInstallCb(h, pic, "d1", mo2p, "d1", NULL );
|
||||
|
||||
cmDspSysInstallCb(h, msrc, "d0", sfp, "d0", NULL );
|
||||
cmDspSysInstallCb(h, msrc, "d0", nmp, "d0", NULL );
|
||||
cmDspSysInstallCb(h, nmp, "d0", mop, "d0", NULL );
|
||||
//cmDspSysInstallCb(h, nmp, "d0", pic, "d0", NULL );
|
||||
//cmDspSysInstallCb(h, pic, "d0", mo2p, "d0", NULL );
|
||||
|
||||
cmDspSysInstallCb(h, msrc, "status", sfp, "status",NULL );
|
||||
cmDspSysInstallCb(h, msrc, "status", nmp, "status",NULL );
|
||||
cmDspSysInstallCb(h, nmp, "status", mop, "status",NULL );
|
||||
//cmDspSysInstallCb(h, nmp, "status", pic, "status",NULL );
|
||||
//cmDspSysInstallCb(h, pic, "status", mo2p, "status", NULL );
|
||||
|
||||
|
||||
// score follower to recd_play,modulator and printers
|
||||
cmDspSysInstallCb(h, sfp, "out", modp, "index", NULL );
|
||||
cmDspSysInstallCb(h, sfp, "recent", prp, "in", NULL ); // report 'recent' but only act on 'max' loc index
|
||||
|
||||
//cmDspSysInstallCb(h, igain0, "val", ai0, "gain", NULL ); // input gain control
|
||||
//cmDspSysInstallCb(h, igain1, "val", ai1, "gain", NULL );
|
||||
cmDspSysInstallCb( h, emeas, "val", its, "off-int", NULL);
|
||||
cmDspSysInstallCb( h, sfp, "out", its, "in", NULL);
|
||||
cmDspSysInstallCb( h, its, "out", offb, "in", NULL);
|
||||
cmDspSysInstallCb( h, its, "out", prp, "in", NULL);
|
||||
|
||||
|
||||
cmDspSysInstallCb(h, modp, "dgain0", ogain0, "val", NULL );
|
||||
@ -339,10 +336,22 @@ cmDspRC_t _cmDspSysPgm_TimeLineLiteAf(cmDspSysH_t h, void** userPtrPtr )
|
||||
cmDspSysInstallCb(h, modp, "wgain0", ogain2, "val", NULL );
|
||||
cmDspSysInstallCb(h, modp, "wgain1", ogain3, "val", NULL );
|
||||
|
||||
cmDspSysInstallCb(h, ogain0, "val", ao0, "gain", NULL ); // output gain control - dry 0
|
||||
cmDspSysInstallCb(h, ogain1, "val", ao1, "gain", NULL ); // dry 1
|
||||
cmDspSysInstallCb(h, ogain2, "val", ao2, "gain", NULL ); // wet 0
|
||||
cmDspSysInstallCb(h, ogain3, "val", ao3, "gain", NULL ); // wet 1
|
||||
|
||||
cmDspSysInstallCb(h, ogain0, "val", gmult0, "in-0", NULL );
|
||||
cmDspSysInstallCb(h, ogainD, "val", gmult0, "in-1", NULL );
|
||||
|
||||
cmDspSysInstallCb(h, ogain1, "val", gmult1, "in-0", NULL );
|
||||
cmDspSysInstallCb(h, ogainD, "val", gmult1, "in-1", NULL );
|
||||
|
||||
cmDspSysInstallCb(h, ogain2, "val", gmult2, "in-0", NULL );
|
||||
cmDspSysInstallCb(h, ogainW, "val", gmult2, "in-1", NULL );
|
||||
cmDspSysInstallCb(h, ogain3, "val", gmult3, "in-0", NULL );
|
||||
cmDspSysInstallCb(h, ogainW, "val", gmult3, "in-1", NULL );
|
||||
|
||||
cmDspSysInstallCb(h, gmult0, "out", lmix, "gain-0", NULL ); // output gain control - dry 0
|
||||
cmDspSysInstallCb(h, gmult1, "out", rmix, "gain-0", NULL ); // dry 1
|
||||
cmDspSysInstallCb(h, gmult2, "out", lmix, "gain-1", NULL ); // wet 0
|
||||
cmDspSysInstallCb(h, gmult3, "out", rmix, "gain-1", NULL ); // wet 1
|
||||
|
||||
|
||||
return rc;
|
||||
|
@ -110,7 +110,6 @@ extern "C" {
|
||||
|
||||
cmDspRC_t cmDspSysNewPage( cmDspSysH_t h, const cmChar_t* title );
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Connection Functions.
|
||||
//
|
||||
@ -278,6 +277,18 @@ extern "C" {
|
||||
|
||||
//)
|
||||
|
||||
typedef cmDspInst_t inst_t;
|
||||
|
||||
#define inst( classLabel, instLabel, ... ) cmDspSysAllocInst( h, classLabel, instLabel, PP_NARG(__VA_ARGS__), __VA_ARGS__ )
|
||||
#define button( label, real_val ) cmDspSysAllocButton( h, label, real_val )
|
||||
#define scalar( label, rmin, rmax, rstep, rval ) cmDspSysAllocScalar( h, label, rmin, rmax, rstep, rval )
|
||||
|
||||
|
||||
#define audio( src, sarg, dst, darg ) cmDspSysConnectAudio( h, src, #sarg, dst, #darg )
|
||||
#define event( src, sarg, dst, darg ) cmDspSysInstallCb( h, src, #sarg, dst, #darg, NULL )
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user