Sfoglia il codice sorgente

cmDspClass.h,cmDspUi.c,cmDspKr.c : Added 'meas' inputs to cmDspScore and cmDspTimeline to allow the current score and timeline location to be set programattically.

master
kevin 8 anni fa
parent
commit
068cff567b
3 ha cambiato i file con 24 aggiunte e 11 eliminazioni
  1. 2
    2
      dsp/cmDspClass.h
  2. 16
    5
      dsp/cmDspKr.c
  3. 6
    4
      dsp/cmDspUi.c

+ 2
- 2
dsp/cmDspClass.h Vedi File

@@ -403,8 +403,8 @@ extern "C" {
403 403
   cmDspRC_t  cmDspUiMeterCreate(       cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned minVarId,  unsigned maxVarId,  unsigned valVarId,  unsigned lblVarId );
404 404
   cmDspRC_t  cmDspUiButtonCreate(      cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned typeDuiId, unsigned outVarId, unsigned lblVarId );
405 405
   cmDspRC_t  cmDspUiLabelCreate(       cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned lblVarId,  unsigned alignVarId );
406
-  cmDspRC_t  cmDspUiTimeLineCreate(    cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned tlFileVarId,  unsigned audPathVarId, unsigned selVarId, unsigned cursVarId );
407
-  cmDspRC_t  cmDspUiScoreCreate(       cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned scFileVarId,  unsigned selVarId, unsigned smpIdxVarId, unsigned pitchVarId, unsigned velVarId, unsigned locIdxVarIdx, unsigned evtIdxVarIdx, unsigned dynLvlVarIdx, unsigned valTypeVarIdx, unsigned valueVarIdx );
406
+  cmDspRC_t  cmDspUiTimeLineCreate(    cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned tlFileVarId,  unsigned audPathVarId, unsigned selVarId, unsigned measVarId, unsigned cursVarId );
407
+  cmDspRC_t  cmDspUiScoreCreate(       cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned scFileVarId,  unsigned selVarId, unsigned smpIdxVarId, unsigned pitchVarId, unsigned velVarId, unsigned locIdxVarIdx, unsigned evtIdxVarIdx, unsigned dynLvlVarIdx, unsigned valTypeVarIdx, unsigned valueVarIdx, unsigned kMeasScId );
408 408
   cmDspRC_t  cmDspUiTakeSeqBldrCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned fileNameVarId, unsigned ptrVarId, unsigned selVarId, unsigned refreshVarId );
409 409
   cmDspRC_t  cmDspUiTakeSeqRendCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned ptrVarId,      unsigned refreshVarId, unsigned selVarId  );
410 410
   cmDspRC_t  cmDspUi2dCreate(          cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned xVarId,        unsigned yVarId,       unsigned radiusVarId, unsigned angleVarId);

+ 16
- 5
dsp/cmDspKr.c Vedi File

@@ -290,6 +290,7 @@ enum
290 290
   kTlFileTlId,
291 291
   kPrefixPathTlId,
292 292
   kSelTlId,
293
+  kMeasTlId,
293 294
   kCursTlId,
294 295
   kResetTlId,
295 296
   kAudFnTlId,
@@ -299,7 +300,7 @@ enum
299 300
   kBegAudSmpIdxTlId,
300 301
   kEndAudSmpIdxTlId,
301 302
   kBegMidiSmpIdxTlId,
302
-  kEndMidiSmpIdxTlId
303
+  kEndMidiSmpIdxTlId,
303 304
 };
304 305
 
305 306
 cmDspClass_t _cmTimeLineDC;
@@ -318,6 +319,7 @@ cmDspInst_t*  _cmDspTimeLineAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsig
318 319
     { "tlfile",  kTlFileTlId,         0, 0, kInDsvFl   | kStrzDsvFl | kReqArgDsvFl, "Time line file." },
319 320
     { "path",    kPrefixPathTlId,     0, 0, kInDsvFl   | kStrzDsvFl | kReqArgDsvFl, "Time line data file prefix path"    },
320 321
     { "sel",     kSelTlId,            0, 0, kInDsvFl   | kOutDsvFl  | kUIntDsvFl,   "Selected marker id."},
322
+    { "meas",    kMeasTlId,           0, 0, kInDsvFl   | kUIntDsvFl,  "Select a bar marker and generate a 'sel' output."},
321 323
     { "curs",    kCursTlId,           0, 0, kInDsvFl   | kUIntDsvFl,  "Current audio file index."},
322 324
     { "reset",   kResetTlId,          0, 0, kInDsvFl   | kSymDsvFl,   "Resend all outputs." },
323 325
     { "afn",     kAudFnTlId,          0, 0, kOutDsvFl  | kStrzDsvFl,  "Selected Audio file." },
@@ -345,7 +347,7 @@ cmDspInst_t*  _cmDspTimeLineAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsig
345 347
   cmDspSetDefaultInt(  ctx, &p->inst,  kEndMidiSmpIdxTlId, 0, cmInvalidIdx);
346 348
 
347 349
   // create the UI control
348
-  cmDspUiTimeLineCreate(ctx,&p->inst,kTlFileTlId,kPrefixPathTlId,kSelTlId,kCursTlId);
350
+  cmDspUiTimeLineCreate(ctx,&p->inst,kTlFileTlId,kPrefixPathTlId,kSelTlId,kMeasTlId,kCursTlId);
349 351
 
350 352
   p->tlH = cmTimeLineNullHandle;
351 353
 
@@ -442,7 +444,11 @@ cmDspRC_t _cmDspTimeLineRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_
442 444
       }
443 445
       
444 446
       break;
445
-
447
+      
448
+    case kMeasTlId:
449
+      cmDspSetEvent(ctx,inst,evt);
450
+      break;
451
+      
446 452
     default:
447 453
       {assert(0);}
448 454
   }
@@ -483,7 +489,8 @@ enum
483 489
   kEvtIdxScId,
484 490
   kDynScId,
485 491
   kValTypeScId,
486
-  kValueScId
492
+  kValueScId,
493
+  kMeasScId,
487 494
 };
488 495
 
489 496
 cmDspClass_t _cmScoreDC;
@@ -513,6 +520,7 @@ cmDspInst_t*  _cmDspScoreAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsigned
513 520
     { "dyn",     kDynScId,    0, 0, kOutDsvFl | kUIntDsvFl,                "Dynamic level of previous event index."},
514 521
     { "type",    kValTypeScId,0, 0, kOutDsvFl | kUIntDsvFl,                "Output variable type."},
515 522
     { "value",   kValueScId,  0, 0, kOutDsvFl | kDoubleDsvFl,              "Output variable value."},
523
+    { "meas",    kMeasScId,   0, 0, kInDsvFl  | kUIntDsvFl,                "Trigger this measures location to emit from 'sel'."},
516 524
     { NULL, 0, 0, 0, 0 }
517 525
   };
518 526
 
@@ -523,7 +531,7 @@ cmDspInst_t*  _cmDspScoreAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsigned
523 531
   p->printSymId = cmSymTblRegisterStaticSymbol(ctx->stH,"dump");
524 532
 
525 533
   // create the UI control
526
-  cmDspUiScoreCreate(ctx,&p->inst,kFnScId,kSelScId,kSmpIdxScId,kD0ScId,kD1ScId,kLocIdxScId,kEvtIdxScId,kDynScId,kValTypeScId,kValueScId);
534
+  cmDspUiScoreCreate(ctx,&p->inst,kFnScId,kSelScId,kSmpIdxScId,kD0ScId,kD1ScId,kLocIdxScId,kEvtIdxScId,kDynScId,kValTypeScId,kValueScId,kMeasScId);
527 535
 
528 536
   p->scH = cmScNullHandle;
529 537
 
@@ -637,6 +645,9 @@ cmDspRC_t _cmDspScoreRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t*
637 645
         cmScorePrintLoc(p->scH);
638 646
       break;
639 647
 
648
+    case kMeasScId:
649
+      break;
650
+
640 651
   }
641 652
 
642 653
   return kOkDspRC;

+ 6
- 4
dsp/cmDspUi.c Vedi File

@@ -362,10 +362,10 @@ cmDspRC_t  cmDspUiLabelCreate(  cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned lbl
362 362
   return rc;
363 363
 }
364 364
 
365
-cmDspRC_t  cmDspUiTimeLineCreate(   cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned tlFileVarId, unsigned audPathVarId, unsigned selVarId, unsigned cursVarId )
365
+cmDspRC_t  cmDspUiTimeLineCreate(   cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned tlFileVarId, unsigned audPathVarId, unsigned selVarId, unsigned measVarId, unsigned cursVarId )
366 366
 {
367 367
   cmDspRC_t    rc;
368
-  unsigned     arr[] = { tlFileVarId, audPathVarId, selVarId, cursVarId  };
368
+  unsigned     arr[] = { tlFileVarId, audPathVarId, selVarId, measVarId, cursVarId  };
369 369
   cmDspValue_t v;
370 370
   unsigned     vn    = sizeof(arr)/sizeof(arr[0]);
371 371
   cmDsvSetUIntMtx(&v,arr,vn,1);
@@ -383,14 +383,15 @@ cmDspRC_t  cmDspUiTimeLineCreate(   cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned
383 383
   cmDspInstVarSetFlags( ctx, inst, tlFileVarId,  kUiDsvFl );
384 384
   cmDspInstVarSetFlags( ctx, inst, audPathVarId, kUiDsvFl );
385 385
   cmDspInstVarSetFlags( ctx, inst, selVarId,     kUiDsvFl );
386
+  cmDspInstVarSetFlags( ctx, inst, measVarId,     kUiDsvFl );
386 387
   cmDspInstVarSetFlags( ctx, inst, cursVarId,     kUiDsvFl );
387 388
   return rc;
388 389
 }
389 390
 
390
-cmDspRC_t  cmDspUiScoreCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned scFileVarId, unsigned selVarId, unsigned smpIdxVarId, unsigned pitchVarId, unsigned velVarId, unsigned locIdxVarId, unsigned evtIdxVarId, unsigned dynVarId, unsigned valTypeVarId, unsigned valueVarId )
391
+cmDspRC_t  cmDspUiScoreCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned scFileVarId, unsigned selVarId, unsigned smpIdxVarId, unsigned pitchVarId, unsigned velVarId, unsigned locIdxVarId, unsigned evtIdxVarId, unsigned dynVarId, unsigned valTypeVarId, unsigned valueVarId, unsigned measVarId )
391 392
 {
392 393
   cmDspRC_t    rc;
393
-  unsigned     arr[] = { scFileVarId, selVarId, smpIdxVarId, pitchVarId, velVarId, locIdxVarId, evtIdxVarId, dynVarId, valTypeVarId, valueVarId };
394
+  unsigned     arr[] = { scFileVarId, selVarId, smpIdxVarId, pitchVarId, velVarId, locIdxVarId, evtIdxVarId, dynVarId, valTypeVarId, valueVarId, measVarId };
394 395
   cmDspValue_t v;
395 396
   unsigned     vn    = sizeof(arr)/sizeof(arr[0]);
396 397
   cmDsvSetUIntMtx(&v,arr,vn,1);
@@ -411,6 +412,7 @@ cmDspRC_t  cmDspUiScoreCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned scFi
411 412
   cmDspInstVarSetFlags( ctx, inst, dynVarId,     kUiDsvFl );
412 413
   cmDspInstVarSetFlags( ctx, inst, valTypeVarId, kUiDsvFl );
413 414
   cmDspInstVarSetFlags( ctx, inst, valueVarId,   kUiDsvFl );
415
+  cmDspInstVarSetFlags( ctx, inst, measVarId,    kUiDsvFl );
414 416
 
415 417
   return rc;
416 418
 }

Loading…
Annulla
Salva