cmScoreProc.c : Changed kBegin/EndSectionSpId to kBegin/EndTakeSpId to better
reflect the meaning of the score markers.
This commit is contained in:
parent
83345c5046
commit
c89117af6a
@ -22,10 +22,10 @@
|
|||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
kBeginSectionSpId, // tlObjPtr points to a cmTlMarker_t object.
|
kBeginTakeSpId, // tlObjPtr points to a cmTlMarker_t object.
|
||||||
kEndSectionSpId, // tlObjPtr is NULL.
|
kEndTakeSpId, // tlObjPtr is NULL.
|
||||||
kNoteOnSpId, // tlObjPtr points to a cmTlMidiEvt_t note-on object.
|
kNoteOnSpId, // tlObjPtr points to a cmTlMidiEvt_t note-on object.
|
||||||
kFailSpId // tlObjPtr points to a cmTlMarker_t object (This section score tracking failed.)
|
kFailSpId // tlObjPtr points to a cmTlMarker_t object (This takes score tracking failed.)
|
||||||
} cmScoreProcSelId_t;
|
} cmScoreProcSelId_t;
|
||||||
|
|
||||||
struct cmSp_str;
|
struct cmSp_str;
|
||||||
@ -44,7 +44,7 @@ typedef struct cmSp_str
|
|||||||
double srate; //
|
double srate; //
|
||||||
cmScMatcher* match; // score follower
|
cmScMatcher* match; // score follower
|
||||||
|
|
||||||
cmScoreProcCb_t procCb; // score processor callback - called whenever a new 'marker' section or note-on is about to be processed
|
cmScoreProcCb_t procCb; // score processor callback - called whenever a new 'marker' take or note-on is about to be processed
|
||||||
cmScMatcherCb_t matchCb; // score follower callback - called whenever the score follower detects a matched event
|
cmScMatcherCb_t matchCb; // score follower callback - called whenever the score follower detects a matched event
|
||||||
void* cbArg; // callback arg. for both matchCb and procCb.
|
void* cbArg; // callback arg. for both matchCb and procCb.
|
||||||
|
|
||||||
@ -204,8 +204,8 @@ cmSpRC_t _cmScoreProcProcess(cmCtx_t* ctx, cmSp_t* sp)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// inform the score processor that we are about to start a new section
|
// inform the score processor that we are about to start a new take
|
||||||
if( sp->procCb( sp->cbArg, sp, kBeginSectionSpId, o0p ) != kOkSpRC )
|
if( sp->procCb( sp->cbArg, sp, kBeginTakeSpId, o0p ) != kOkSpRC )
|
||||||
{
|
{
|
||||||
cmErrMsg(&sp->err,kProcFailSpRC,"The score process object failed on reset.");
|
cmErrMsg(&sp->err,kProcFailSpRC,"The score process object failed on reset.");
|
||||||
continue;
|
continue;
|
||||||
@ -259,11 +259,11 @@ cmSpRC_t _cmScoreProcProcess(cmCtx_t* ctx, cmSp_t* sp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// inform the score processor that we done processing a section
|
// inform the score processor that we done processing a take
|
||||||
if( sp->procCb( sp->cbArg, sp, kEndSectionSpId, NULL ) != kOkSpRC )
|
if( sp->procCb( sp->cbArg, sp, kEndTakeSpId, NULL ) != kOkSpRC )
|
||||||
cmErrMsg(&sp->err,kProcFailSpRC,"The score process object failed on reset.");
|
cmErrMsg(&sp->err,kProcFailSpRC,"The score process object failed on reset.");
|
||||||
|
|
||||||
// error flag is used to break out of the loop after the 'end-section' is called
|
// error flag is used to break out of the loop after the 'end-take' is called
|
||||||
// so that the user defined processes has a chance to clean-up
|
// so that the user defined processes has a chance to clean-up
|
||||||
if( errFl )
|
if( errFl )
|
||||||
goto errLabel;
|
goto errLabel;
|
||||||
@ -493,7 +493,7 @@ cmSpRC_t _cmSpProcMeasCb( void* arg, cmSp_t* sp, cmScoreProcSelId_t id, cmTlObj
|
|||||||
|
|
||||||
switch( id )
|
switch( id )
|
||||||
{
|
{
|
||||||
case kBeginSectionSpId:
|
case kBeginTakeSpId:
|
||||||
|
|
||||||
// reset the performance evaluation object
|
// reset the performance evaluation object
|
||||||
if( cmScMeasReset(m->meas) != cmOkRC )
|
if( cmScMeasReset(m->meas) != cmOkRC )
|
||||||
@ -505,7 +505,7 @@ cmSpRC_t _cmSpProcMeasCb( void* arg, cmSp_t* sp, cmScoreProcSelId_t id, cmTlObj
|
|||||||
case kNoteOnSpId:
|
case kNoteOnSpId:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kEndSectionSpId:
|
case kEndTakeSpId:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kFailSpId:
|
case kFailSpId:
|
||||||
@ -595,7 +595,7 @@ typedef struct
|
|||||||
unsigned mni;
|
unsigned mni;
|
||||||
bool failFl;
|
bool failFl;
|
||||||
cmJsonH_t jsH;
|
cmJsonH_t jsH;
|
||||||
cmJsonNode_t* sectObj;
|
cmJsonNode_t* takeObj;
|
||||||
cmJsonNode_t* array;
|
cmJsonNode_t* array;
|
||||||
|
|
||||||
cmSpAssoc_t* bap;
|
cmSpAssoc_t* bap;
|
||||||
@ -632,7 +632,7 @@ cmSpRC_t _cmSpProcAssocCb( void* arg, cmSp_t* sp, cmScoreProcSelId_t id, cmTlOb
|
|||||||
|
|
||||||
switch( id )
|
switch( id )
|
||||||
{
|
{
|
||||||
case kBeginSectionSpId:
|
case kBeginTakeSpId:
|
||||||
{
|
{
|
||||||
cmTlMarker_t* markPtr = cmTimeLineMarkerObjPtr( sp->tlH, tlObjPtr );
|
cmTlMarker_t* markPtr = cmTimeLineMarkerObjPtr( sp->tlH, tlObjPtr );
|
||||||
assert( markPtr != NULL );
|
assert( markPtr != NULL );
|
||||||
@ -640,21 +640,21 @@ cmSpRC_t _cmSpProcAssocCb( void* arg, cmSp_t* sp, cmScoreProcSelId_t id, cmTlOb
|
|||||||
m->failFl = false;
|
m->failFl = false;
|
||||||
|
|
||||||
// insert a section object
|
// insert a section object
|
||||||
if((m->sectObj = cmJsonInsertPairObject(m->jsH, cmJsonRoot(m->jsH), "section" )) == NULL )
|
if((m->takeObj = cmJsonInsertPairObject(m->jsH, cmJsonRoot(m->jsH), "take" )) == NULL )
|
||||||
{
|
{
|
||||||
rc = cmErrMsg(&m->ctx->err,kJsonFailSpRC,"Section insert failed on seq:%i '%s' : '%s'.", tlObjPtr->seqId, cmStringNullGuard(tlObjPtr->text),cmStringNullGuard(markPtr->text));
|
rc = cmErrMsg(&m->ctx->err,kJsonFailSpRC,"Take insert failed on seq:%i '%s' : '%s'.", tlObjPtr->seqId, cmStringNullGuard(tlObjPtr->text),cmStringNullGuard(markPtr->text));
|
||||||
goto errLabel;
|
goto errLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the section time-line UID
|
// set the section time-line UID
|
||||||
if( cmJsonInsertPairInt(m->jsH, m->sectObj,"markerUid", tlObjPtr->uid ) != kOkJsRC )
|
if( cmJsonInsertPairInt(m->jsH, m->takeObj,"markerUid", tlObjPtr->uid ) != kOkJsRC )
|
||||||
{
|
{
|
||||||
rc = cmErrMsg(&m->ctx->err,kJsonFailSpRC,"Marker uid field insert failed on seq:%i '%s' : '%s'.", tlObjPtr->seqId, cmStringNullGuard(tlObjPtr->text),cmStringNullGuard(markPtr->text));
|
rc = cmErrMsg(&m->ctx->err,kJsonFailSpRC,"Marker uid field insert failed on seq:%i '%s' : '%s'.", tlObjPtr->seqId, cmStringNullGuard(tlObjPtr->text),cmStringNullGuard(markPtr->text));
|
||||||
goto errLabel;
|
goto errLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
// create an array to hold the assoc results
|
// create an array to hold the assoc results
|
||||||
if(( m->array = cmJsonInsertPairArray(m->jsH, m->sectObj, "array")) == NULL )
|
if(( m->array = cmJsonInsertPairArray(m->jsH, m->takeObj, "array")) == NULL )
|
||||||
{
|
{
|
||||||
rc = cmErrMsg(&m->ctx->err,kJsonFailSpRC,"Marker array field insert failed on seq:%i '%s' : '%s'.", tlObjPtr->seqId, cmStringNullGuard(tlObjPtr->text),cmStringNullGuard(markPtr->text));
|
rc = cmErrMsg(&m->ctx->err,kJsonFailSpRC,"Marker array field insert failed on seq:%i '%s' : '%s'.", tlObjPtr->seqId, cmStringNullGuard(tlObjPtr->text),cmStringNullGuard(markPtr->text));
|
||||||
goto errLabel;
|
goto errLabel;
|
||||||
@ -662,7 +662,7 @@ cmSpRC_t _cmSpProcAssocCb( void* arg, cmSp_t* sp, cmScoreProcSelId_t id, cmTlOb
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kEndSectionSpId:
|
case kEndTakeSpId:
|
||||||
{
|
{
|
||||||
while( m->bmp != NULL )
|
while( m->bmp != NULL )
|
||||||
{
|
{
|
||||||
@ -674,7 +674,7 @@ cmSpRC_t _cmSpProcAssocCb( void* arg, cmSp_t* sp, cmScoreProcSelId_t id, cmTlOb
|
|||||||
m->bmp = NULL;
|
m->bmp = NULL;
|
||||||
m->emp = NULL;
|
m->emp = NULL;
|
||||||
|
|
||||||
if( cmJsonInsertPairInt( m->jsH, m->sectObj, "failFl", m->failFl ) != kOkJsRC )
|
if( cmJsonInsertPairInt( m->jsH, m->takeObj, "failFl", m->failFl ) != kOkJsRC )
|
||||||
{
|
{
|
||||||
rc = cmErrMsg(&m->ctx->err,kJsonFailSpRC,"JSON fail flag insert failed.");
|
rc = cmErrMsg(&m->ctx->err,kJsonFailSpRC,"JSON fail flag insert failed.");
|
||||||
goto errLabel;
|
goto errLabel;
|
||||||
|
Loading…
Reference in New Issue
Block a user