Browse Source

cmDspKr.c:

1) Changed time-line to support setting data prefix path
in cmTimeLine initialization.
2) Added 'scloc' to 'ActiveMeas'.
master
kpl 11 years ago
parent
commit
b56fee2605
1 changed files with 27 additions and 7 deletions
  1. 27
    7
      dsp/cmDspKr.c

+ 27
- 7
dsp/cmDspKr.c View File

281
 enum
281
 enum
282
 {
282
 {
283
   kTlFileTlId,
283
   kTlFileTlId,
284
-  kAudPathTlId,
284
+  kPrefixPathTlId,
285
   kSelTlId,
285
   kSelTlId,
286
   kCursTlId,
286
   kCursTlId,
287
   kResetTlId,
287
   kResetTlId,
307
   cmDspVarArg_t args[] =
307
   cmDspVarArg_t args[] =
308
   {
308
   {
309
     { "tlfile",  kTlFileTlId,         0, 0, kInDsvFl   | kStrzDsvFl | kReqArgDsvFl, "Time line file." },
309
     { "tlfile",  kTlFileTlId,         0, 0, kInDsvFl   | kStrzDsvFl | kReqArgDsvFl, "Time line file." },
310
-    { "path",    kAudPathTlId,        0, 0, kInDsvFl   | kStrzDsvFl | kReqArgDsvFl, "Audio path"    },
310
+    { "path",    kPrefixPathTlId,     0, 0, kInDsvFl   | kStrzDsvFl | kReqArgDsvFl, "Time line data file prefix path"    },
311
     { "sel",     kSelTlId,            0, 0, kInDsvFl   | kOutDsvFl  | kUIntDsvFl,   "Selected marker id."},
311
     { "sel",     kSelTlId,            0, 0, kInDsvFl   | kOutDsvFl  | kUIntDsvFl,   "Selected marker id."},
312
     { "curs",    kCursTlId,           0, 0, kInDsvFl   | kUIntDsvFl,  "Current audio file index."},
312
     { "curs",    kCursTlId,           0, 0, kInDsvFl   | kUIntDsvFl,  "Current audio file index."},
313
     { "reset",   kResetTlId,          0, 0, kInDsvFl   | kSymDsvFl,   "Resend all outputs." },
313
     { "reset",   kResetTlId,          0, 0, kInDsvFl   | kSymDsvFl,   "Resend all outputs." },
332
   cmDspSetDefaultInt(  ctx, &p->inst,  kEndMidiSmpIdxTlId, 0, cmInvalidIdx);
332
   cmDspSetDefaultInt(  ctx, &p->inst,  kEndMidiSmpIdxTlId, 0, cmInvalidIdx);
333
 
333
 
334
   // create the UI control
334
   // create the UI control
335
-  cmDspUiTimeLineCreate(ctx,&p->inst,kTlFileTlId,kAudPathTlId,kSelTlId,kCursTlId);
335
+  cmDspUiTimeLineCreate(ctx,&p->inst,kTlFileTlId,kPrefixPathTlId,kSelTlId,kCursTlId);
336
 
336
 
337
   p->tlH = cmTimeLineNullHandle;
337
   p->tlH = cmTimeLineNullHandle;
338
 
338
 
359
   cmDspApplyAllDefaults(ctx,inst);
359
   cmDspApplyAllDefaults(ctx,inst);
360
 
360
 
361
   const cmChar_t* tlFn;
361
   const cmChar_t* tlFn;
362
+
363
+  const cmChar_t* tlPrePath = cmDspStrcz(inst,kPrefixPathTlId);
364
+
362
   if((tlFn =  cmDspStrcz(inst, kTlFileTlId )) !=  NULL )
365
   if((tlFn =  cmDspStrcz(inst, kTlFileTlId )) !=  NULL )
363
-    if( cmTimeLineInitializeFromFile(ctx->cmCtx, &p->tlH, NULL, NULL, tlFn ) != kOkTlRC )
364
-      rc = cmErrMsg(&inst->classPtr->err, kInstResetFailDspRC, "Time-line file open failed.");
366
+    if( cmTimeLineInitializeFromFile(ctx->cmCtx, &p->tlH, NULL, NULL, tlFn, tlPrePath ) != kOkTlRC )
367
+        rc = cmErrMsg(&inst->classPtr->err, kInstResetFailDspRC, "Time-line file open failed.");
365
 
368
 
366
   return rc;
369
   return rc;
367
 }
370
 }
372
 
375
 
373
   switch( evt->dstVarId )
376
   switch( evt->dstVarId )
374
   {
377
   {
375
-    case kAudPathTlId:
378
+    case kPrefixPathTlId:
376
       cmDspSetEvent(ctx,inst,evt);
379
       cmDspSetEvent(ctx,inst,evt);
377
       break;
380
       break;
378
 
381
 
1634
   kValueAmId,
1637
   kValueAmId,
1635
   kCstAmId,
1638
   kCstAmId,
1636
   kCmdAmId,
1639
   kCmdAmId,
1640
+  kScLocAmId,
1637
   kEvenAmId,
1641
   kEvenAmId,
1638
   kDynAmId,
1642
   kDynAmId,
1639
   kTempoAmId,
1643
   kTempoAmId,
1680
     { "val",      kValueAmId,    0,0, kInDsvFl  | kDoubleDsvFl,  "Meas. Value."},
1684
     { "val",      kValueAmId,    0,0, kInDsvFl  | kDoubleDsvFl,  "Meas. Value."},
1681
     { "cst",      kCstAmId,      0,0, kInDsvFl  | kDoubleDsvFl,  "Meas. Cost."},
1685
     { "cst",      kCstAmId,      0,0, kInDsvFl  | kDoubleDsvFl,  "Meas. Cost."},
1682
     { "cmd",      kCmdAmId,      0,0, kInDsvFl  | kSymDsvFl,     "Commands:add | clear | dump | rewind"}, 
1686
     { "cmd",      kCmdAmId,      0,0, kInDsvFl  | kSymDsvFl,     "Commands:add | clear | dump | rewind"}, 
1687
+    { "scloc",    kScLocAmId,    0,0, kOutDsvFl | kUIntDsvFl,    "Score location"},
1683
     { "even",     kEvenAmId,     0,0, kOutDsvFl | kDoubleDsvFl,  "Even out"},
1688
     { "even",     kEvenAmId,     0,0, kOutDsvFl | kDoubleDsvFl,  "Even out"},
1684
     { "dyn",      kDynAmId,      0,0, kOutDsvFl | kDoubleDsvFl,  "Dyn out"},
1689
     { "dyn",      kDynAmId,      0,0, kOutDsvFl | kDoubleDsvFl,  "Dyn out"},
1685
     { "tempo",    kTempoAmId,    0,0, kOutDsvFl | kDoubleDsvFl,  "Tempo out"},
1690
     { "tempo",    kTempoAmId,    0,0, kOutDsvFl | kDoubleDsvFl,  "Tempo out"},
1697
   p->rewindSymId= cmSymTblRegisterStaticSymbol(ctx->stH,"rewind");
1702
   p->rewindSymId= cmSymTblRegisterStaticSymbol(ctx->stH,"rewind");
1698
 
1703
 
1699
   cmDspSetDefaultUInt(  ctx,&p->inst,kCntAmId,  0,100);
1704
   cmDspSetDefaultUInt(  ctx,&p->inst,kCntAmId,  0,100);
1705
+  cmDspSetDefaultUInt(  ctx,&p->inst,kScLocAmId,0,0);
1700
   cmDspSetDefaultDouble(ctx,&p->inst,kEvenAmId, 0,0);
1706
   cmDspSetDefaultDouble(ctx,&p->inst,kEvenAmId, 0,0);
1701
   cmDspSetDefaultDouble(ctx,&p->inst,kDynAmId,  0,0);
1707
   cmDspSetDefaultDouble(ctx,&p->inst,kDynAmId,  0,0);
1702
   cmDspSetDefaultDouble(ctx,&p->inst,kTempoAmId,0,0);
1708
   cmDspSetDefaultDouble(ctx,&p->inst,kTempoAmId,0,0);
1760
 {
1766
 {
1761
   cmDspRC_t       rc = kOkDspRC;
1767
   cmDspRC_t       rc = kOkDspRC;
1762
   cmDspActiveMeas_t* p  = (cmDspActiveMeas_t*)inst;
1768
   cmDspActiveMeas_t* p  = (cmDspActiveMeas_t*)inst;
1763
-
1764
   cmDspSetEvent(ctx,inst,evt);
1769
   cmDspSetEvent(ctx,inst,evt);
1765
 
1770
 
1766
   switch( evt->dstVarId )
1771
   switch( evt->dstVarId )
1768
     case kSflocAmId:
1773
     case kSflocAmId:
1769
       if( p->nextFullIdx != cmInvalidIdx )
1774
       if( p->nextFullIdx != cmInvalidIdx )
1770
       {
1775
       {
1776
+        // get the recv'd score location
1771
         unsigned sflocIdx = cmDspUInt(inst,kSflocAmId);
1777
         unsigned sflocIdx = cmDspUInt(inst,kSflocAmId);
1778
+
1779
+        unsigned prvLoc = cmInvalidIdx;
1780
+
1781
+        // for each remaining avail record
1772
         for(; p->nextFullIdx < p->nextEmptyIdx; p->nextFullIdx++)
1782
         for(; p->nextFullIdx < p->nextEmptyIdx; p->nextFullIdx++)
1773
         {
1783
         {
1774
           cmDspActiveMeasRecd_t* r = p->array + p->nextFullIdx;
1784
           cmDspActiveMeasRecd_t* r = p->array + p->nextFullIdx;
1785
+
1786
+          // if this records score location is after the recv'd score loc then we're done
1775
           if( r->loc > sflocIdx )
1787
           if( r->loc > sflocIdx )
1776
             break;
1788
             break;
1777
 
1789
 
1790
+          // deterimine the records type
1778
           unsigned varId = cmInvalidId;
1791
           unsigned varId = cmInvalidId;
1779
           switch( r->type )
1792
           switch( r->type )
1780
           {
1793
           {
1785
               { assert(0); }
1798
               { assert(0); }
1786
           }
1799
           }
1787
 
1800
 
1801
+          // if this score location has not yet been sent then send it now
1802
+          if( prvLoc != r->loc )
1803
+            cmDspSetUInt(ctx,inst,kScLocAmId,r->loc);
1804
+
1805
+          // transmit the records value and cost
1788
           cmDspSetDouble(ctx,inst,varId,r->value);
1806
           cmDspSetDouble(ctx,inst,varId,r->value);
1789
           cmDspSetDouble(ctx,inst,kCostAmId,r->value);
1807
           cmDspSetDouble(ctx,inst,kCostAmId,r->value);
1808
+
1809
+          prvLoc = r->loc;
1790
         } 
1810
         } 
1791
         
1811
         
1792
 
1812
 

Loading…
Cancel
Save