|
@@ -1422,7 +1422,7 @@ void _cmScMatchPathPush( cmScMatch* r, unsigned code, unsigned ri, unsigned ci,
|
1422
|
1422
|
p->ri = ri;
|
1423
|
1423
|
p->ci = ci;
|
1424
|
1424
|
p->flags = code==kSmSubIdx && cmIsFlag(flags,kSmMatchFl) ? kSmMatchFl : 0;
|
1425
|
|
- p->flags |= cmIsFlag(flags,kSmTransFl);
|
|
1425
|
+ p->flags |= cmIsFlag(flags,kSmTransFl) ? kSmTransFl : 0;
|
1426
|
1426
|
p->next = r->p_cur;
|
1427
|
1427
|
r->p_cur = p;
|
1428
|
1428
|
}
|
|
@@ -1530,7 +1530,10 @@ double _cmScMatchEvalCandidate( cmScMatch* r, double min_cost, double cost )
|
1530
|
1530
|
}
|
1531
|
1531
|
|
1532
|
1532
|
|
1533
|
|
-
|
|
1533
|
+// NOTE: IF THE COST CALCULATION WAS BUILT INTO THE RECURSION THEN
|
|
1534
|
+// THIS FUNCTION COULD BE MADE MORE EFFICIENT BECAUSE PATHS WHICH
|
|
1535
|
+// EXCEEDED THE min_cost COULD BE SHORT CIRCUITED.
|
|
1536
|
+//
|
1534
|
1537
|
// traverse the solution matrix from the lower-right to
|
1535
|
1538
|
// the upper-left.
|
1536
|
1539
|
double _cmScMatchGenPaths( cmScMatch* r, int i, int j, unsigned rn, unsigned cn, double min_cost )
|
|
@@ -1611,7 +1614,7 @@ cmRC_t cmScMatchExec( cmScMatch* p, unsigned scLocIdx, unsigned locN, const unsi
|
1611
|
1614
|
return cmEofRC;
|
1612
|
1615
|
|
1613
|
1616
|
//_cmScMatchPrintMtx(p,rn,cn);
|
1614
|
|
-
|
|
1617
|
+
|
1615
|
1618
|
// locate the path through the DP matrix with the lowest edit distance (cost)
|
1616
|
1619
|
p->opt_cost = _cmScMatchAlign(p, rn, cn, min_cost);
|
1617
|
1620
|
|
|
@@ -1821,7 +1824,7 @@ bool cmScMatcherInputMidi( cmScMatcher* p, unsigned smpIdx, unsigned status, cm
|
1821
|
1824
|
//printf("%3i %5.2f %4s\n",p->mni,(double)smpIdx/p->srate,cmMidiToSciPitch(d0,NULL,0));
|
1822
|
1825
|
|
1823
|
1826
|
// shift the new MIDI event onto the end of the MIDI buffer
|
1824
|
|
- memmove(p->midiBuf,p->midiBuf+1,sizeof(cmScMatcherMidi_t)*mi);
|
|
1827
|
+ memmove(p->midiBuf, p->midiBuf+1, sizeof(cmScMatcherMidi_t)*mi);
|
1825
|
1828
|
p->midiBuf[mi].locIdx = cmInvalidIdx;
|
1826
|
1829
|
p->midiBuf[mi].cbCnt = 0;
|
1827
|
1830
|
p->midiBuf[mi].mni = p->mni++;
|
|
@@ -1834,14 +1837,14 @@ bool cmScMatcherInputMidi( cmScMatcher* p, unsigned smpIdx, unsigned status, cm
|
1834
|
1837
|
return true;
|
1835
|
1838
|
}
|
1836
|
1839
|
|
1837
|
|
-void _cmScMatcherStoreResult( cmScMatcher* p, unsigned locIdx, bool matchFl, const cmScMatcherMidi_t* mp )
|
|
1840
|
+void _cmScMatcherStoreResult( cmScMatcher* p, unsigned locIdx, unsigned flags, const cmScMatcherMidi_t* mp )
|
1838
|
1841
|
{
|
1839
|
1842
|
// don't store missed score note results
|
1840
|
1843
|
assert( mp != NULL );
|
1841
|
|
-
|
1842
|
|
- bool tpFl = locIdx!=cmInvalidIdx && matchFl;
|
1843
|
|
- bool fpFl = locIdx==cmInvalidIdx || matchFl==false;
|
1844
|
|
- cmScMatcherResult_t * rp = NULL;
|
|
1844
|
+ bool matchFl = cmIsFlag(flags,kSmMatchFl);
|
|
1845
|
+ bool tpFl = locIdx!=cmInvalidIdx && matchFl;
|
|
1846
|
+ bool fpFl = locIdx==cmInvalidIdx || matchFl==false;
|
|
1847
|
+ cmScMatcherResult_t * rp = NULL;
|
1845
|
1848
|
unsigned i;
|
1846
|
1849
|
|
1847
|
1850
|
assert( tpFl==false || (tpFl==true && locIdx != cmInvalidIdx ) );
|
|
@@ -1852,7 +1855,7 @@ void _cmScMatcherStoreResult( cmScMatcher* p, unsigned locIdx, bool matchFl, con
|
1852
|
1855
|
for(i=0; i<p->ri; ++i)
|
1853
|
1856
|
if( p->res[i].mni == mp->mni )
|
1854
|
1857
|
{
|
1855
|
|
- // if the new
|
|
1858
|
+ // if this is not the first time this note was reported and it is a true positive
|
1856
|
1859
|
if( tpFl )
|
1857
|
1860
|
{
|
1858
|
1861
|
rp = p->res + i;
|
|
@@ -1873,16 +1876,32 @@ void _cmScMatcherStoreResult( cmScMatcher* p, unsigned locIdx, bool matchFl, con
|
1873
|
1876
|
rp->mni = mp->mni;
|
1874
|
1877
|
rp->pitch = mp->pitch;
|
1875
|
1878
|
rp->vel = mp->vel;
|
1876
|
|
- rp->tpFl = tpFl;
|
1877
|
|
- rp->fpFl = fpFl;
|
|
1879
|
+ rp->flags = flags | (tpFl ? kSmTruePosFl : 0) | (fpFl ? kSmFalsePosFl : 0);
|
|
1880
|
+ //rp->tpFl = tpFl;
|
|
1881
|
+ //rp->fpFl = fpFl;
|
1878
|
1882
|
|
1879
|
1883
|
}
|
1880
|
1884
|
|
|
1885
|
+void cmScMatcherPrintPath( cmScMatcher* p )
|
|
1886
|
+{
|
|
1887
|
+ unsigned pitchV[ p->mn ];
|
|
1888
|
+ unsigned mniV[ p->mn ];
|
|
1889
|
+ unsigned i;
|
|
1890
|
+
|
|
1891
|
+ for(i=0; i<p->mn; ++i)
|
|
1892
|
+ {
|
|
1893
|
+ pitchV[i] = p->midiBuf[i].pitch;
|
|
1894
|
+ mniV[i] = p->midiBuf[i].mni;
|
|
1895
|
+ }
|
|
1896
|
+
|
|
1897
|
+ _cmScMatchPrintPath(p->mp, p->mp->p_opt, p->begSyncLocIdx, pitchV, mniV );
|
|
1898
|
+}
|
|
1899
|
+
|
1881
|
1900
|
unsigned cmScMatcherScan( cmScMatcher* p, unsigned bsi, unsigned scanCnt )
|
1882
|
1901
|
{
|
1883
|
1902
|
assert( p->mp != NULL && p->mp->mmn > 0 );
|
1884
|
1903
|
|
1885
|
|
- unsigned i_opt = cmInvalidIdx;
|
|
1904
|
+ unsigned i_opt = cmInvalidIdx;
|
1886
|
1905
|
double s_opt = DBL_MAX;
|
1887
|
1906
|
cmRC_t rc = cmOkRC;
|
1888
|
1907
|
unsigned i;
|
|
@@ -1991,7 +2010,7 @@ unsigned cmScMatcherScan( cmScMatcher* p, unsigned bsi, unsigned scanCnt )
|
1991
|
2010
|
// record result
|
1992
|
2011
|
for(cp=p->mp->p_opt; cp!=NULL; cp=cp->next)
|
1993
|
2012
|
if( cp->code != kSmInsIdx )
|
1994
|
|
- _cmScMatcherStoreResult(p, cp->locIdx, cmIsFlag(cp->flags,kSmMatchFl), p->midiBuf + cp->ri - 1);
|
|
2013
|
+ _cmScMatcherStoreResult(p, cp->locIdx, cp->flags, p->midiBuf + cp->ri - 1);
|
1995
|
2014
|
}
|
1996
|
2015
|
|
1997
|
2016
|
return i_opt;
|
|
@@ -2001,8 +2020,8 @@ unsigned cmScMatcherScan( cmScMatcher* p, unsigned bsi, unsigned scanCnt )
|
2001
|
2020
|
cmRC_t cmScMatcherStep( cmScMatcher* p )
|
2002
|
2021
|
{
|
2003
|
2022
|
int i;
|
2004
|
|
- unsigned pitch = p->midiBuf[ p->mn-1 ].pitch;
|
2005
|
|
- unsigned locIdx = cmInvalidIdx;
|
|
2023
|
+ unsigned pitch = p->midiBuf[ p->mn-1 ].pitch;
|
|
2024
|
+ unsigned locIdx = cmInvalidIdx;
|
2006
|
2025
|
|
2007
|
2026
|
// the tracker must be sync'd to step
|
2008
|
2027
|
if( p->esi == cmInvalidIdx )
|
|
@@ -2045,11 +2064,11 @@ cmRC_t cmScMatcherStep( cmScMatcher* p )
|
2045
|
2064
|
else
|
2046
|
2065
|
{
|
2047
|
2066
|
p->missCnt = 0;
|
2048
|
|
- p->esi = locIdx;
|
|
2067
|
+ p->esi = locIdx;
|
2049
|
2068
|
}
|
2050
|
2069
|
|
2051
|
2070
|
// store the result
|
2052
|
|
- _cmScMatcherStoreResult(p, locIdx, locIdx!=cmInvalidIdx, p->midiBuf + p->mn - 1);
|
|
2071
|
+ _cmScMatcherStoreResult(p, locIdx, locIdx!=cmInvalidIdx ? kSmMatchFl : 0, p->midiBuf + p->mn - 1);
|
2053
|
2072
|
|
2054
|
2073
|
|
2055
|
2074
|
if( p->missCnt >= p->maxMissCnt )
|
|
@@ -2069,20 +2088,6 @@ cmRC_t cmScMatcherStep( cmScMatcher* p )
|
2069
|
2088
|
|
2070
|
2089
|
}
|
2071
|
2090
|
|
2072
|
|
-void cmScMatcherPrintPath( cmScMatcher* p )
|
2073
|
|
-{
|
2074
|
|
- unsigned pitchV[ p->mn ];
|
2075
|
|
- unsigned mniV[ p->mn ];
|
2076
|
|
- unsigned i;
|
2077
|
|
-
|
2078
|
|
- for(i=0; i<p->mn; ++i)
|
2079
|
|
- {
|
2080
|
|
- pitchV[i] = p->midiBuf[i].pitch;
|
2081
|
|
- mniV[i] = p->midiBuf[i].mni;
|
2082
|
|
- }
|
2083
|
|
-
|
2084
|
|
- _cmScMatchPrintPath(p->mp, p->mp->p_opt, p->begSyncLocIdx, pitchV, mniV );
|
2085
|
|
-}
|
2086
|
2091
|
|
2087
|
2092
|
|
2088
|
2093
|
cmRC_t cmScMatcherExec( cmScMatcher* p, unsigned smpIdx, unsigned status, cmMidiByte_t d0, cmMidiByte_t d1 )
|
|
@@ -2100,7 +2105,7 @@ cmRC_t cmScMatcherExec( cmScMatcher* p, unsigned smpIdx, unsigned status, c
|
2100
|
2105
|
rc = cmInvalidArgRC; // signal init. scan sync. fail
|
2101
|
2106
|
else
|
2102
|
2107
|
{
|
2103
|
|
- //cmScMatcherPrintPath(p);
|
|
2108
|
+ // cmScMatcherPrintPath(p);
|
2104
|
2109
|
}
|
2105
|
2110
|
}
|
2106
|
2111
|
else
|
|
@@ -2132,10 +2137,10 @@ double cmScMatcherFMeas( cmScMatcher* p )
|
2132
|
2137
|
bli = cmMin(bli,p->res[i].locIdx);
|
2133
|
2138
|
eli = cmMax(eli,p->res[i].locIdx);
|
2134
|
2139
|
|
2135
|
|
- if( p->res[i].tpFl )
|
|
2140
|
+ if( cmIsFlag(p->res[i].flags,kSmTruePosFl) )
|
2136
|
2141
|
++matchCnt;
|
2137
|
2142
|
|
2138
|
|
- if( p->res[i].fpFl )
|
|
2143
|
+ if( cmIsFlag(p->res[i].flags,kSmFalsePosFl) )
|
2139
|
2144
|
++wrongCnt;
|
2140
|
2145
|
}
|
2141
|
2146
|
|
|
@@ -2151,6 +2156,196 @@ double cmScMatcherFMeas( cmScMatcher* p )
|
2151
|
2156
|
return fmeas;
|
2152
|
2157
|
}
|
2153
|
2158
|
|
|
2159
|
+typedef struct cmScMatcherPrint_str
|
|
2160
|
+{
|
|
2161
|
+ unsigned flags;
|
|
2162
|
+ unsigned scLocIdx;
|
|
2163
|
+ unsigned mni;
|
|
2164
|
+ unsigned pitch;
|
|
2165
|
+ unsigned vel;
|
|
2166
|
+} cmScMatcherPrint_t;
|
|
2167
|
+
|
|
2168
|
+void _cmScMatcherInsertPrint(cmScMatcherPrint_t* a, unsigned i, unsigned* anp, unsigned aan, const cmScMatcherResult_t* rp, unsigned scLocIdx )
|
|
2169
|
+{
|
|
2170
|
+ assert( *anp + 1 <= aan );
|
|
2171
|
+
|
|
2172
|
+ memmove(a + i + 1, a + i, (*anp-i)*sizeof(cmScMatcherPrint_t));
|
|
2173
|
+ memset( a + i, 0, sizeof(cmScMatcherPrint_t));
|
|
2174
|
+ *anp += 1;
|
|
2175
|
+
|
|
2176
|
+ a[i].flags = rp->flags;
|
|
2177
|
+ a[i].scLocIdx = scLocIdx;
|
|
2178
|
+ a[i].mni = rp->mni;
|
|
2179
|
+ a[i].pitch = rp->pitch;
|
|
2180
|
+ a[i].vel = rp->vel;
|
|
2181
|
+}
|
|
2182
|
+
|
|
2183
|
+void cmScMatcherPrint( cmScMatcher* p )
|
|
2184
|
+{
|
|
2185
|
+ unsigned bsli = cmScoreEvtCount(p->mp->scH);
|
|
2186
|
+ unsigned esli = 0;
|
|
2187
|
+ unsigned i,j,k;
|
|
2188
|
+
|
|
2189
|
+ // get first/last scLocIdx from res[]
|
|
2190
|
+ for(i=0; i<p->ri; ++i)
|
|
2191
|
+ if( p->res[i].locIdx != cmInvalidIdx )
|
|
2192
|
+ {
|
|
2193
|
+ bsli = cmMin(bsli,p->mp->loc[p->res[i].locIdx].scLocIdx);
|
|
2194
|
+ esli = cmMax(esli,p->mp->loc[p->res[i].locIdx].scLocIdx);
|
|
2195
|
+ }
|
|
2196
|
+
|
|
2197
|
+ unsigned an = 0;
|
|
2198
|
+ unsigned aan = p->ri;
|
|
2199
|
+
|
|
2200
|
+ // calc the count of score events between bsli and esli.
|
|
2201
|
+ for(i=bsli; i<=esli; ++i)
|
|
2202
|
+ {
|
|
2203
|
+ cmScoreLoc_t* lp = cmScoreLoc(p->mp->scH, i);
|
|
2204
|
+ assert(lp != NULL);
|
|
2205
|
+ aan += lp->evtCnt;
|
|
2206
|
+ }
|
|
2207
|
+
|
|
2208
|
+ // allocate an array off 'aan' print records
|
|
2209
|
+ cmScMatcherPrint_t* a = cmMemAllocZ(cmScMatcherPrint_t,aan);
|
|
2210
|
+
|
|
2211
|
+ // fill a[] with score note and bar events
|
|
2212
|
+ for(i=bsli; i<=esli; ++i)
|
|
2213
|
+ {
|
|
2214
|
+ unsigned scLocIdx = i;
|
|
2215
|
+ cmScoreLoc_t* lp = cmScoreLoc(p->mp->scH, scLocIdx );
|
|
2216
|
+
|
|
2217
|
+ for(j=0; j<lp->evtCnt; ++j)
|
|
2218
|
+ {
|
|
2219
|
+ assert( an < aan );
|
|
2220
|
+
|
|
2221
|
+ cmScoreEvt_t* ep = lp->evtArray[j];
|
|
2222
|
+ cmScMatcherPrint_t* pp = a + an;
|
|
2223
|
+
|
|
2224
|
+ an += 1;
|
|
2225
|
+
|
|
2226
|
+ switch( ep->type )
|
|
2227
|
+ {
|
|
2228
|
+ case kBarEvtScId:
|
|
2229
|
+ pp->flags = kSmBarFl;
|
|
2230
|
+ break;
|
|
2231
|
+
|
|
2232
|
+ case kNonEvtScId:
|
|
2233
|
+ pp->flags = kSmNoteFl;
|
|
2234
|
+ break;
|
|
2235
|
+ }
|
|
2236
|
+
|
|
2237
|
+ pp->scLocIdx = scLocIdx;
|
|
2238
|
+ pp->mni = cmInvalidIdx;
|
|
2239
|
+ pp->pitch = ep->pitch;
|
|
2240
|
+ pp->vel = kInvalidMidiVelocity;
|
|
2241
|
+ }
|
|
2242
|
+
|
|
2243
|
+ }
|
|
2244
|
+
|
|
2245
|
+ // for each result record
|
|
2246
|
+ for(i=0; i<p->ri; ++i)
|
|
2247
|
+ {
|
|
2248
|
+ cmScMatcherResult_t* rp = p->res + i;
|
|
2249
|
+
|
|
2250
|
+ // if this result recd matched a score event
|
|
2251
|
+ if( cmIsFlag(rp->flags,kSmTruePosFl) )
|
|
2252
|
+ {
|
|
2253
|
+ // locate the matching score event
|
|
2254
|
+ for(k=0; k<an; ++k)
|
|
2255
|
+ if( a[k].scLocIdx==p->mp->loc[rp->locIdx].scLocIdx && a[k].pitch==rp->pitch )
|
|
2256
|
+ {
|
|
2257
|
+ a[k].mni = rp->mni;
|
|
2258
|
+ a[k].vel = rp->vel;
|
|
2259
|
+ a[k].flags |= kSmMatchFl;
|
|
2260
|
+ break;
|
|
2261
|
+ }
|
|
2262
|
+ }
|
|
2263
|
+
|
|
2264
|
+ // if this result did not match a score event
|
|
2265
|
+ if( cmIsFlag(rp->flags,kSmFalsePosFl) )
|
|
2266
|
+ {
|
|
2267
|
+ unsigned d_min;
|
|
2268
|
+ cmScMatcherPrint_t* dp = NULL;
|
|
2269
|
+ unsigned scLocIdx = cmInvalidIdx;
|
|
2270
|
+
|
|
2271
|
+ // if this result does not have a valid locIdx
|
|
2272
|
+ // (e.g. errant MIDI notes: scan:'delete' note or a step:mis-match note)
|
|
2273
|
+ if( rp->locIdx == cmInvalidIdx )
|
|
2274
|
+ {
|
|
2275
|
+
|
|
2276
|
+ // find the print recd with the closet 'mni'
|
|
2277
|
+ for(k=0; k<an; ++k)
|
|
2278
|
+ if( a[k].mni != cmInvalidIdx )
|
|
2279
|
+ {
|
|
2280
|
+ unsigned d;
|
|
2281
|
+ if( a[k].mni > rp->mni )
|
|
2282
|
+ d = a[k].mni - rp->mni;
|
|
2283
|
+ else
|
|
2284
|
+ d = rp->mni - a[k].mni;
|
|
2285
|
+
|
|
2286
|
+ if( dp==NULL || d < d_min )
|
|
2287
|
+ {
|
|
2288
|
+ dp = a + k;
|
|
2289
|
+ d_min = d;
|
|
2290
|
+ }
|
|
2291
|
+ }
|
|
2292
|
+
|
|
2293
|
+ k = dp - a;
|
|
2294
|
+ assert( k < an );
|
|
2295
|
+
|
|
2296
|
+ scLocIdx = p->mp->loc[k].scLocIdx;
|
|
2297
|
+
|
|
2298
|
+ if( a[k].mni < rp->mni )
|
|
2299
|
+ ++k;
|
|
2300
|
+
|
|
2301
|
+ }
|
|
2302
|
+ else // result w/ a valid locIdx (e.g. scan 'substitute' with no match)
|
|
2303
|
+ {
|
|
2304
|
+ scLocIdx = p->mp->loc[rp->locIdx].scLocIdx;
|
|
2305
|
+
|
|
2306
|
+ // find the print recd with the closest scIdx
|
|
2307
|
+ for(k=0; k<an; ++k)
|
|
2308
|
+ if( a[k].scLocIdx != cmInvalidIdx )
|
|
2309
|
+ {
|
|
2310
|
+ unsigned d;
|
|
2311
|
+ if( a[k].scLocIdx > scLocIdx )
|
|
2312
|
+ d = a[k].scLocIdx - scLocIdx;
|
|
2313
|
+ else
|
|
2314
|
+ d = scLocIdx - a[k].scLocIdx;
|
|
2315
|
+
|
|
2316
|
+ if( dp==NULL || d < d_min )
|
|
2317
|
+ {
|
|
2318
|
+ dp = a + k;
|
|
2319
|
+ d_min = d;
|
|
2320
|
+ }
|
|
2321
|
+ }
|
|
2322
|
+
|
|
2323
|
+ k = dp - a;
|
|
2324
|
+ assert( k < an );
|
|
2325
|
+
|
|
2326
|
+ if( a[k].scLocIdx < scLocIdx )
|
|
2327
|
+ ++k;
|
|
2328
|
+
|
|
2329
|
+ }
|
|
2330
|
+
|
|
2331
|
+ // create a new print recd to represent the false-positive result recd
|
|
2332
|
+ assert( dp != NULL );
|
|
2333
|
+ _cmScMatcherInsertPrint(a, k, &an,aan,rp,scLocIdx);
|
|
2334
|
+ }
|
|
2335
|
+ }
|
|
2336
|
+
|
|
2337
|
+ for(i=0; i<an; ++i)
|
|
2338
|
+ {
|
|
2339
|
+ printf("%4i %4i %4s %c%c%c\n",a[i].scLocIdx,a[i].mni,
|
|
2340
|
+ cmIsFlag(a[i].flags,kSmBarFl) ? "|" : cmMidiToSciPitch(a[i].pitch,NULL,0),
|
|
2341
|
+ cmIsFlag(a[i].flags,kSmNoteFl) ? 'n' : ' ',
|
|
2342
|
+ cmIsFlag(a[i].flags,kSmMatchFl) ? 'm' : (cmIsFlag(a[i].flags,kSmTransFl) ? 't' : ' '),
|
|
2343
|
+ cmIsFlag(a[i].flags,kSmFalsePosFl) ? '*' : ' '
|
|
2344
|
+ );
|
|
2345
|
+ }
|
|
2346
|
+
|
|
2347
|
+}
|
|
2348
|
+
|
2154
|
2349
|
//=======================================================================================================================
|
2155
|
2350
|
|
2156
|
2351
|
cmScAlign* cmScAlignAlloc( cmCtx* c, cmScAlign* p, cmScAlignCb_t cbFunc, void* cbArg, cmReal_t srate, cmScH_t scH, unsigned midiN, unsigned scWndN )
|
|
@@ -3529,6 +3724,7 @@ void cmScAlignScanMarkers( cmRpt_t* rpt, cmTlH_t tlH, cmScH_t scH )
|
3529
|
3724
|
unsigned initFailCnt = 0;
|
3530
|
3725
|
unsigned otherFailCnt = 0;
|
3531
|
3726
|
unsigned scoreFailCnt = 0;
|
|
3727
|
+ bool printFl = false;
|
3532
|
3728
|
cmTimeSpec_t t0,t1;
|
3533
|
3729
|
|
3534
|
3730
|
cmTimeGet(&t0);
|
|
@@ -3545,14 +3741,16 @@ void cmScAlignScanMarkers( cmRpt_t* rpt, cmTlH_t tlH, cmScH_t scH )
|
3545
|
3741
|
cmTlMarker_t* mp = cmTimeLineMarkerFind( tlH, markText );
|
3546
|
3742
|
if( mp == NULL )
|
3547
|
3743
|
{
|
3548
|
|
- printf("The marker '%s' was not found.\n\n",markText);
|
|
3744
|
+ if( printFl )
|
|
3745
|
+ printf("The marker '%s' was not found.\n\n",markText);
|
3549
|
3746
|
continue;
|
3550
|
3747
|
}
|
3551
|
3748
|
|
3552
|
3749
|
// skip markers which do not contain text
|
3553
|
3750
|
if( cmTextIsEmpty(mp->text) )
|
3554
|
3751
|
{
|
3555
|
|
- printf("The marker '%s' is being skipped because it has no text.\n\n",markText);
|
|
3752
|
+ if( printFl )
|
|
3753
|
+ printf("The marker '%s' is being skipped because it has no text.\n\n",markText);
|
3556
|
3754
|
continue;
|
3557
|
3755
|
}
|
3558
|
3756
|
|
|
@@ -3572,7 +3770,8 @@ void cmScAlignScanMarkers( cmRpt_t* rpt, cmTlH_t tlH, cmScH_t scH )
|
3572
|
3770
|
|
3573
|
3771
|
if( p->mni == 0 )
|
3574
|
3772
|
{
|
3575
|
|
- printf("mark:%i midi:%i Not enough MIDI notes to fill the scan buffer.\n",i,p->mni);
|
|
3773
|
+ if( printFl )
|
|
3774
|
+ printf("mark:%i midi:%i Not enough MIDI notes to fill the scan buffer.\n",i,p->mni);
|
3576
|
3775
|
pfl = false;
|
3577
|
3776
|
}
|
3578
|
3777
|
else
|
|
@@ -3580,18 +3779,21 @@ void cmScAlignScanMarkers( cmRpt_t* rpt, cmTlH_t tlH, cmScH_t scH )
|
3580
|
3779
|
switch(rc)
|
3581
|
3780
|
{
|
3582
|
3781
|
case cmInvalidArgRC:
|
3583
|
|
- printf("mark:%i INITIAL SYNC FAIL\n",i);
|
|
3782
|
+ if( printFl )
|
|
3783
|
+ printf("mark:%i INITIAL SYNC FAIL\n",i);
|
3584
|
3784
|
++initFailCnt;
|
3585
|
3785
|
pfl = false;
|
3586
|
3786
|
break;
|
3587
|
3787
|
|
3588
|
3788
|
case cmSubSysFailRC:
|
3589
|
|
- printf("mark:%i SCAN RESYNC FAIL\n",i);
|
|
3789
|
+ if( printFl )
|
|
3790
|
+ printf("mark:%i SCAN RESYNC FAIL\n",i);
|
3590
|
3791
|
++otherFailCnt;
|
3591
|
3792
|
break;
|
3592
|
3793
|
|
3593
|
3794
|
default:
|
3594
|
|
- printf("mark:%i UNKNOWN FAIL\n",i);
|
|
3795
|
+ if( printFl )
|
|
3796
|
+ printf("mark:%i UNKNOWN FAIL\n",i);
|
3595
|
3797
|
++otherFailCnt;
|
3596
|
3798
|
}
|
3597
|
3799
|
}
|
|
@@ -3599,11 +3801,10 @@ void cmScAlignScanMarkers( cmRpt_t* rpt, cmTlH_t tlH, cmScH_t scH )
|
3599
|
3801
|
|
3600
|
3802
|
if( pfl )
|
3601
|
3803
|
{
|
3602
|
|
- // kpl printf("mark:%i scans:%4i loc:%4i bar:%4i score:%5.2f miss:%i text:'%s'\n",i,p->scanCnt,p->begSyncLocIdx,p->loc[p->begSyncLocIdx].barNumb,p->s_opt,p->missCnt,mp->text);
|
3603
|
3804
|
double fmeas = cmScMatcherFMeas(p);
|
3604
|
|
- printf("mark:%i midi:%i loc:%i bar:%i cost:%f f-meas:%f text:%s\n",i,p->mni,p->begSyncLocIdx,p->mp->loc[p->begSyncLocIdx].barNumb,p->s_opt,fmeas,mp->text);
|
3605
|
3805
|
|
3606
|
|
- //printf("mark:%i scans:%i midi:%i text:'%s'\n",i,p->scanCnt,p->mni,mp->text);
|
|
3806
|
+ if( printFl )
|
|
3807
|
+ printf("mark:%i midi:%i loc:%i bar:%i cost:%f f-meas:%f text:%s\n",i,p->mni,p->begSyncLocIdx,p->mp->loc[p->begSyncLocIdx].barNumb,p->s_opt,fmeas,mp->text);
|
3607
|
3808
|
|
3608
|
3809
|
if( fmeas < scoreThresh )
|
3609
|
3810
|
++scoreFailCnt;
|
|
@@ -3611,9 +3812,11 @@ void cmScAlignScanMarkers( cmRpt_t* rpt, cmTlH_t tlH, cmScH_t scH )
|
3611
|
3812
|
}
|
3612
|
3813
|
|
3613
|
3814
|
|
|
3815
|
+ //cmScMatcherPrint(p);
|
3614
|
3816
|
//break; // ONLY USE ONE MARKER DURING TESTING
|
3615
|
3817
|
|
3616
|
|
- printf("\n");
|
|
3818
|
+ if( printFl )
|
|
3819
|
+ printf("\n");
|
3617
|
3820
|
|
3618
|
3821
|
}
|
3619
|
3822
|
|