cmTimeline.c : Make use of 'onsetCfg' in time-line optional.
This commit is contained in:
parent
c7bf7a2c94
commit
c01e9731c9
@ -778,6 +778,8 @@ cmTlRC_t _cmTlAllocMidiFileRecd( _cmTl_t* p, const cmChar_t* nameStr, const cmCh
|
||||
|
||||
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 )
|
||||
{
|
||||
assert( refObjPtr != NULL );
|
||||
|
||||
cmTlRC_t rc = kOkTlRC;
|
||||
_cmTlObj_t* op = NULL;
|
||||
const cmChar_t* textStr = text==NULL ? "" : text;
|
||||
@ -1363,7 +1365,7 @@ cmTlRC_t cmTimeLineReadJson( cmTlH_t* hp, const cmChar_t* ifn )
|
||||
|
||||
if( cmJsonMemberValues(jnp,&errLabelPtr,
|
||||
"srate",kRealTId,&p->srate,
|
||||
"onset",kObjectTId,&cnp,
|
||||
"onset",kObjectTId | kOptArgJsFl,&cnp,
|
||||
"objArray",kArrayTId,&jnp,
|
||||
NULL) != kOkJsRC )
|
||||
{
|
||||
@ -1374,6 +1376,8 @@ cmTlRC_t cmTimeLineReadJson( cmTlH_t* hp, const cmChar_t* ifn )
|
||||
goto errLabel;
|
||||
}
|
||||
|
||||
if( cnp != NULL )
|
||||
{
|
||||
if((jsRC = cmJsonMemberValues(cnp,&errLabelPtr,
|
||||
"wndMs", kRealTId, &p->onsetCfg.wndMs,
|
||||
"hopFact", kIntTId, &p->onsetCfg.hopFact,
|
||||
@ -1395,6 +1399,7 @@ cmTlRC_t cmTimeLineReadJson( cmTlH_t* hp, const cmChar_t* ifn )
|
||||
rc = cmErrMsg(&p->err,kParseFailTlRC,"The JSON 'time_line' onset analyzer cfg. in '%s'.",cmStringNullGuard(ifn));
|
||||
goto errLabel;
|
||||
}
|
||||
}
|
||||
|
||||
for(i=0; i<cmJsonChildCount(jnp); ++i)
|
||||
{
|
||||
@ -1478,6 +1483,12 @@ cmTlRC_t cmTimeLineGenOnsetMarks( cmTlH_t h, unsigned seqId )
|
||||
unsigned i,j;
|
||||
unsigned smpIdx;
|
||||
|
||||
if( p->onsetCfg.wndMs == 0 )
|
||||
{
|
||||
rc = cmErrMsg(&p->err,kOnsetFailTlRC,"Audio onset analyzer not-configured.");
|
||||
goto errLabel;
|
||||
}
|
||||
|
||||
// initialize the audio onset analyzer
|
||||
if( cmOnsetInitialize(&p->ctx, &onsH ) != kOkOnRC )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user