Browse Source

cmXScore.h/c : Added 'damperRptFl' to print out pedal state during pedal processing.

master
kevin 4 years ago
parent
commit
75f8c880f7
2 changed files with 33 additions and 16 deletions
  1. 30
    13
      src/app/cmXScore.c
  2. 3
    3
      src/app/cmXScore.h

+ 30
- 13
src/app/cmXScore.c View File

681
   return _cmXScorePushNote(p, meas, voiceId, note );
681
   return _cmXScorePushNote(p, meas, voiceId, note );
682
 }
682
 }
683
 
683
 
684
-cmXsRC_t _cmXScorePushNonNote( cmXScore_t* p, cmXsMeas_t* meas, const cmXmlNode_t* noteXmlNode, unsigned tick, unsigned duration, double rvalue, const cmChar_t* tvalue, unsigned flags )
684
+cmXsRC_t _cmXScorePushNonNote( cmXScore_t* p, cmXsMeas_t* meas, const cmXmlNode_t* noteXmlNode, unsigned tick, unsigned duration, unsigned staff, double rvalue, const cmChar_t* tvalue, unsigned flags )
685
 {
685
 {
686
   cmXsNote_t* note    = cmLhAllocZ(p->lhH,cmXsNote_t,1);
686
   cmXsNote_t* note    = cmLhAllocZ(p->lhH,cmXsNote_t,1);
687
   unsigned    voiceId = 0;    // non-note's are always assigned to voiceId=0;
687
   unsigned    voiceId = 0;    // non-note's are always assigned to voiceId=0;
688
 
688
 
689
   note->tick     = tick;
689
   note->tick     = tick;
690
+  note->staff    = staff;
690
   note->flags    = flags;
691
   note->flags    = flags;
691
   note->rvalue   = rvalue;
692
   note->rvalue   = rvalue;
692
   note->tvalue   = tvalue;
693
   note->tvalue   = tvalue;
822
   }
823
   }
823
 
824
 
824
   if( pushFl )
825
   if( pushFl )
825
-   rc = _cmXScorePushNonNote(p,meas,dnp,tick+offset,duration,rvalue,tvalue,flags);
826
+    rc = _cmXScorePushNonNote(p,meas,dnp,tick+offset,duration,staff,rvalue,tvalue,flags);
826
 
827
 
827
   return rc;
828
   return rc;
828
 }
829
 }
868
   }
869
   }
869
 
870
 
870
   // store the bar line
871
   // store the bar line
871
-  if((rc = _cmXScorePushNonNote(p,meas,mnp,tick,0,0,NULL,kBarXsFl)) != kOkXsRC )
872
+  if((rc = _cmXScorePushNonNote(p,meas,mnp,tick,0,0,0,NULL,kBarXsFl)) != kOkXsRC )
872
     return rc;
873
     return rc;
873
 
874
 
874
   np = mnp->children;
875
   np = mnp->children;
1562
 }
1563
 }
1563
 
1564
 
1564
 // Assign pedal down durations to pedal down events.
1565
 // Assign pedal down durations to pedal down events.
1565
-cmXsRC_t _cmXScoreProcessPedals( cmXScore_t* p )
1566
+cmXsRC_t _cmXScoreProcessPedals( cmXScore_t* p, bool reportFl )
1566
 {
1567
 {
1567
   cmXsRC_t    rc = kOkXsRC;
1568
   cmXsRC_t    rc = kOkXsRC;
1568
   cmXsPart_t* pp = p->partL;
1569
   cmXsPart_t* pp = p->partL;
1584
           case 0:
1585
           case 0:
1585
             break;
1586
             break;
1586
             
1587
             
1587
-          case kDampDnXsFl:
1588
+          case kDampDnXsFl:            
1588
             if( dnp != NULL )
1589
             if( dnp != NULL )
1589
               cmErrWarnMsg(&p->err,kPedalStateErrorXsRc,"Damper down not preceded by damper up in measure:%i.",mp->number);
1590
               cmErrWarnMsg(&p->err,kPedalStateErrorXsRc,"Damper down not preceded by damper up in measure:%i.",mp->number);
1590
             else
1591
             else
1591
               dnp = np;
1592
               dnp = np;
1593
+
1594
+            if( reportFl )
1595
+              cmRptPrintf(p->err.rpt,"Damp Down : staff:%i meas:%i tick:%i\n", np->staff, mp->number, np->tick);
1592
             break;
1596
             break;
1593
             
1597
             
1594
           case kDampUpXsFl:
1598
           case kDampUpXsFl:
1599
               dnp->duration = np->tick - dnp->tick;
1603
               dnp->duration = np->tick - dnp->tick;
1600
               dnp = NULL;
1604
               dnp = NULL;
1601
             }
1605
             }
1606
+            
1607
+            if( reportFl )
1608
+              cmRptPrintf(p->err.rpt,"Damp Up   : staff:%i meas:%i tick:%i\n", np->staff, mp->number, np->tick);
1609
+            
1602
             break;
1610
             break;
1603
             
1611
             
1604
           case kDampUpDnXsFl:
1612
           case kDampUpDnXsFl:
1609
               dnp->duration = np->tick - dnp->tick;
1617
               dnp->duration = np->tick - dnp->tick;
1610
               dnp = np;
1618
               dnp = np;
1611
             }
1619
             }
1620
+            
1621
+            if( reportFl )
1622
+              cmRptPrintf(p->err.rpt,"Damp UpDn : staff:%i meas:%i tick:%i\n", np->staff, mp->number, np->tick);
1612
             break;
1623
             break;
1613
             
1624
             
1614
           case kSostDnXsFl:
1625
           case kSostDnXsFl:
1615
             if( snp != NULL )
1626
             if( snp != NULL )
1616
               cmErrWarnMsg(&p->err,kPedalStateErrorXsRc,"Sostenuto down not preceded by sostenuto up in measure:%i.",mp->number);
1627
               cmErrWarnMsg(&p->err,kPedalStateErrorXsRc,"Sostenuto down not preceded by sostenuto up in measure:%i.",mp->number);
1617
             else
1628
             else
1618
-              snp = np;            
1629
+              snp = np;
1630
+            
1631
+            if( reportFl )
1632
+              cmRptPrintf(p->err.rpt,"Sost Down : staff:%i meas:%i tick:%i\n", np->staff, mp->number, np->tick);
1619
             break;
1633
             break;
1620
             
1634
             
1621
           case kSostUpXsFl:
1635
           case kSostUpXsFl:
1626
               snp->duration = np->tick - snp->tick;
1640
               snp->duration = np->tick - snp->tick;
1627
               snp = NULL;
1641
               snp = NULL;
1628
             }
1642
             }
1643
+            if( reportFl )
1644
+              cmRptPrintf(p->err.rpt,"Sost Up   : staff:%i meas:%i tick:%i\n", np->staff, mp->number, np->tick);
1629
             break;
1645
             break;
1630
             
1646
             
1631
           default:
1647
           default:
2706
 
2722
 
2707
 
2723
 
2708
 
2724
 
2709
-cmXsRC_t cmXScoreInitialize( cmCtx_t* ctx, cmXsH_t* hp, const cmChar_t* xmlFn, const cmChar_t* editFn )
2725
+cmXsRC_t cmXScoreInitialize( cmCtx_t* ctx, cmXsH_t* hp, const cmChar_t* xmlFn, const cmChar_t* editFn, bool damperRptFl )
2710
 {
2726
 {
2711
   cmXsRC_t rc = kOkXsRC;
2727
   cmXsRC_t rc = kOkXsRC;
2712
 
2728
 
2771
   }
2787
   }
2772
 
2788
 
2773
   // assign durations to pedal down events
2789
   // assign durations to pedal down events
2774
-  _cmXScoreProcessPedals(p);
2790
+  _cmXScoreProcessPedals(p,damperRptFl);
2775
 
2791
 
2776
   // remove some notes which share a pitch and are overlapped or embedded within another note.
2792
   // remove some notes which share a pitch and are overlapped or embedded within another note.
2777
   _cmXScoreProcessOverlappingNotes(p);
2793
   _cmXScoreProcessOverlappingNotes(p);
3408
   }
3424
   }
3409
 }
3425
 }
3410
 
3426
 
3411
-cmXsRC_t cmXScoreGenEditFile( cmCtx_t* ctx, const cmChar_t* xmlFn, const cmChar_t* outFn )
3427
+cmXsRC_t cmXScoreGenEditFile( cmCtx_t* ctx, const cmChar_t* xmlFn, const cmChar_t* outFn, bool damperRptFl )
3412
 {
3428
 {
3413
   cmXsH_t   xsH = cmXsNullHandle;
3429
   cmXsH_t   xsH = cmXsNullHandle;
3414
   cmFileH_t fH  = cmFileNullHandle;
3430
   cmFileH_t fH  = cmFileNullHandle;
3419
   cmErrSetup(&err,&ctx->rpt,"cmXScoreGenEditFile");
3435
   cmErrSetup(&err,&ctx->rpt,"cmXScoreGenEditFile");
3420
   cmRptSetup(&rpt,_cmXScoreGenEditFileWrite,_cmXScoreGenEditFileWrite,&fH);
3436
   cmRptSetup(&rpt,_cmXScoreGenEditFileWrite,_cmXScoreGenEditFileWrite,&fH);
3421
 
3437
 
3422
-  if((rc = cmXScoreInitialize(ctx,&xsH,xmlFn,NULL)) != kOkXsRC )
3438
+  if((rc = cmXScoreInitialize(ctx,&xsH,xmlFn,NULL,damperRptFl)) != kOkXsRC )
3423
     return rc;
3439
     return rc;
3424
 
3440
 
3425
   if( cmFileOpen(&fH,outFn,kWriteFileFl,&ctx->rpt) != kOkFileRC )
3441
   if( cmFileOpen(&fH,outFn,kWriteFileFl,&ctx->rpt) != kOkFileRC )
4077
   int             beginMeasNumb,
4093
   int             beginMeasNumb,
4078
   int             beginBPM,
4094
   int             beginBPM,
4079
   bool            standAloneFl,
4095
   bool            standAloneFl,
4080
-  bool            panZoomFl )
4096
+  bool            panZoomFl,
4097
+  bool            damperRptFl)
4081
 {
4098
 {
4082
   cmXsRC_t rc;
4099
   cmXsRC_t rc;
4083
   cmXsH_t h = cmXsNullHandle;
4100
   cmXsH_t h = cmXsNullHandle;
4085
   if( editFn!=NULL && !cmFsIsFile(editFn) )
4102
   if( editFn!=NULL && !cmFsIsFile(editFn) )
4086
   {
4103
   {
4087
     cmRptPrintf(&ctx->rpt,"The edit file %s does not exist. A new edit file will be created.\n",editFn);
4104
     cmRptPrintf(&ctx->rpt,"The edit file %s does not exist. A new edit file will be created.\n",editFn);
4088
-    cmXScoreGenEditFile(ctx,xmlFn,editFn);
4105
+    cmXScoreGenEditFile(ctx,xmlFn,editFn,damperRptFl);
4089
     editFn = NULL;
4106
     editFn = NULL;
4090
   }
4107
   }
4091
   
4108
   
4092
 
4109
 
4093
   // Parse the XML file and apply the changes in editFn.
4110
   // Parse the XML file and apply the changes in editFn.
4094
-  if((rc = cmXScoreInitialize( ctx, &h, xmlFn,editFn)) != kOkXsRC )
4111
+  if((rc = cmXScoreInitialize( ctx, &h, xmlFn,editFn, damperRptFl )) != kOkXsRC )
4095
     return cmErrMsg(&ctx->err,rc,"XScore alloc failed.");
4112
     return cmErrMsg(&ctx->err,rc,"XScore alloc failed.");
4096
 
4113
 
4097
   if( csvOutFn != NULL )
4114
   if( csvOutFn != NULL )

+ 3
- 3
src/app/cmXScore.h View File

47
   // Initialize an cmXScore object from a Sibelius generated MusicXML file.
47
   // Initialize an cmXScore object from a Sibelius generated MusicXML file.
48
   // 'editFn' is used to add additional information to the score.
48
   // 'editFn' is used to add additional information to the score.
49
   // See cmXScoreGenEditFile()
49
   // See cmXScoreGenEditFile()
50
-  cmXsRC_t cmXScoreInitialize( cmCtx_t* ctx, cmXsH_t* hp, const cmChar_t* xmlFn, const cmChar_t* editFn );
50
+  cmXsRC_t cmXScoreInitialize( cmCtx_t* ctx, cmXsH_t* hp, const cmChar_t* xmlFn, const cmChar_t* editFn, bool damperRptFl );
51
   cmXsRC_t cmXScoreFinalize( cmXsH_t* hp );
51
   cmXsRC_t cmXScoreFinalize( cmXsH_t* hp );
52
 
52
 
53
   
53
   
60
   // Generate a template 'edit file'. This file can be edited by hand to included additional
60
   // Generate a template 'edit file'. This file can be edited by hand to included additional
61
   // information in the score. See the 'editFn' argument to cmXScoreInitialize() for where
61
   // information in the score. See the 'editFn' argument to cmXScoreInitialize() for where
62
   // this file is used.
62
   // this file is used.
63
-  cmXsRC_t cmXScoreGenEditFile( cmCtx_t* ctx, const cmChar_t* xmlFn, const cmChar_t* outFn );
63
+  cmXsRC_t cmXScoreGenEditFile( cmCtx_t* ctx, const cmChar_t* xmlFn, const cmChar_t* outFn, bool damperRptFl );
64
 
64
 
65
   // Generate the CSV file suitable for use by cmScore.
65
   // Generate the CSV file suitable for use by cmScore.
66
   //
66
   //
72
   // Set reportFl to true to print a report of the score following processing.
72
   // Set reportFl to true to print a report of the score following processing.
73
   // Set begMeasNumb to the first measure the to be written to the output csv, MIDI and SVG files.
73
   // Set begMeasNumb to the first measure the to be written to the output csv, MIDI and SVG files.
74
   // Set begBPM to 0 to use the tempo from the score otherwise set it to the tempo at begMeasNumb.
74
   // Set begBPM to 0 to use the tempo from the score otherwise set it to the tempo at begMeasNumb.
75
-  cmXsRC_t cmXScoreTest( cmCtx_t* ctx, const cmChar_t* xmlFn, const cmChar_t* reorderFn, const cmChar_t* csvOutFn, const cmChar_t* midiOutFn, const cmChar_t* svgOutFn, bool reportFl, int begMeasNumb, int begBPM, bool svgStandAloneFl, bool svgPanZoomFl );
75
+  cmXsRC_t cmXScoreTest( cmCtx_t* ctx, const cmChar_t* xmlFn, const cmChar_t* reorderFn, const cmChar_t* csvOutFn, const cmChar_t* midiOutFn, const cmChar_t* svgOutFn, bool reportFl, int begMeasNumb, int begBPM, bool svgStandAloneFl, bool svgPanZoomFl, bool damperRptFl );
76
   
76
   
77
 #ifdef __cplusplus
77
 #ifdef __cplusplus
78
 }
78
 }

Loading…
Cancel
Save