Browse Source

cmProc4.h/c : Added comments.

master
Kevin Larke 8 years ago
parent
commit
c44a890088
2 changed files with 14 additions and 7 deletions
  1. 12
    5
      cmProc4.c
  2. 2
    2
      cmProc4.h

+ 12
- 5
cmProc4.c View File

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

+ 2
- 2
cmProc4.h View File

@@ -328,8 +328,8 @@ extern "C" {
328 328
     unsigned      bsli;  // beg score loc index
329 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 334
     double        value; // DBL_MAX if the value has not yet been set
335 335
     double        tempo; //

Loading…
Cancel
Save