From e54b4da348840fe5189bce8128acc42acac4cb3c Mon Sep 17 00:00:00 2001 From: kpl Date: Tue, 9 Jul 2013 14:04:40 -0700 Subject: [PATCH] cmScore.h/c:Added score file line number to cmScoreEvt_t. --- app/cmScore.c | 21 ++++++++++++++++----- app/cmScore.h | 3 +-- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/app/cmScore.c b/app/cmScore.c index 8e43683..f6f99e2 100644 --- a/app/cmScore.c +++ b/app/cmScore.c @@ -980,6 +980,9 @@ cmScRC_t _cmScParseFile( cmSc_t* p, cmCtx_t* ctx, const cmChar_t* fn ) break; } + // set the score file line number + p->array[j].line = i + 1; + secs = DBL_MAX; switch(tid) @@ -1236,7 +1239,7 @@ cmScoreEvt_t* cmScoreBarEvt( cmScH_t h, unsigned barNumb ) cmSc_t* p = _cmScHandleToPtr(h); unsigned i = 0; for(; icnt; ++i) - if( p->array[i].typeId==kBarEvtScId && p->array[i].barNumb==barNumb ) + if( p->array[i].type==kBarEvtScId && p->array[i].barNumb==barNumb ) return p->array + i; return NULL; @@ -1905,18 +1908,26 @@ void cmScorePrint( cmScH_t h, cmRpt_t* rpt ) { cmSc_t* p = _cmScHandleToPtr(h); unsigned i; - for(i=0; i<20 /*p->cnt*/; ++i) + for(i=0; icnt; ++i) { cmScoreEvt_t* r = p->array + i; switch(r->type) { - case kNonEvtScId: - cmRptPrintf(rpt,"%5i %3i %3i %s 0x%2x %c%c%c %s\n", + case kBarEvtScId: + cmRptPrintf(rpt,"%5i %5i %3i bar\n", i, + r->line, + r->barNumb ); + break; + + case kNonEvtScId: + cmRptPrintf(rpt,"%5i %5i %3i %3i %s %5s %c%c%c %s\n", + i, + r->line, r->barNumb, r->barNoteIdx, cmScEvtTypeIdToLabel(r->type), - r->pitch, + cmMidiToSciPitch(r->pitch,NULL,0), cmIsFlag(r->flags,kEvenScFl) ? 'e' : ' ', cmIsFlag(r->flags,kTempoScFl) ? 't' : ' ', cmIsFlag(r->flags,kDynScFl) ? 'd' : ' ', diff --git a/app/cmScore.h b/app/cmScore.h index 9067a0a..3c9e680 100644 --- a/app/cmScore.h +++ b/app/cmScore.h @@ -87,6 +87,7 @@ extern "C" { unsigned perfSmpIdx; // Time this event was performed or cmInvalidIdx if the event was not performed. unsigned perfVel; // Velocity of the performed note or 0 if the note was not performed. unsigned perfDynLvl; // Index into dynamic level ref. array assoc'd with perfVel + unsigned line; // Line number of this event in the score file. } cmScoreEvt_t; typedef struct cmScoreSet_str @@ -175,7 +176,6 @@ extern "C" { // cmScMsg_t record. cmScRC_t cmScoreSeqNotify( cmScH_t h ); - /* void cmScoreClearPerfInfo( cmScH_t h ); // Assign 'smpIdx' and 'vel' to the event matching 'pitch' at 'locIdx' @@ -193,7 +193,6 @@ extern "C" { // Set the performed dynamic level of a score event. void cmScoreSetPerfDynLevel( cmScH_t h, unsigned evtIdx, unsigned dynLvl ); - */ typedef enum {