瀏覽代碼

cmProc4.h:Update comments.

master
kpl 11 年之前
父節點
當前提交
5fac001b90
共有 1 個檔案被更改,包括 24 行新增8 行删除
  1. 24
    8
      cmProc4.h

+ 24
- 8
cmProc4.h 查看文件

@@ -334,7 +334,7 @@ typedef void (*cmScMatcherCb_t)( struct cmScMatcher_str* p, void* arg, cmScMatch
334 334
    cmScMatchMidi_t*     midiBuf;  // midiBuf[mn]
335 335
 
336 336
    cmScMatcherResult_t* res;      // res[rn]
337
-   unsigned             rn;       // length of res[]
337
+   unsigned             rn;       // length of res[] (set to 2*score event count)
338 338
    unsigned             ri;       // next avail res[] recd.
339 339
 
340 340
    double               s_opt;          // 
@@ -354,7 +354,23 @@ typedef void (*cmScMatcherCb_t)( struct cmScMatcher_str* p, void* arg, cmScMatch
354 354
 
355 355
 
356 356
 
357
-cmScMatcher* cmScMatcherAlloc( cmCtx* c, cmScMatcher* p, double srate, cmScH_t scH, unsigned scWndN, unsigned midiWndN, cmScMatcherCb_t cbFunc, void* cbArg );
357
+cmScMatcher* cmScMatcherAlloc( 
358
+  cmCtx*          c,        // Program context.
359
+  cmScMatcher*    p,        // Existing cmScMatcher to reallocate or NULL to allocate a new cmScMatcher.
360
+  double          srate,    // System sample rate.
361
+  cmScH_t         scH,      // Score handle.  See cmScore.h.
362
+  unsigned        scWndN,   // Length of the scores active search area. ** See Note.
363
+  unsigned        midiWndN, // Length of the MIDI active note buffer.    ** See Note.
364
+  cmScMatcherCb_t cbFunc,   // A cmScMatcherCb_t function to be called to notify the recipient of changes in the score matcher status.
365
+  void*           cbArg );  // User argument to 'cbFunc'.
366
+
367
+// The cmScMatcher maintains an internal cmScMatch object which is used to attempt to find the
368
+// best match between the current MIDI active note buffer and the current score search area.
369
+// 'scWndN' is used to set the cmScMatch 'locN' argument.
370
+// 'midiWndN' sets the length of the MIDI FIFO which is used to match to the score with
371
+// each recceived MIDI note.
372
+// 'midiWndN' must be <= 'scWndN'.
373
+
358 374
 cmRC_t       cmScMatcherFree(  cmScMatcher** pp );
359 375
 cmRC_t       cmScMatcherInit(  cmScMatcher* p, double srate, cmScH_t scH, unsigned scWndN, unsigned midiWndN, cmScMatcherCb_t cbFunc, void* cbArg );
360 376
 cmRC_t       cmScMatcherFinal( cmScMatcher* p );
@@ -362,7 +378,7 @@ cmRC_t       cmScMatcherFinal( cmScMatcher* p );
362 378
 // 'scLocIdx' is a score index as used by cmScoreLoc(scH) not into p->mp->loc[].
363 379
 cmRC_t       cmScMatcherReset( cmScMatcher* p, unsigned scLocIdx );
364 380
 
365
-// Slide a score window hopCnt times, beginning at 'bli' (an
381
+// Slide a score window 'hopCnt' times, beginning at 'bli' (an
366 382
 // index int p->mp->loc[]) looking for the best match to p->midiBuf[].  
367 383
 // The score window contain scWndN (p->mp->mcn-1) score locations.
368 384
 // Returns the index into p->mp->loc[] of the start of the best
@@ -395,6 +411,7 @@ cmRC_t     cmScMatcherStep(  cmScMatcher* p );
395 411
 // cmSubSysFailRC - a scan resync failed in cmScMatcherStep().
396 412
 cmRC_t     cmScMatcherExec(  cmScMatcher* p, unsigned smpIdx, unsigned status, cmMidiByte_t d0, cmMidiByte_t d1, unsigned* scLocIdxPtr );
397 413
 
414
+void cmScMatcherPrint( cmScMatcher* p );
398 415
 
399 416
 //=======================================================================================================================
400 417
 
@@ -424,17 +441,17 @@ typedef struct
424 441
   double           srate;    // 
425 442
   cmScMatch*       mp;       //
426 443
   unsigned         mii;      // next avail recd in midiBuf[]
427
-  unsigned         mn;       // length of of midiBuf[]
444
+  unsigned         mn;       // length of of midiBuf[]  (init. to 2*cmScoreEvtCount())
428 445
   cmScMatchMidi_t* midiBuf;  // midiBuf[mn]
429 446
 
430
-  unsigned         sn;       // length of set[]
447
+  unsigned         sn;       // length of set[] (init. to cmScoreSetCount())
431 448
   cmScMeasSet_t*   set;      // set[sn]  
432 449
 
433 450
   unsigned         dn;       // length of dynRef[]
434 451
   unsigned*        dynRef;   // dynRef[dn]  
435 452
 
436
-  unsigned         nsi;      // next set index
437
-  unsigned         nsli;     // next score location index
453
+  unsigned         nsi;      // next set index to fill (this is the set[] we are waiting to complete)
454
+  unsigned         nsli;     // next score location index we are expecting to receive
438 455
 
439 456
   unsigned         vsi;      // set[vsi:nsi-1] indicates sets with new values following a call to cmScMeasExec()
440 457
   unsigned         vsli;     // vsli:nsli-1 indicates cmScore loc's to check for section triggers following a call to cmScMeasExec()
@@ -468,7 +485,6 @@ cmRC_t    cmScMeasReset( cmScMeas* p );
468 485
 // this event.
469 486
 cmRC_t    cmScMeasExec(  cmScMeas* p, unsigned mni,  unsigned locIdx, unsigned scEvtIdx, unsigned flags, unsigned smpIdx, unsigned pitch, unsigned vel );
470 487
 
471
-
472 488
 //=======================================================================================================================
473 489
 
474 490
 unsigned   cmScAlignScanToTimeLineEvent( cmScMatcher* p, cmTlH_t tlH, cmTlObj_t* top, unsigned endSmpIdx );

Loading…
取消
儲存