浏览代码

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

master
kevin 7 年前
父节点
当前提交
92ea6ff806
共有 1 个文件被更改,包括 15 次插入14 次删除
  1. 15
    14
      app/cmXScore.c

+ 15
- 14
app/cmXScore.c 查看文件

@@ -1718,13 +1718,13 @@ void _cmXScoreGraceInsertSoonAfterFirst( cmXScore_t* p, unsigned graceGroupId, c
1718 1718
 // after reordering so that we can be sure that the order in time of
1719 1719
 // the notes in each group has been set prior to building the
1720 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 1723
   cmXsRC_t rc           = kOkXsRC;
1724 1724
   unsigned graceGroupId = 1;
1725 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 1729
     cmXsNote_t* gn0p        = NULL;      // first note in the grace group
1730 1730
     cmXsNote_t* gn1p        = NULL;      // last note in the grace group
@@ -1776,14 +1776,14 @@ cmXsRC_t _cmXScoreProcessGraceNotes( cmXScore_t* p )
1776 1776
       } // for each measure
1777 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 1780
     if( gn0p == NULL )
1781
-      break;
1781
+      continue;
1782 1782
 
1783 1783
     // grace note groups must have at least 3 members
1784 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 1787
       break;
1788 1788
     }
1789 1789
     
@@ -2405,6 +2405,12 @@ cmXsRC_t  _cmXScoreReorderParseGrace(cmXScore_t* p, const cmChar_t* b, unsigned
2405 2405
       case 'A': r->graceFlags |= kAFirstGraceXsFl| kEndGraceXsFl; break;
2406 2406
       case 'n': r->graceFlags |= kNFirstGraceXsFl| kEndGraceXsFl; break;
2407 2407
       case 'g': break;
2408
+        
2409
+      case '1':
2410
+        r->graceGroupId += 1;
2411
+        ++s;
2412
+        continue;
2413
+        
2408 2414
 
2409 2415
       case '%':
2410 2416
         *graceGroupIdRef += 1;
@@ -2625,7 +2631,7 @@ cmXsRC_t _cmXsApplyEditFile( cmXScore_t* p, const cmChar_t* fn )
2625 2631
   _cmXScoreSort(p);
2626 2632
 
2627 2633
   // process the grace notes.
2628
-  _cmXScoreProcessGraceNotes( p );
2634
+  _cmXScoreProcessGraceNotes( p, graceGroupId );
2629 2635
 
2630 2636
   // inserting grace notes may have left the score unsorted
2631 2637
   _cmXScoreSort(p);
@@ -2633,12 +2639,9 @@ cmXsRC_t _cmXsApplyEditFile( cmXScore_t* p, const cmChar_t* fn )
2633 2639
   // process the dynamic forks
2634 2640
   _cmXScoreProcessDynamicForks(p);
2635 2641
 
2642
+  //_cmXScoreReport(p, NULL, true );
2636 2643
 
2637 2644
 
2638
-  _cmXScoreReport(p, NULL, true );
2639
-
2640
-
2641
-  
2642 2645
  errLabel:
2643 2646
   cmFileClose(&fH);
2644 2647
   cmMemFree(b);
@@ -3200,7 +3203,6 @@ void _cmXScoreReportNote( cmRpt_t* rpt, const cmXsNote_t* note,unsigned index )
3200 3203
 
3201 3204
   if( note->graceGroupId != 0)
3202 3205
     cmRptPrintf(rpt," g=%i",note->graceGroupId);
3203
-
3204 3206
   /*
3205 3207
   if( cmIsFlag(note->flags,kBegGraceXsFl) )
3206 3208
     cmRptPrintf(rpt," B");
@@ -3216,8 +3218,7 @@ void _cmXScoreReportNote( cmRpt_t* rpt, const cmXsNote_t* note,unsigned index )
3216 3218
 
3217 3219
   if( cmIsFlag(note->flags,kDynEndForkXsFl) )
3218 3220
     cmRptPrintf(rpt," E");
3219
-  
3220
-  */
3221
+  */  
3221 3222
 }
3222 3223
 
3223 3224
 
@@ -3965,7 +3966,7 @@ cmXsRC_t cmXScoreTest(
3965 3966
     
3966 3967
   }
3967 3968
   
3968
-  //cmXScoreReport(h,&ctx->rpt,true);
3969
+  cmXScoreReport(h,&ctx->rpt,true);
3969 3970
 
3970 3971
   return cmXScoreFinalize(&h);
3971 3972
 

正在加载...
取消
保存