Browse Source

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

master
Kevin Larke 8 years ago
parent
commit
38e9647546
1 changed files with 19 additions and 8 deletions
  1. 19
    8
      app/cmXScore.c

+ 19
- 8
app/cmXScore.c View File

777
   }
777
   }
778
 }
778
 }
779
 
779
 
780
-bool  _cmXScoreFindTiedNote( cmXScore_t* p, cmXsMeas_t* mp, cmXsNote_t* np )
780
+bool  _cmXScoreFindTiedNote( cmXScore_t* p, cmXsMeas_t* mp, cmXsNote_t* np, bool rptFl )
781
 {
781
 {
782
   cmXsNote_t* nnp      = np->slink;  // begin w/ note following np
782
   cmXsNote_t* nnp      = np->slink;  // begin w/ note following np
783
   unsigned    measNumb = mp->number;
783
   unsigned    measNumb = mp->number;
784
   unsigned    measNumb0= measNumb;
784
   unsigned    measNumb0= measNumb;
785
   cmChar_t    acc      = np->alter==-1?'b' : (np->alter==1?'#':' ');
785
   cmChar_t    acc      = np->alter==-1?'b' : (np->alter==1?'#':' ');
786
 
786
 
787
-  printf("%i %s ",np->meas->number,cmMidiToSciPitch(np->pitch,NULL,0));
787
+  if( rptFl )
788
+    printf("%i %s ",np->meas->number,cmMidiToSciPitch(np->pitch,NULL,0));
788
   
789
   
789
   // for each successive measure
790
   // for each successive measure
790
   for(; mp!=NULL; mp=mp->link)
791
   for(; mp!=NULL; mp=mp->link)
800
         nnp->flags |= kTieProcXsFl;
801
         nnp->flags |= kTieProcXsFl;
801
         nnp->flags  = cmClrFlag(nnp->flags,kOnsetXsFl);
802
         nnp->flags  = cmClrFlag(nnp->flags,kOnsetXsFl);
802
 
803
 
803
-        printf("---> %i %s ",nnp->meas->number,cmMidiToSciPitch(nnp->pitch,NULL,0));
804
-
804
+        if( rptFl )
805
+          printf("---> %i %s ",nnp->meas->number,cmMidiToSciPitch(nnp->pitch,NULL,0));
805
 
806
 
807
+        // if this note is not tied to a subsequent note
806
         if( cmIsNotFlag(nnp->flags,kTieBegXsFl) )
808
         if( cmIsNotFlag(nnp->flags,kTieBegXsFl) )
807
         {
809
         {
808
           return true;
810
           return true;
827
 {
829
 {
828
   unsigned n   = 0;
830
   unsigned n   = 0;
829
   unsigned m   = 0;
831
   unsigned m   = 0;
830
-  
832
+  bool     rptFl = false;
831
   cmXsPart_t* pp = p->partL;
833
   cmXsPart_t* pp = p->partL;
832
   
834
   
833
   // for each part
835
   // for each part
850
         //  may have already been processed by an earlier tied note.)
852
         //  may have already been processed by an earlier tied note.)
851
         if( cmIsFlag(np->flags,kTieBegXsFl) && cmIsNotFlag(np->flags,kTieProcXsFl))
853
         if( cmIsFlag(np->flags,kTieBegXsFl) && cmIsNotFlag(np->flags,kTieProcXsFl))
852
         {
854
         {
853
-          if( _cmXScoreFindTiedNote(p,mp,np) )
855
+          if( _cmXScoreFindTiedNote(p,mp,np,rptFl) )
854
             m += 1;
856
             m += 1;
855
-          printf("\n");
857
+          
858
+          if( rptFl )
859
+            printf("\n");
860
+          
856
           n += 1;
861
           n += 1;
857
         }
862
         }
858
 
863
 
864
+        if( cmIsFlag(np->flags,kTieEndXsFl) && cmIsFlag(np->flags,kOnsetXsFl) )
865
+        {
866
+          cmChar_t    acc  = np->alter==-1?'b' : (np->alter==1?'#':' ');
867
+          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);
868
+        }
869
+
859
         // set the location 
870
         // set the location 
860
         if( cmIsFlag(np->flags,kOnsetXsFl) )
871
         if( cmIsFlag(np->flags,kOnsetXsFl) )
861
         {
872
         {
1648
   if((rc = cmXScoreInitialize( ctx, &h, xmlFn, midiFn)) != kOkXsRC )
1659
   if((rc = cmXScoreInitialize( ctx, &h, xmlFn, midiFn)) != kOkXsRC )
1649
     return cmErrMsg(&ctx->err,rc,"XScore alloc failed.");
1660
     return cmErrMsg(&ctx->err,rc,"XScore alloc failed.");
1650
 
1661
 
1651
-  cmXScoreWriteCsv(h,"/Users/kevin/temp/a0.csv");
1662
+  cmXScoreWriteCsv(h,"/home/kevin/temp/a0.csv");
1652
   cmXScoreReport(h,&ctx->rpt,false);
1663
   cmXScoreReport(h,&ctx->rpt,false);
1653
   
1664
   
1654
   return cmXScoreFinalize(&h);
1665
   return cmXScoreFinalize(&h);

Loading…
Cancel
Save