|
@@ -778,6 +778,8 @@ cmTlRC_t _cmTlAllocMidiFileRecd( _cmTl_t* p, const cmChar_t* nameStr, const cmCh
|
778
|
778
|
|
779
|
779
|
cmTlRC_t _cmTlAllocMarkerRecd( _cmTl_t* p, const cmChar_t* nameStr, const cmChar_t* refIdStr, int begSmpIdx, unsigned durSmpCnt, unsigned seqId, const cmChar_t* text, unsigned bar, const cmChar_t* sectionStr, unsigned markerTypeId, cmTlObj_t* refObjPtr )
|
780
|
780
|
{
|
|
781
|
+ assert( refObjPtr != NULL );
|
|
782
|
+
|
781
|
783
|
cmTlRC_t rc = kOkTlRC;
|
782
|
784
|
_cmTlObj_t* op = NULL;
|
783
|
785
|
const cmChar_t* textStr = text==NULL ? "" : text;
|
|
@@ -1363,7 +1365,7 @@ cmTlRC_t cmTimeLineReadJson( cmTlH_t* hp, const cmChar_t* ifn )
|
1363
|
1365
|
|
1364
|
1366
|
if( cmJsonMemberValues(jnp,&errLabelPtr,
|
1365
|
1367
|
"srate",kRealTId,&p->srate,
|
1366
|
|
- "onset",kObjectTId,&cnp,
|
|
1368
|
+ "onset",kObjectTId | kOptArgJsFl,&cnp,
|
1367
|
1369
|
"objArray",kArrayTId,&jnp,
|
1368
|
1370
|
NULL) != kOkJsRC )
|
1369
|
1371
|
{
|
|
@@ -1374,28 +1376,31 @@ cmTlRC_t cmTimeLineReadJson( cmTlH_t* hp, const cmChar_t* ifn )
|
1374
|
1376
|
goto errLabel;
|
1375
|
1377
|
}
|
1376
|
1378
|
|
1377
|
|
- if((jsRC = cmJsonMemberValues(cnp,&errLabelPtr,
|
1378
|
|
- "wndMs", kRealTId, &p->onsetCfg.wndMs,
|
1379
|
|
- "hopFact", kIntTId, &p->onsetCfg.hopFact,
|
1380
|
|
- "audioChIdx", kIntTId, &p->onsetCfg.audioChIdx,
|
1381
|
|
- "wndFrmCnt", kIntTId, &p->onsetCfg.wndFrmCnt,
|
1382
|
|
- "preWndMult", kRealTId, &p->onsetCfg.preWndMult,
|
1383
|
|
- "threshold", kRealTId, &p->onsetCfg.threshold,
|
1384
|
|
- "maxFrqHz", kRealTId, &p->onsetCfg.maxFrqHz,
|
1385
|
|
- "filtCoeff", kRealTId, &p->onsetCfg.filtCoeff,
|
1386
|
|
- "medFiltWndMs", kRealTId, &p->onsetCfg.medFiltWndMs,
|
1387
|
|
- "filterId", kIntTId, &p->onsetCfg.filterId,
|
1388
|
|
- "preDelayMs", kRealTId, &p->onsetCfg.preDelayMs,
|
1389
|
|
- NULL)) != kOkJsRC )
|
|
1379
|
+ if( cnp != NULL )
|
1390
|
1380
|
{
|
|
1381
|
+ if((jsRC = cmJsonMemberValues(cnp,&errLabelPtr,
|
|
1382
|
+ "wndMs", kRealTId, &p->onsetCfg.wndMs,
|
|
1383
|
+ "hopFact", kIntTId, &p->onsetCfg.hopFact,
|
|
1384
|
+ "audioChIdx", kIntTId, &p->onsetCfg.audioChIdx,
|
|
1385
|
+ "wndFrmCnt", kIntTId, &p->onsetCfg.wndFrmCnt,
|
|
1386
|
+ "preWndMult", kRealTId, &p->onsetCfg.preWndMult,
|
|
1387
|
+ "threshold", kRealTId, &p->onsetCfg.threshold,
|
|
1388
|
+ "maxFrqHz", kRealTId, &p->onsetCfg.maxFrqHz,
|
|
1389
|
+ "filtCoeff", kRealTId, &p->onsetCfg.filtCoeff,
|
|
1390
|
+ "medFiltWndMs", kRealTId, &p->onsetCfg.medFiltWndMs,
|
|
1391
|
+ "filterId", kIntTId, &p->onsetCfg.filterId,
|
|
1392
|
+ "preDelayMs", kRealTId, &p->onsetCfg.preDelayMs,
|
|
1393
|
+ NULL)) != kOkJsRC )
|
|
1394
|
+ {
|
1391
|
1395
|
|
1392
|
|
- if(jsRC == kNodeNotFoundJsRC )
|
1393
|
|
- rc = cmErrMsg(&p->err,kParseFailTlRC,"The JSON 'time_line' onset analysizer cfg. required field:'%s' was not found in '%s'.",errLabelPtr,cmStringNullGuard(ifn));
|
1394
|
|
- else
|
1395
|
|
- rc = cmErrMsg(&p->err,kParseFailTlRC,"The JSON 'time_line' onset analyzer cfg. in '%s'.",cmStringNullGuard(ifn));
|
1396
|
|
- goto errLabel;
|
|
1396
|
+ if(jsRC == kNodeNotFoundJsRC )
|
|
1397
|
+ rc = cmErrMsg(&p->err,kParseFailTlRC,"The JSON 'time_line' onset analysizer cfg. required field:'%s' was not found in '%s'.",errLabelPtr,cmStringNullGuard(ifn));
|
|
1398
|
+ else
|
|
1399
|
+ rc = cmErrMsg(&p->err,kParseFailTlRC,"The JSON 'time_line' onset analyzer cfg. in '%s'.",cmStringNullGuard(ifn));
|
|
1400
|
+ goto errLabel;
|
|
1401
|
+ }
|
1397
|
1402
|
}
|
1398
|
|
-
|
|
1403
|
+
|
1399
|
1404
|
for(i=0; i<cmJsonChildCount(jnp); ++i)
|
1400
|
1405
|
{
|
1401
|
1406
|
const cmJsonNode_t* rp = cmJsonArrayElementC(jnp,i);
|
|
@@ -1478,6 +1483,12 @@ cmTlRC_t cmTimeLineGenOnsetMarks( cmTlH_t h, unsigned seqId )
|
1478
|
1483
|
unsigned i,j;
|
1479
|
1484
|
unsigned smpIdx;
|
1480
|
1485
|
|
|
1486
|
+ if( p->onsetCfg.wndMs == 0 )
|
|
1487
|
+ {
|
|
1488
|
+ rc = cmErrMsg(&p->err,kOnsetFailTlRC,"Audio onset analyzer not-configured.");
|
|
1489
|
+ goto errLabel;
|
|
1490
|
+ }
|
|
1491
|
+
|
1481
|
1492
|
// initialize the audio onset analyzer
|
1482
|
1493
|
if( cmOnsetInitialize(&p->ctx, &onsH ) != kOkOnRC )
|
1483
|
1494
|
{
|