Browse Source

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

master
kevin 10 years ago
parent
commit
e07e632de6
1 changed files with 17 additions and 6 deletions
  1. 17
    6
      dsp/cmDspKr.c

+ 17
- 6
dsp/cmDspKr.c View File

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

Loading…
Cancel
Save