Parcourir la source

cmXScore.c : Added the ability to increment the grace group id.

master
kevin il y a 7 ans
Parent
révision
92ea6ff806
1 fichiers modifiés avec 15 ajouts et 14 suppressions
  1. 15
    14
      app/cmXScore.c

+ 15
- 14
app/cmXScore.c Voir le fichier

1718
 // after reordering so that we can be sure that the order in time of
1718
 // after reordering so that we can be sure that the order in time of
1719
 // the notes in each group has been set prior to building the
1719
 // the notes in each group has been set prior to building the
1720
 // grace note groups - which must be in reverse time order.
1720
 // grace note groups - which must be in reverse time order.
1721
-cmXsRC_t _cmXScoreProcessGraceNotes( cmXScore_t* p )
1721
+cmXsRC_t _cmXScoreProcessGraceNotes( cmXScore_t* p, unsigned nextGraceGroupId )
1722
 {
1722
 {
1723
   cmXsRC_t rc           = kOkXsRC;
1723
   cmXsRC_t rc           = kOkXsRC;
1724
   unsigned graceGroupId = 1;
1724
   unsigned graceGroupId = 1;
1725
   double   graceDurSec  = 1.0/15.0;  // duration of all grace notes in seconds
1725
   double   graceDurSec  = 1.0/15.0;  // duration of all grace notes in seconds
1726
 
1726
 
1727
-  for(; 1; ++graceGroupId)
1727
+  for(; graceGroupId<nextGraceGroupId; ++graceGroupId)
1728
   {
1728
   {
1729
     cmXsNote_t* gn0p        = NULL;      // first note in the grace group
1729
     cmXsNote_t* gn0p        = NULL;      // first note in the grace group
1730
     cmXsNote_t* gn1p        = NULL;      // last note in the grace group
1730
     cmXsNote_t* gn1p        = NULL;      // last note in the grace group
1776
       } // for each measure
1776
       } // for each measure
1777
     } // for each part
1777
     } // for each part
1778
 
1778
 
1779
-    // no records were found for this grace id - we're done
1779
+    // no records were found for this grace id - this grace group id was not used
1780
     if( gn0p == NULL )
1780
     if( gn0p == NULL )
1781
-      break;
1781
+      continue;
1782
 
1782
 
1783
     // grace note groups must have at least 3 members
1783
     // grace note groups must have at least 3 members
1784
     if( gN < 3 )
1784
     if( gN < 3 )
1785
     {
1785
     {
1786
-      rc = cmErrMsg(&p->err,kSyntaxErrorXsRC,"The grace not group ending in meas %i has fewer than 3 (%i) members.", gn1p->meas->number, gN );
1786
+      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 );
1787
       break;
1787
       break;
1788
     }
1788
     }
1789
     
1789
     
2405
       case 'A': r->graceFlags |= kAFirstGraceXsFl| kEndGraceXsFl; break;
2405
       case 'A': r->graceFlags |= kAFirstGraceXsFl| kEndGraceXsFl; break;
2406
       case 'n': r->graceFlags |= kNFirstGraceXsFl| kEndGraceXsFl; break;
2406
       case 'n': r->graceFlags |= kNFirstGraceXsFl| kEndGraceXsFl; break;
2407
       case 'g': break;
2407
       case 'g': break;
2408
+        
2409
+      case '1':
2410
+        r->graceGroupId += 1;
2411
+        ++s;
2412
+        continue;
2413
+        
2408
 
2414
 
2409
       case '%':
2415
       case '%':
2410
         *graceGroupIdRef += 1;
2416
         *graceGroupIdRef += 1;
2625
   _cmXScoreSort(p);
2631
   _cmXScoreSort(p);
2626
 
2632
 
2627
   // process the grace notes.
2633
   // process the grace notes.
2628
-  _cmXScoreProcessGraceNotes( p );
2634
+  _cmXScoreProcessGraceNotes( p, graceGroupId );
2629
 
2635
 
2630
   // inserting grace notes may have left the score unsorted
2636
   // inserting grace notes may have left the score unsorted
2631
   _cmXScoreSort(p);
2637
   _cmXScoreSort(p);
2633
   // process the dynamic forks
2639
   // process the dynamic forks
2634
   _cmXScoreProcessDynamicForks(p);
2640
   _cmXScoreProcessDynamicForks(p);
2635
 
2641
 
2642
+  //_cmXScoreReport(p, NULL, true );
2636
 
2643
 
2637
 
2644
 
2638
-  _cmXScoreReport(p, NULL, true );
2639
-
2640
-
2641
-  
2642
  errLabel:
2645
  errLabel:
2643
   cmFileClose(&fH);
2646
   cmFileClose(&fH);
2644
   cmMemFree(b);
2647
   cmMemFree(b);
3200
 
3203
 
3201
   if( note->graceGroupId != 0)
3204
   if( note->graceGroupId != 0)
3202
     cmRptPrintf(rpt," g=%i",note->graceGroupId);
3205
     cmRptPrintf(rpt," g=%i",note->graceGroupId);
3203
-
3204
   /*
3206
   /*
3205
   if( cmIsFlag(note->flags,kBegGraceXsFl) )
3207
   if( cmIsFlag(note->flags,kBegGraceXsFl) )
3206
     cmRptPrintf(rpt," B");
3208
     cmRptPrintf(rpt," B");
3216
 
3218
 
3217
   if( cmIsFlag(note->flags,kDynEndForkXsFl) )
3219
   if( cmIsFlag(note->flags,kDynEndForkXsFl) )
3218
     cmRptPrintf(rpt," E");
3220
     cmRptPrintf(rpt," E");
3219
-  
3220
-  */
3221
+  */  
3221
 }
3222
 }
3222
 
3223
 
3223
 
3224
 
3965
     
3966
     
3966
   }
3967
   }
3967
   
3968
   
3968
-  //cmXScoreReport(h,&ctx->rpt,true);
3969
+  cmXScoreReport(h,&ctx->rpt,true);
3969
 
3970
 
3970
   return cmXScoreFinalize(&h);
3971
   return cmXScoreFinalize(&h);
3971
 
3972
 

Chargement…
Annuler
Enregistrer