Ver código fonte

cmDspKr.c MIDI file player now emits time tag. Changes related to score follower development

master
kevin 11 anos atrás
pai
commit
3a5ab6f36c
1 arquivos alterados com 29 adições e 18 exclusões
  1. 29
    18
      dsp/cmDspKr.c

+ 29
- 18
dsp/cmDspKr.c Ver arquivo

513
   kEsiMfId,
513
   kEsiMfId,
514
   kStatusMfId,
514
   kStatusMfId,
515
   kD0MfId,
515
   kD0MfId,
516
-  kD1MfId
516
+  kD1MfId,
517
+  kSmpIdxMfId
517
 };
518
 };
518
 
519
 
519
 cmDspClass_t _cmMidiFilePlayDC;
520
 cmDspClass_t _cmMidiFilePlayDC;
546
   {
547
   {
547
     { "fn",     kFnMfId,     0, 0, kInDsvFl  | kStrzDsvFl, "File name"},
548
     { "fn",     kFnMfId,     0, 0, kInDsvFl  | kStrzDsvFl, "File name"},
548
     { "sel",    kSelMfId,    0, 0, kInDsvFl  | kSymDsvFl,  "start | stop | continue" },
549
     { "sel",    kSelMfId,    0, 0, kInDsvFl  | kSymDsvFl,  "start | stop | continue" },
549
-    { "bsi",    kBsiMfId,    0, 0, kInDsvFl  | kIntDsvFl, "Starting sample." },
550
-    { "esi",    kEsiMfId,    0, 0, kInDsvFl  | kIntDsvFl, "Ending sample."},
551
-    { "status", kStatusMfId, 0, 0, kOutDsvFl | kIntDsvFl, "Status value output" },
550
+    { "bsi",    kBsiMfId,    0, 0, kInDsvFl  | kIntDsvFl,  "Starting sample." },
551
+    { "esi",    kEsiMfId,    0, 0, kInDsvFl  | kIntDsvFl,  "Ending sample."},
552
+    { "status", kStatusMfId, 0, 0, kOutDsvFl | kIntDsvFl,  "Status value output" },
552
     { "d0",     kD0MfId,     0, 0, kOutDsvFl | kUIntDsvFl, "Data byte 0" },
553
     { "d0",     kD0MfId,     0, 0, kOutDsvFl | kUIntDsvFl, "Data byte 0" },
553
     { "d1",     kD1MfId,     0, 0, kOutDsvFl | kUIntDsvFl, "Data byte 1" },
554
     { "d1",     kD1MfId,     0, 0, kOutDsvFl | kUIntDsvFl, "Data byte 1" },
555
+    { "smpidx", kSmpIdxMfId, 0, 0, kOutDsvFl | kUIntDsvFl, "Msg time tag as a sample index." }, 
554
     { NULL, 0, 0, 0, 0 }
556
     { NULL, 0, 0, 0, 0 }
555
   };
557
   };
556
 
558
 
646
       {
648
       {
647
         case kNoteOnMdId:
649
         case kNoteOnMdId:
648
         case kCtlMdId:
650
         case kCtlMdId:
651
+          cmDspSetUInt(ctx,inst, kSmpIdxMfId, mp->dtick);
649
           cmDspSetUInt(ctx,inst, kD1MfId,     mp->u.chMsgPtr->d1);
652
           cmDspSetUInt(ctx,inst, kD1MfId,     mp->u.chMsgPtr->d1);
650
           cmDspSetUInt(ctx,inst, kD0MfId,     mp->u.chMsgPtr->d0);
653
           cmDspSetUInt(ctx,inst, kD0MfId,     mp->u.chMsgPtr->d0);
651
           cmDspSetUInt(ctx,inst, kStatusMfId, mp->status);
654
           cmDspSetUInt(ctx,inst, kStatusMfId, mp->status);
705
 {
708
 {
706
   kFnSfId,
709
   kFnSfId,
707
   kBufCntSfId,
710
   kBufCntSfId,
708
-  kBufMsSfId,
711
+  kMinLkAhdSfId,
712
+  kMaxWndCntSfId,
713
+  kMinVelSfId,
709
   kIndexSfId,
714
   kIndexSfId,
710
   kStatusSfId,
715
   kStatusSfId,
711
   kD0SfId,
716
   kD0SfId,
712
   kD1SfId,
717
   kD1SfId,
718
+  kSmpIdxSfId,
713
   kOutSfId
719
   kOutSfId
714
 };
720
 };
715
 
721
 
726
 {
732
 {
727
   cmDspVarArg_t args[] =
733
   cmDspVarArg_t args[] =
728
   {
734
   {
729
-    { "fn",    kFnSfId,     0, 0, kInDsvFl | kStrzDsvFl   | kReqArgDsvFl,   "Score file." },
730
-    { "bufcnt",kBufCntSfId, 0, 0, kInDsvFl | kUIntDsvFl,                    "Event buffer element count." },
731
-    { "bufms", kBufMsSfId,  0, 0, kInDsvFl | kUIntDsvFl,                    "Event buffer length milliseconds."},
732
-    { "index", kIndexSfId,  0, 0, kInDsvFl | kUIntDsvFl,                    "Tracking start location."},
733
-    { "status",kStatusSfId, 0, 0, kInDsvFl | kUIntDsvFl,                    "MIDI status byte"},
734
-    { "d0",    kD0SfId,     0, 0, kInDsvFl | kUIntDsvFl,                    "MIDI data byte 0"},
735
-    { "d1",    kD1SfId,     0, 0, kInDsvFl | kUIntDsvFl,                    "MIDI data byte 1"},
736
-    { "out",   kOutSfId,    0, 0, kOutDsvFl| kUIntDsvFl,                    "Current score index."},
737
-    { NULL,    0,           0, 0, 0, NULL }
735
+    { "fn",    kFnSfId,       0, 0, kInDsvFl | kStrzDsvFl   | kReqArgDsvFl,   "Score file." },
736
+    { "bufcnt",kBufCntSfId,   0, 0, kInDsvFl | kUIntDsvFl,                    "Event buffer element count." },
737
+    { "lkahd", kMinLkAhdSfId, 0, 0, kInDsvFl | kUIntDsvFl,                    "Minimum window look-ahead."},
738
+    { "wndcnt",kMaxWndCntSfId,0, 0, kInDsvFl | kUIntDsvFl,                    "Maximum window length."},
739
+    { "minvel",kMinVelSfId,   0, 0, kInDsvFl | kUIntDsvFl,                    "Minimum velocity."},
740
+    { "index", kIndexSfId,    0, 0, kInDsvFl | kUIntDsvFl,                    "Tracking start location."},
741
+    { "status",kStatusSfId,   0, 0, kInDsvFl | kUIntDsvFl,                    "MIDI status byte"},
742
+    { "d0",    kD0SfId,       0, 0, kInDsvFl | kUIntDsvFl,                    "MIDI data byte 0"},
743
+    { "d1",    kD1SfId,       0, 0, kInDsvFl | kUIntDsvFl,                    "MIDI data byte 1"},
744
+    { "smpidx",kSmpIdxSfId,   0, 0, kInDsvFl | kUIntDsvFl,                    "MIDI time tag as a sample index"},
745
+    { "out",   kOutSfId,      0, 0, kOutDsvFl| kUIntDsvFl,                    "Current score index."},
746
+    { NULL,    0,             0, 0, 0, NULL }
738
   };
747
   };
739
 
748
 
740
   cmDspScFol_t* p;
749
   cmDspScFol_t* p;
743
     return NULL;
752
     return NULL;
744
   
753
   
745
 
754
 
746
-  p->sfp = cmScFolAlloc(ctx->cmProcCtx, NULL, 0, 0, 0, cmScNullHandle );
755
+  p->sfp = cmScFolAlloc(ctx->cmProcCtx, NULL, 0, cmScNullHandle, 0, 0, 0, 0 );
747
 
756
 
748
-  cmDspSetDefaultUInt( ctx, &p->inst,  kBufCntSfId,     0,    10);
749
-  cmDspSetDefaultUInt( ctx, &p->inst,  kBufMsSfId,      0,  5000);
757
+  cmDspSetDefaultUInt( ctx, &p->inst,  kBufCntSfId,     0,     7);
758
+  cmDspSetDefaultUInt( ctx, &p->inst,  kMinLkAhdSfId,   0,    10);
759
+  cmDspSetDefaultUInt( ctx, &p->inst,  kMaxWndCntSfId,  0,    25);
760
+  cmDspSetDefaultUInt( ctx, &p->inst,  kMinVelSfId,     0,     5);
750
   cmDspSetDefaultUInt( ctx, &p->inst,  kIndexSfId,      0,     0);  
761
   cmDspSetDefaultUInt( ctx, &p->inst,  kIndexSfId,      0,     0);  
751
   cmDspSetDefaultUInt( ctx, &p->inst,  kOutSfId,        0,     0);
762
   cmDspSetDefaultUInt( ctx, &p->inst,  kOutSfId,        0,     0);
752
 
763
 
785
     return rc;
796
     return rc;
786
 
797
 
787
   if( cmScoreIsValid(p->scH) )
798
   if( cmScoreIsValid(p->scH) )
788
-    if( cmScFolInit(p->sfp, cmDspSampleRate(ctx), cmDspUInt(inst,kBufCntSfId), cmDspUInt(inst,kBufMsSfId), p->scH) != cmOkRC )
799
+    if( cmScFolInit(p->sfp, cmDspSampleRate(ctx),  p->scH, cmDspUInt(inst,kBufCntSfId), cmDspUInt(inst,kMinLkAhdSfId), cmDspUInt(inst,kMaxWndCntSfId), cmDspUInt(inst,kMinVelSfId) ) != cmOkRC )
789
       rc = cmErrMsg(&inst->classPtr->err, kSubSysFailDspRC, "Internal score follower allocation failed.");
800
       rc = cmErrMsg(&inst->classPtr->err, kSubSysFailDspRC, "Internal score follower allocation failed.");
790
 
801
 
791
   return rc;  
802
   return rc;  

Carregando…
Cancelar
Salvar