瀏覽代碼

cmProc4.h/c : Added comments.

master
Kevin Larke 8 年之前
父節點
當前提交
c44a890088
共有 2 個文件被更改,包括 14 次插入7 次删除
  1. 12
    5
      cmProc4.c
  2. 2
    2
      cmProc4.h

+ 12
- 5
cmProc4.c 查看文件

27
 #include "cmScore.h"
27
 #include "cmScore.h"
28
 #include "cmProc4.h"
28
 #include "cmProc4.h"
29
 
29
 
30
+
30
 //=======================================================================================================================
31
 //=======================================================================================================================
31
 //----------------------------------------------------------------------------------------
32
 //----------------------------------------------------------------------------------------
32
 void ed_print_mtx( ed_r* r)
33
 void ed_print_mtx( ed_r* r)
1385
 
1386
 
1386
   // calc the edit distance from pitchV[] to a sliding score window
1387
   // calc the edit distance from pitchV[] to a sliding score window
1387
   for(i=0; rc==cmOkRC && (hopCnt==cmInvalidCnt || i<hopCnt); ++i)
1388
   for(i=0; rc==cmOkRC && (hopCnt==cmInvalidCnt || i<hopCnt); ++i)
1388
-  {      
1389
+  {
1389
     rc = cmScMatchExec(p->mp, bli + i, p->mp->msn, p->midiBuf, p->mp->mmn, s_opt );
1390
     rc = cmScMatchExec(p->mp, bli + i, p->mp->msn, p->midiBuf, p->mp->mmn, s_opt );
1390
 
1391
 
1391
     switch(rc)
1392
     switch(rc)
1412
   if( i_opt == cmInvalidIdx )
1413
   if( i_opt == cmInvalidIdx )
1413
     return cmInvalidIdx;
1414
     return cmInvalidIdx;
1414
 
1415
 
1416
+
1415
   // set the locIdx field in midiBuf[], trailing miss count and
1417
   // set the locIdx field in midiBuf[], trailing miss count and
1416
   // return the latest positive-match locIdx
1418
   // return the latest positive-match locIdx
1417
   p->eli = cmScMatchDoSync(p->mp,i_opt,p->midiBuf,p->mp->mmn,&p->missCnt);
1419
   p->eli = cmScMatchDoSync(p->mp,i_opt,p->midiBuf,p->mp->mmn,&p->missCnt);
1430
   }
1432
   }
1431
 
1433
 
1432
   return i_opt;
1434
   return i_opt;
1433
-
1434
 }
1435
 }
1435
 
1436
 
1436
 cmRC_t     cmScMatcherStep(  cmScMatcher* p )
1437
 cmRC_t     cmScMatcherStep(  cmScMatcher* p )
1880
   for(i=0,si=0; i<n; ++i)
1881
   for(i=0,si=0; i<n; ++i)
1881
   {
1882
   {
1882
     cmScoreLoc_t* lp = cmScoreLoc(scH,i);
1883
     cmScoreLoc_t* lp = cmScoreLoc(scH,i);
1883
-    cmScoreSet_t* sp = lp->setList;
1884
+    cmScoreSet_t* sp = lp->setList; 
1884
 
1885
 
1885
     // for each set that ends on this score location
1886
     // for each set that ends on this score location
1886
     for(; sp!=NULL; sp=sp->llink,++si)
1887
     for(; sp!=NULL; sp=sp->llink,++si)
1913
     return rc;
1914
     return rc;
1914
 
1915
 
1915
   // assign set[].bli and set[].eli
1916
   // assign set[].bli and set[].eli
1917
+
1918
+  // for each measurment set
1916
   for(j=0; j<p->sn; ++j)
1919
   for(j=0; j<p->sn; ++j)
1917
   {
1920
   {
1918
     cmScMeasSet_t* msp = p->set + j;
1921
     cmScMeasSet_t* msp = p->set + j;
1919
 
1922
 
1923
+    // for each score location
1920
     for(i=0; i<p->mp->locN; ++i)
1924
     for(i=0; i<p->mp->locN; ++i)
1921
     {
1925
     {
1926
+      // if this set starts on this score location 
1922
       if( msp->bli==cmInvalidIdx && msp->bsli==p->mp->loc[i].scLocIdx )
1927
       if( msp->bli==cmInvalidIdx && msp->bsli==p->mp->loc[i].scLocIdx )
1923
-        msp->bli = i;
1928
+        msp->bli = i; // store the index of the score location
1924
 
1929
 
1930
+      // if this set end on this score location 
1925
       if( msp->esli==p->mp->loc[i].scLocIdx )
1931
       if( msp->esli==p->mp->loc[i].scLocIdx )
1926
-        msp->eli = i;
1932
+        msp->eli = i;  // store the index of the score location
1927
     }  
1933
     }  
1928
 
1934
 
1929
     assert( msp->eli > msp->bli );
1935
     assert( msp->eli > msp->bli );
1930
 
1936
 
1937
+    // track the longest set.
1931
     maxScWndN = cmMax( maxScWndN, msp->eli - msp->bli + 1 );
1938
     maxScWndN = cmMax( maxScWndN, msp->eli - msp->bli + 1 );
1932
 
1939
 
1933
   }
1940
   }

+ 2
- 2
cmProc4.h 查看文件

328
     unsigned      bsli;  // beg score loc index
328
     unsigned      bsli;  // beg score loc index
329
     unsigned      esli;  // end score loc index
329
     unsigned      esli;  // end score loc index
330
 
330
 
331
-    unsigned      bli;   // 
332
-    unsigned      eli;   //
331
+    unsigned      bli;   // index into the cmScMatch.loc[] array of bsli
332
+    unsigned      eli;   // index into the cmScMatch.loc[] array of esli
333
 
333
 
334
     double        value; // DBL_MAX if the value has not yet been set
334
     double        value; // DBL_MAX if the value has not yet been set
335
     double        tempo; //
335
     double        tempo; //

Loading…
取消
儲存