Procházet zdrojové kódy

cmDspKr.c : cmDspRecdPlay now takes an initial score search location index.

master
kevin před 11 roky
rodič
revize
e07e632de6
1 změnil soubory, kde provedl 17 přidání a 6 odebrání
  1. 17
    6
      dsp/cmDspKr.c

+ 17
- 6
dsp/cmDspKr.c Zobrazit soubor

@@ -27,7 +27,6 @@
27 27
 #include "cmDspSys.h"
28 28
 #include "cmMath.h"
29 29
 
30
-
31 30
 #include "cmAudioFile.h"
32 31
 #include "cmFileSys.h"
33 32
 #include "cmProcObj.h"
@@ -2487,6 +2486,7 @@ enum
2487 2486
   kFadeRatePrId,
2488 2487
   kSegFnPrId,
2489 2488
   kSegLblPrId,
2489
+  kScInitLocIdxPrId,
2490 2490
   kScLocIdxPrId,
2491 2491
   kCmdPrId,
2492 2492
   kInAudioBasePrId
@@ -2548,6 +2548,8 @@ cmDspRC_t _cmDspRecdPlayOpenScore( cmDspCtx_t* ctx, cmDspInst_t* inst )
2548 2548
       cmRecdPlayInsertRecord(p->rcdply,segSymId,segFn);
2549 2549
     }
2550 2550
 
2551
+    p->scLocIdx = cmDspUInt(inst,kScInitLocIdxPrId);
2552
+
2551 2553
   }
2552 2554
 
2553 2555
   return rc;
@@ -2578,6 +2580,7 @@ cmDspInst_t*  _cmDspRecdPlayAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsig
2578 2580
     1,         "frate",  kFadeRatePrId,   0,0, kInDsvFl   | kDoubleDsvFl | kOptArgDsvFl, "Fade rate in dB per second.",
2579 2581
     1,         "segFn",  kSegFnPrId,      0,0, kInDsvFl   | kStrzDsvFl   | kOptArgDsvFl, "Preload an audio segment.",
2580 2582
     1,         "segLbl", kSegLblPrId,     0,0, kInDsvFl   | kStrzDsvFl   | kOptArgDsvFl, "Score symbol of preloaded audio segment.",
2583
+    1,         "initIdx",kScInitLocIdxPrId,0,0,kInDsvFl   | kUIntDsvFl,                  "Score search start location.",
2581 2584
     1,         "index",  kScLocIdxPrId,   0,0, kInDsvFl   | kUIntDsvFl,                "Score follower location index.",
2582 2585
     1,         "cmd",    kCmdPrId,        0,0, kInDsvFl   | kSymDsvFl,                 "on=reset off=stop.",
2583 2586
     chCnt,     "in",     kInAudioBasePrId,0,1, kInDsvFl   | kAudioBufDsvFl,            "Audio input",
@@ -2598,10 +2601,11 @@ cmDspInst_t*  _cmDspRecdPlayAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsig
2598 2601
   cmDspSetDefaultDouble(ctx,&p->inst, kMaxLaSecsPrId,0.0, 2.0);
2599 2602
   cmDspSetDefaultDouble(ctx,&p->inst, kCurLaSecsPrId,0.0, 0.1);
2600 2603
   cmDspSetDefaultDouble(ctx,&p->inst, kFadeRatePrId, 0.0, 1.0);
2604
+  cmDspSetDefaultUInt(  ctx,&p->inst, kScInitLocIdxPrId,0,0);
2601 2605
 
2602 2606
   printf("1 max la secs:%f\n",cmDspDouble(&p->inst,kMaxLaSecsPrId));
2603 2607
 
2604
-
2608
+  
2605 2609
 
2606 2610
 
2607 2611
   return &p->inst;
@@ -2685,7 +2689,7 @@ cmDspRC_t _cmDspRecdPlayRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_
2685 2689
       {
2686 2690
         printf("rewind\n");
2687 2691
         cmRecdPlayRewind(p->rcdply);
2688
-        p->scLocIdx = 0;
2692
+        p->scLocIdx = cmDspUInt(inst,kScInitLocIdxPrId);
2689 2693
       }
2690 2694
       else
2691 2695
         if( cmDspSymbol(inst,kCmdPrId) == p->offSymId )
@@ -2698,9 +2702,16 @@ cmDspRC_t _cmDspRecdPlayRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_
2698 2702
       cmRecdPlaySetLaSecs(p->rcdply, cmDspDouble(inst,kCurLaSecsPrId));
2699 2703
       break;
2700 2704
 
2705
+    case kScInitLocIdxPrId:
2706
+      printf("init-idx:%i\n",cmDspUInt(inst,kScInitLocIdxPrId));
2707
+      break;
2708
+
2701 2709
     case kScLocIdxPrId:
2702 2710
       {
2703
-        unsigned endScLocIdx = cmDspUInt(inst,kScLocIdxPrId) ;
2711
+        unsigned endScLocIdx = cmDspUInt(inst,kScLocIdxPrId);
2712
+
2713
+        if( endScLocIdx < cmDspUInt(inst,kScInitLocIdxPrId) )
2714
+          break;
2704 2715
 
2705 2716
         for(; p->scLocIdx<=endScLocIdx; p->scLocIdx+=1)
2706 2717
         {
@@ -2711,12 +2722,12 @@ cmDspRC_t _cmDspRecdPlayRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_
2711 2722
             switch( mp->markTypeId )
2712 2723
             {
2713 2724
               case kRecdBegScMId:
2714
-                printf("recd-beg\n");
2725
+                printf("recd-beg %s\n",cmSymTblLabel(ctx->stH,mp->labelSymId));
2715 2726
                 cmRecdPlayBeginRecord(p->rcdply, mp->labelSymId );
2716 2727
                 break;
2717 2728
                 
2718 2729
               case kRecdEndScMId:
2719
-                printf("recd-end\n");
2730
+                printf("recd-end %s\n",cmSymTblLabel(ctx->stH,mp->labelSymId));
2720 2731
                 cmRecdPlayEndRecord(p->rcdply, mp->labelSymId );
2721 2732
                 break;
2722 2733
                 

Načítá se…
Zrušit
Uložit