Browse Source

cmProc4.h:Update comments.

master
kpl 11 years ago
parent
commit
5fac001b90
1 changed files with 24 additions and 8 deletions
  1. 24
    8
      cmProc4.h

+ 24
- 8
cmProc4.h View File

334
    cmScMatchMidi_t*     midiBuf;  // midiBuf[mn]
334
    cmScMatchMidi_t*     midiBuf;  // midiBuf[mn]
335
 
335
 
336
    cmScMatcherResult_t* res;      // res[rn]
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
    unsigned             ri;       // next avail res[] recd.
338
    unsigned             ri;       // next avail res[] recd.
339
 
339
 
340
    double               s_opt;          // 
340
    double               s_opt;          // 
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
 cmRC_t       cmScMatcherFree(  cmScMatcher** pp );
374
 cmRC_t       cmScMatcherFree(  cmScMatcher** pp );
359
 cmRC_t       cmScMatcherInit(  cmScMatcher* p, double srate, cmScH_t scH, unsigned scWndN, unsigned midiWndN, cmScMatcherCb_t cbFunc, void* cbArg );
375
 cmRC_t       cmScMatcherInit(  cmScMatcher* p, double srate, cmScH_t scH, unsigned scWndN, unsigned midiWndN, cmScMatcherCb_t cbFunc, void* cbArg );
360
 cmRC_t       cmScMatcherFinal( cmScMatcher* p );
376
 cmRC_t       cmScMatcherFinal( cmScMatcher* p );
362
 // 'scLocIdx' is a score index as used by cmScoreLoc(scH) not into p->mp->loc[].
378
 // 'scLocIdx' is a score index as used by cmScoreLoc(scH) not into p->mp->loc[].
363
 cmRC_t       cmScMatcherReset( cmScMatcher* p, unsigned scLocIdx );
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
 // index int p->mp->loc[]) looking for the best match to p->midiBuf[].  
382
 // index int p->mp->loc[]) looking for the best match to p->midiBuf[].  
367
 // The score window contain scWndN (p->mp->mcn-1) score locations.
383
 // The score window contain scWndN (p->mp->mcn-1) score locations.
368
 // Returns the index into p->mp->loc[] of the start of the best
384
 // Returns the index into p->mp->loc[] of the start of the best
395
 // cmSubSysFailRC - a scan resync failed in cmScMatcherStep().
411
 // cmSubSysFailRC - a scan resync failed in cmScMatcherStep().
396
 cmRC_t     cmScMatcherExec(  cmScMatcher* p, unsigned smpIdx, unsigned status, cmMidiByte_t d0, cmMidiByte_t d1, unsigned* scLocIdxPtr );
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
   double           srate;    // 
441
   double           srate;    // 
425
   cmScMatch*       mp;       //
442
   cmScMatch*       mp;       //
426
   unsigned         mii;      // next avail recd in midiBuf[]
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
   cmScMatchMidi_t* midiBuf;  // midiBuf[mn]
445
   cmScMatchMidi_t* midiBuf;  // midiBuf[mn]
429
 
446
 
430
-  unsigned         sn;       // length of set[]
447
+  unsigned         sn;       // length of set[] (init. to cmScoreSetCount())
431
   cmScMeasSet_t*   set;      // set[sn]  
448
   cmScMeasSet_t*   set;      // set[sn]  
432
 
449
 
433
   unsigned         dn;       // length of dynRef[]
450
   unsigned         dn;       // length of dynRef[]
434
   unsigned*        dynRef;   // dynRef[dn]  
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
   unsigned         vsi;      // set[vsi:nsi-1] indicates sets with new values following a call to cmScMeasExec()
456
   unsigned         vsi;      // set[vsi:nsi-1] indicates sets with new values following a call to cmScMeasExec()
440
   unsigned         vsli;     // vsli:nsli-1 indicates cmScore loc's to check for section triggers following a call to cmScMeasExec()
457
   unsigned         vsli;     // vsli:nsli-1 indicates cmScore loc's to check for section triggers following a call to cmScMeasExec()
468
 // this event.
485
 // this event.
469
 cmRC_t    cmScMeasExec(  cmScMeas* p, unsigned mni,  unsigned locIdx, unsigned scEvtIdx, unsigned flags, unsigned smpIdx, unsigned pitch, unsigned vel );
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
 unsigned   cmScAlignScanToTimeLineEvent( cmScMatcher* p, cmTlH_t tlH, cmTlObj_t* top, unsigned endSmpIdx );
490
 unsigned   cmScAlignScanToTimeLineEvent( cmScMatcher* p, cmTlH_t tlH, cmTlObj_t* top, unsigned endSmpIdx );

Loading…
Cancel
Save