cmXScore.c : Fixed bug with tie processing.

This commit is contained in:
kevin 2016-03-10 17:50:33 -05:00
parent 6af0e22986
commit af8ad35477

View File

@ -779,16 +779,20 @@ 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 )
{ {
cmXsNote_t* nnp = np->slink; 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?'#':' ');
printf("%i %s ",np->meas->number,cmMidiToSciPitch(np->pitch,NULL,0));
// for each successive measure
for(; mp!=NULL; mp=mp->link) for(; mp!=NULL; mp=mp->link)
{ {
if( nnp == NULL ) if( nnp == NULL )
nnp = mp->noteL; nnp = mp->noteL;
// for each note starting at nnp
for(; nnp!=NULL; nnp=nnp->slink) for(; nnp!=NULL; nnp=nnp->slink)
{ {
if( /*nnp->voice->id == np->voice->id &&*/ nnp->step == np->step && nnp->octave == np->octave ) if( /*nnp->voice->id == np->voice->id &&*/ nnp->step == np->step && nnp->octave == np->octave )
@ -796,6 +800,9 @@ 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);
printf("---> %i %s ",nnp->meas->number,cmMidiToSciPitch(nnp->pitch,NULL,0));
if( cmIsNotFlag(nnp->flags,kTieBegXsFl) ) if( cmIsNotFlag(nnp->flags,kTieBegXsFl) )
{ {
return true; return true;
@ -822,15 +829,20 @@ void _cmXScoreResolveTiesAndLoc( cmXScore_t* p )
unsigned m = 0; unsigned m = 0;
cmXsPart_t* pp = p->partL; cmXsPart_t* pp = p->partL;
// for each part
for(; pp!=NULL; pp=pp->link) for(; pp!=NULL; pp=pp->link)
{ {
unsigned locIdx = 1; unsigned locIdx = 1;
cmXsMeas_t* mp = pp->measL; cmXsMeas_t* mp = pp->measL;
// for each measure
for(; mp!=NULL; mp=mp->link) for(; mp!=NULL; mp=mp->link)
{ {
cmXsNote_t* n0 = NULL; cmXsNote_t* n0 = NULL;
cmXsNote_t* np = mp->noteL; cmXsNote_t* np = mp->noteL;
// for each note in this measure
for(; np!=NULL; np=np->slink) for(; np!=NULL; np=np->slink)
{ {
// if this note begins a tie and has not yet been processed // if this note begins a tie and has not yet been processed
@ -840,6 +852,7 @@ void _cmXScoreResolveTiesAndLoc( cmXScore_t* p )
{ {
if( _cmXScoreFindTiedNote(p,mp,np) ) if( _cmXScoreFindTiedNote(p,mp,np) )
m += 1; m += 1;
printf("\n");
n += 1; n += 1;
} }
@ -1151,8 +1164,8 @@ cmXsRC_t cmXScoreInitialize( cmCtx_t* ctx, cmXsH_t* hp, const cmChar_t* xmlFn, c
//_cmXScoreResolveOctaveShift(p); //_cmXScoreResolveOctaveShift(p);
if( midiFn != NULL ) //if( midiFn != NULL )
_cmXScoreProcessMidi(p,ctx,midiFn); // _cmXScoreProcessMidi(p,ctx,midiFn);
// CSV output initialize failed. // CSV output initialize failed.
if( cmCsvInitialize(&p->csvH,ctx) != kOkCsvRC ) if( cmCsvInitialize(&p->csvH,ctx) != kOkCsvRC )