From de58bb52321bcc91e9d986652a13c53c3c879c10 Mon Sep 17 00:00:00 2001 From: kevin Date: Mon, 30 Sep 2013 11:03:47 -0700 Subject: [PATCH] cmDspKr.c : Added 'post' output to cmDspScMod object. --- dsp/cmDspKr.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/dsp/cmDspKr.c b/dsp/cmDspKr.c index c74f76b..a3f33ab 100644 --- a/dsp/cmDspKr.c +++ b/dsp/cmDspKr.c @@ -1158,7 +1158,8 @@ enum { kScLocIdxMdId, kResetIdxMdId, - kCmdMdId + kCmdMdId, + kPostMdId }; cmDspClass_t _cmModulatorDC; @@ -1172,9 +1173,10 @@ typedef struct cmChar_t* modLabel; unsigned onSymId; unsigned offSymId; + unsigned postSymId; } cmDspScMod_t; -void _cmDspScModCb( void* arg, unsigned varSymId, double value ) +void _cmDspScModCb( void* arg, unsigned varSymId, double value, bool postFl ) { cmDspScMod_t* p = (cmDspScMod_t*)arg; @@ -1183,6 +1185,9 @@ void _cmDspScModCb( void* arg, unsigned varSymId, double value ) return; cmDspSetDouble(p->tmp_ctx,&p->inst,varPtr->constId,value); + + if( postFl ) + cmDspSetSymbol(p->tmp_ctx,&p->inst,kPostMdId,p->postSymId); } @@ -1196,6 +1201,7 @@ cmDspInst_t* _cmDspScModAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsigned { "index", kScLocIdxMdId, 0,0, kInDsvFl | kUIntDsvFl, "Score follower index input."}, { "reset", kResetIdxMdId, 0,0, kInDsvFl | kUIntDsvFl | kOptArgDsvFl, "Reset the modulator and go to the score index."}, { "cmd", kCmdMdId, 0,0, kInDsvFl | kSymDsvFl | kOptArgDsvFl, "on | off."}, + { "post", kPostMdId, 0,0, kOutDsvFl | kSymDsvFl, "Sends 'post' symbol after a message transmission if the 'post' flag is set in scMod."}, { NULL, 0, 0, 0, 0 } }; @@ -1253,6 +1259,7 @@ cmDspInst_t* _cmDspScModAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsigned p->mp = mp; p->onSymId = cmSymTblId(ctx->stH,"on"); p->offSymId = cmSymTblId(ctx->stH,"off"); + p->postSymId = cmSymTblRegisterStaticSymbol(ctx->stH,"post"); mp->cbArg = p; // set the modulator callback arg @@ -1819,7 +1826,7 @@ cmDspRC_t _cmDspActiveMeasRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEv // transmit the records value and cost cmDspSetDouble(ctx,inst,varId,r->value); - cmDspSetDouble(ctx,inst,kCostAmId,r->value); + cmDspSetDouble(ctx,inst,kCostAmId,r->cost); prvLoc = r->loc; }