From 92ea6ff806c003700ee82d99fe593ce5aadd20b0 Mon Sep 17 00:00:00 2001 From: kevin Date: Sat, 13 May 2017 16:59:25 -0400 Subject: [PATCH] cmXScore.c : Added the ability to increment the grace group id. --- app/cmXScore.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/app/cmXScore.c b/app/cmXScore.c index 43ada53..9397e35 100644 --- a/app/cmXScore.c +++ b/app/cmXScore.c @@ -1718,13 +1718,13 @@ void _cmXScoreGraceInsertSoonAfterFirst( cmXScore_t* p, unsigned graceGroupId, c // after reordering so that we can be sure that the order in time of // the notes in each group has been set prior to building the // grace note groups - which must be in reverse time order. -cmXsRC_t _cmXScoreProcessGraceNotes( cmXScore_t* p ) +cmXsRC_t _cmXScoreProcessGraceNotes( cmXScore_t* p, unsigned nextGraceGroupId ) { cmXsRC_t rc = kOkXsRC; unsigned graceGroupId = 1; double graceDurSec = 1.0/15.0; // duration of all grace notes in seconds - for(; 1; ++graceGroupId) + for(; graceGroupIderr,kSyntaxErrorXsRC,"The grace not group ending in meas %i has fewer than 3 (%i) members.", gn1p->meas->number, gN ); + rc = cmErrMsg(&p->err,kSyntaxErrorXsRC,"The grace not group (groupid=%i) ending in meas %i has fewer than 3 (%i) members.", gn1p->graceGroupId, gn1p->meas->number, gN ); break; } @@ -2405,6 +2405,12 @@ cmXsRC_t _cmXScoreReorderParseGrace(cmXScore_t* p, const cmChar_t* b, unsigned case 'A': r->graceFlags |= kAFirstGraceXsFl| kEndGraceXsFl; break; case 'n': r->graceFlags |= kNFirstGraceXsFl| kEndGraceXsFl; break; case 'g': break; + + case '1': + r->graceGroupId += 1; + ++s; + continue; + case '%': *graceGroupIdRef += 1; @@ -2625,7 +2631,7 @@ cmXsRC_t _cmXsApplyEditFile( cmXScore_t* p, const cmChar_t* fn ) _cmXScoreSort(p); // process the grace notes. - _cmXScoreProcessGraceNotes( p ); + _cmXScoreProcessGraceNotes( p, graceGroupId ); // inserting grace notes may have left the score unsorted _cmXScoreSort(p); @@ -2633,12 +2639,9 @@ cmXsRC_t _cmXsApplyEditFile( cmXScore_t* p, const cmChar_t* fn ) // process the dynamic forks _cmXScoreProcessDynamicForks(p); + //_cmXScoreReport(p, NULL, true ); - _cmXScoreReport(p, NULL, true ); - - - errLabel: cmFileClose(&fH); cmMemFree(b); @@ -3200,7 +3203,6 @@ void _cmXScoreReportNote( cmRpt_t* rpt, const cmXsNote_t* note,unsigned index ) if( note->graceGroupId != 0) cmRptPrintf(rpt," g=%i",note->graceGroupId); - /* if( cmIsFlag(note->flags,kBegGraceXsFl) ) cmRptPrintf(rpt," B"); @@ -3216,8 +3218,7 @@ void _cmXScoreReportNote( cmRpt_t* rpt, const cmXsNote_t* note,unsigned index ) if( cmIsFlag(note->flags,kDynEndForkXsFl) ) cmRptPrintf(rpt," E"); - - */ + */ } @@ -3965,7 +3966,7 @@ cmXsRC_t cmXScoreTest( } - //cmXScoreReport(h,&ctx->rpt,true); + cmXScoreReport(h,&ctx->rpt,true); return cmXScoreFinalize(&h);