|
@@ -696,7 +696,7 @@ cmXsRC_t _cmXScoreParseMeasure(cmXScore_t* p, cmXsPart_t* pp, const cmXmlNode_t*
|
696
|
696
|
}
|
697
|
697
|
|
698
|
698
|
}
|
699
|
|
-
|
|
699
|
+
|
700
|
700
|
return rc;
|
701
|
701
|
}
|
702
|
702
|
|
|
@@ -704,7 +704,7 @@ cmXsRC_t _cmXScoreParsePart( cmXScore_t* p, cmXsPart_t* pp )
|
704
|
704
|
{
|
705
|
705
|
cmXsRC_t rc = kOkXsRC;
|
706
|
706
|
const cmXmlNode_t* xnp;
|
707
|
|
- cmXmlAttr_t partAttr = { "id", pp->idStr };
|
|
707
|
+ cmXmlAttr_t partAttr = { "id", pp->idStr };
|
708
|
708
|
|
709
|
709
|
// find the 'part'
|
710
|
710
|
if((xnp = cmXmlSearch( cmXmlRoot(p->xmlH), "part", &partAttr, 1)) == NULL )
|
|
@@ -828,55 +828,6 @@ bool _cmXScoreFindTiedNote( cmXScore_t* p, cmXsMeas_t* mp, cmXsNote_t* n0p, boo
|
828
|
828
|
return false;
|
829
|
829
|
}
|
830
|
830
|
|
831
|
|
-bool _cmXScoreFindTiedNote1( cmXScore_t* p, cmXsMeas_t* mp, cmXsNote_t* np, bool rptFl )
|
832
|
|
-{
|
833
|
|
- cmXsNote_t* nnp = np->slink; // begin w/ note following np
|
834
|
|
- unsigned measNumb = mp->number;
|
835
|
|
- unsigned measNumb0 = measNumb;
|
836
|
|
- cmChar_t acc = np->alter==-1?'b' : (np->alter==1?'#':' ');
|
837
|
|
-
|
838
|
|
- if( rptFl )
|
839
|
|
- printf("%i %i %s ",np->meas->number,np->tick,cmMidiToSciPitch(np->pitch,NULL,0));
|
840
|
|
-
|
841
|
|
- // for each successive measure
|
842
|
|
- for(; mp!=NULL; mp=mp->link)
|
843
|
|
- {
|
844
|
|
- //if( nnp == NULL )
|
845
|
|
- // nnp = mp->noteL;
|
846
|
|
-
|
847
|
|
- // for each note starting at nnp
|
848
|
|
- for(; nnp!=NULL; nnp=nnp->slink)
|
849
|
|
- {
|
850
|
|
- // if this note is tied to the originating note (np)
|
851
|
|
- if( nnp->voice->id == np->voice->id && nnp->step == np->step && nnp->octave == np->octave )
|
852
|
|
- {
|
853
|
|
- nnp->flags |= kTieProcXsFl;
|
854
|
|
- nnp->flags = cmClrFlag(nnp->flags,kOnsetXsFl);
|
855
|
|
-
|
856
|
|
- if( rptFl )
|
857
|
|
- printf("---> %i %i %s ",nnp->meas->number,nnp->tick,cmMidiToSciPitch(nnp->pitch,NULL,0));
|
858
|
|
-
|
859
|
|
- // if this note is not tied to a subsequent note
|
860
|
|
- if( cmIsNotFlag(nnp->flags,kTieBegXsFl) )
|
861
|
|
- {
|
862
|
|
- return true;
|
863
|
|
- }
|
864
|
|
-
|
865
|
|
- measNumb0 = mp->number;
|
866
|
|
- }
|
867
|
|
- }
|
868
|
|
-
|
869
|
|
- // if a measure was completed and no end note was found ... then the tie is unterminated
|
870
|
|
- // (a tie must be continued in every measure which it passes through)
|
871
|
|
- if( measNumb0 < mp->number )
|
872
|
|
- break;
|
873
|
|
-
|
874
|
|
- }
|
875
|
|
-
|
876
|
|
- cmErrWarnMsg(&p->err,kUnterminatedTieXsRC,"The tied %c%c%i in measure %i was not terminated.",np->step,acc,np->octave,measNumb0);
|
877
|
|
- return false;
|
878
|
|
-}
|
879
|
|
-
|
880
|
831
|
void _cmXScoreResolveTiesAndLoc( cmXScore_t* p )
|
881
|
832
|
{
|
882
|
833
|
unsigned n = 0;
|
|
@@ -920,9 +871,9 @@ void _cmXScoreResolveTiesAndLoc( cmXScore_t* p )
|
920
|
871
|
}
|
921
|
872
|
|
922
|
873
|
// set the location
|
923
|
|
- if( cmIsFlag(np->flags,kOnsetXsFl) )
|
|
874
|
+ if( cmIsFlag(np->flags,kOnsetXsFl|kBarXsFl) )
|
924
|
875
|
{
|
925
|
|
- if( n0!=NULL && n0->tick!=np->tick)
|
|
876
|
+ if( cmIsFlag(np->flags,kBarXsFl) || (n0!=NULL && n0->tick!=np->tick))
|
926
|
877
|
locIdx += 1;
|
927
|
878
|
|
928
|
879
|
np->locIdx = locIdx;
|
|
@@ -968,6 +919,39 @@ cmXsRC_t _cmXScoreResolveOctaveShift( cmXScore_t* p )
|
968
|
919
|
}
|
969
|
920
|
|
970
|
921
|
|
|
922
|
+// The identical pitch may be notated to play simultaneously on different voices.
|
|
923
|
+// As performed on the piano this will equate to a single sounding note.
|
|
924
|
+// This function clears the onset flag on all except one of the duplicated notes.
|
|
925
|
+void _cmXScoreRemoveDuplicateNotes( cmXScore_t* p )
|
|
926
|
+{
|
|
927
|
+ cmXsPart_t* pp = p->partL;
|
|
928
|
+
|
|
929
|
+ // for each part
|
|
930
|
+ for(; pp!=NULL; pp=pp->link)
|
|
931
|
+ {
|
|
932
|
+ cmXsMeas_t* mp = pp->measL;
|
|
933
|
+
|
|
934
|
+ // for each measure
|
|
935
|
+ for(; mp!=NULL; mp=mp->link)
|
|
936
|
+ {
|
|
937
|
+ cmXsNote_t* np = mp->noteL;
|
|
938
|
+
|
|
939
|
+ // for each note in this measure
|
|
940
|
+ for(; np!=NULL; np=np->slink)
|
|
941
|
+ if( cmIsFlag(np->flags,kOnsetXsFl) )
|
|
942
|
+ {
|
|
943
|
+ cmXsNote_t* n0p = mp->noteL;
|
|
944
|
+ for(; n0p!=NULL; n0p=n0p->slink)
|
|
945
|
+ if( n0p!=np && cmIsFlag(n0p->flags,kOnsetXsFl) && np->locIdx==n0p->locIdx && np->pitch==n0p->pitch )
|
|
946
|
+ n0p->flags = cmClrFlag(n0p->flags,kOnsetXsFl);
|
|
947
|
+
|
|
948
|
+ }
|
|
949
|
+ }
|
|
950
|
+ }
|
|
951
|
+}
|
|
952
|
+
|
|
953
|
+
|
|
954
|
+
|
971
|
955
|
cmXsMeas_t* _cmXScoreNextNonEmptyMeas( cmXsPart_t* pp, cmXsMeas_t* meas )
|
972
|
956
|
{
|
973
|
957
|
if( meas == NULL )
|
|
@@ -1225,6 +1209,8 @@ cmXsRC_t cmXScoreInitialize( cmCtx_t* ctx, cmXsH_t* hp, const cmChar_t* xmlFn, c
|
1225
|
1209
|
|
1226
|
1210
|
_cmXScoreResolveTiesAndLoc(p);
|
1227
|
1211
|
|
|
1212
|
+ _cmXScoreRemoveDuplicateNotes(p);
|
|
1213
|
+
|
1228
|
1214
|
//_cmXScoreResolveOctaveShift(p);
|
1229
|
1215
|
|
1230
|
1216
|
//if( midiFn != NULL )
|