cmXScore.c : Added 'rptFl' to _cmXScoreFindTiedNote().

This commit is contained in:
Kevin Larke 2016-03-15 10:08:44 -04:00
parent 69a63690e8
commit 38e9647546

View File

@ -777,13 +777,14 @@ void _cmXScoreSort( cmXScore_t* p )
} }
} }
bool _cmXScoreFindTiedNote( cmXScore_t* p, cmXsMeas_t* mp, cmXsNote_t* np ) bool _cmXScoreFindTiedNote( cmXScore_t* p, cmXsMeas_t* mp, cmXsNote_t* np, bool rptFl )
{ {
cmXsNote_t* nnp = np->slink; // begin w/ note following np cmXsNote_t* nnp = np->slink; // begin w/ note following np
unsigned measNumb = mp->number; unsigned measNumb = mp->number;
unsigned measNumb0= measNumb; unsigned measNumb0= measNumb;
cmChar_t acc = np->alter==-1?'b' : (np->alter==1?'#':' '); cmChar_t acc = np->alter==-1?'b' : (np->alter==1?'#':' ');
if( rptFl )
printf("%i %s ",np->meas->number,cmMidiToSciPitch(np->pitch,NULL,0)); printf("%i %s ",np->meas->number,cmMidiToSciPitch(np->pitch,NULL,0));
// for each successive measure // for each successive measure
@ -800,9 +801,10 @@ bool _cmXScoreFindTiedNote( cmXScore_t* p, cmXsMeas_t* mp, cmXsNote_t* np )
nnp->flags |= kTieProcXsFl; nnp->flags |= kTieProcXsFl;
nnp->flags = cmClrFlag(nnp->flags,kOnsetXsFl); nnp->flags = cmClrFlag(nnp->flags,kOnsetXsFl);
if( rptFl )
printf("---> %i %s ",nnp->meas->number,cmMidiToSciPitch(nnp->pitch,NULL,0)); printf("---> %i %s ",nnp->meas->number,cmMidiToSciPitch(nnp->pitch,NULL,0));
// if this note is not tied to a subsequent note
if( cmIsNotFlag(nnp->flags,kTieBegXsFl) ) if( cmIsNotFlag(nnp->flags,kTieBegXsFl) )
{ {
return true; return true;
@ -827,7 +829,7 @@ void _cmXScoreResolveTiesAndLoc( cmXScore_t* p )
{ {
unsigned n = 0; unsigned n = 0;
unsigned m = 0; unsigned m = 0;
bool rptFl = false;
cmXsPart_t* pp = p->partL; cmXsPart_t* pp = p->partL;
// for each part // for each part
@ -850,12 +852,21 @@ void _cmXScoreResolveTiesAndLoc( cmXScore_t* p )
// may have already been processed by an earlier tied note.) // may have already been processed by an earlier tied note.)
if( cmIsFlag(np->flags,kTieBegXsFl) && cmIsNotFlag(np->flags,kTieProcXsFl)) if( cmIsFlag(np->flags,kTieBegXsFl) && cmIsNotFlag(np->flags,kTieProcXsFl))
{ {
if( _cmXScoreFindTiedNote(p,mp,np) ) if( _cmXScoreFindTiedNote(p,mp,np,rptFl) )
m += 1; m += 1;
if( rptFl )
printf("\n"); printf("\n");
n += 1; n += 1;
} }
if( cmIsFlag(np->flags,kTieEndXsFl) && cmIsFlag(np->flags,kOnsetXsFl) )
{
cmChar_t acc = np->alter==-1?'b' : (np->alter==1?'#':' ');
cmErrWarnMsg(&p->err,kUnterminatedTieXsRC,"The tied %c%c%i in measure %i marked as a tied note but is also marked to sound.",np->step,acc,np->octave,mp->number);
}
// set the location // set the location
if( cmIsFlag(np->flags,kOnsetXsFl) ) if( cmIsFlag(np->flags,kOnsetXsFl) )
{ {
@ -1648,7 +1659,7 @@ cmXsRC_t cmXScoreTest( cmCtx_t* ctx, const cmChar_t* xmlFn, const cmChar_t* midi
if((rc = cmXScoreInitialize( ctx, &h, xmlFn, midiFn)) != kOkXsRC ) if((rc = cmXScoreInitialize( ctx, &h, xmlFn, midiFn)) != kOkXsRC )
return cmErrMsg(&ctx->err,rc,"XScore alloc failed."); return cmErrMsg(&ctx->err,rc,"XScore alloc failed.");
cmXScoreWriteCsv(h,"/Users/kevin/temp/a0.csv"); cmXScoreWriteCsv(h,"/home/kevin/temp/a0.csv");
cmXScoreReport(h,&ctx->rpt,false); cmXScoreReport(h,&ctx->rpt,false);
return cmXScoreFinalize(&h); return cmXScoreFinalize(&h);