Переглянути джерело

cmDspKr.c : Added 'post' output to cmDspScMod object.

master
kevin 11 роки тому
джерело
коміт
de58bb5232
1 змінених файлів з 10 додано та 3 видалено
  1. 10
    3
      dsp/cmDspKr.c

+ 10
- 3
dsp/cmDspKr.c Переглянути файл

@@ -1158,7 +1158,8 @@ enum
1158 1158
 {
1159 1159
   kScLocIdxMdId,
1160 1160
   kResetIdxMdId,
1161
-  kCmdMdId
1161
+  kCmdMdId,
1162
+  kPostMdId
1162 1163
 };
1163 1164
 
1164 1165
 cmDspClass_t _cmModulatorDC;
@@ -1172,9 +1173,10 @@ typedef struct
1172 1173
   cmChar_t*      modLabel;
1173 1174
   unsigned       onSymId;
1174 1175
   unsigned       offSymId;
1176
+  unsigned       postSymId;
1175 1177
 } cmDspScMod_t;
1176 1178
 
1177
-void _cmDspScModCb( void* arg, unsigned varSymId, double value )
1179
+void _cmDspScModCb( void* arg, unsigned varSymId, double value, bool postFl )
1178 1180
 {
1179 1181
   cmDspScMod_t* p = (cmDspScMod_t*)arg;
1180 1182
 
@@ -1183,6 +1185,9 @@ void _cmDspScModCb( void* arg, unsigned varSymId, double value )
1183 1185
     return;
1184 1186
 
1185 1187
   cmDspSetDouble(p->tmp_ctx,&p->inst,varPtr->constId,value);
1188
+
1189
+  if( postFl )
1190
+    cmDspSetSymbol(p->tmp_ctx,&p->inst,kPostMdId,p->postSymId);
1186 1191
   
1187 1192
 }
1188 1193
 
@@ -1196,6 +1201,7 @@ cmDspInst_t*  _cmDspScModAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsigned
1196 1201
     { "index",   kScLocIdxMdId, 0,0, kInDsvFl  | kUIntDsvFl,  "Score follower index input."},
1197 1202
     { "reset",   kResetIdxMdId, 0,0, kInDsvFl  | kUIntDsvFl | kOptArgDsvFl, "Reset the modulator and go to the score index."},
1198 1203
     { "cmd",     kCmdMdId,      0,0, kInDsvFl  | kSymDsvFl  | kOptArgDsvFl, "on | off."},
1204
+    { "post",    kPostMdId,     0,0, kOutDsvFl | kSymDsvFl, "Sends 'post' symbol after a message transmission if the 'post' flag is set in scMod."},
1199 1205
     { NULL, 0, 0, 0, 0 }
1200 1206
   };
1201 1207
 
@@ -1253,6 +1259,7 @@ cmDspInst_t*  _cmDspScModAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsigned
1253 1259
   p->mp       = mp;
1254 1260
   p->onSymId  = cmSymTblId(ctx->stH,"on");
1255 1261
   p->offSymId = cmSymTblId(ctx->stH,"off");
1262
+  p->postSymId = cmSymTblRegisterStaticSymbol(ctx->stH,"post");
1256 1263
 
1257 1264
   mp->cbArg = p;  // set the modulator callback arg
1258 1265
 
@@ -1819,7 +1826,7 @@ cmDspRC_t _cmDspActiveMeasRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEv
1819 1826
 
1820 1827
           // transmit the records value and cost
1821 1828
           cmDspSetDouble(ctx,inst,varId,r->value);
1822
-          cmDspSetDouble(ctx,inst,kCostAmId,r->value);
1829
+          cmDspSetDouble(ctx,inst,kCostAmId,r->cost);
1823 1830
 
1824 1831
           prvLoc = r->loc;
1825 1832
         } 

Завантаження…
Відмінити
Зберегти