Parcourir la source

cmXScore.h/c : Improved comments. cmXScoreTest() now calls cmXScoreGenEditFile() when editFn arg is given and the associated file does not exist.

master
kevin larke il y a 7 ans
Parent
révision
71e9fdd169
2 fichiers modifiés avec 21 ajouts et 5 suppressions
  1. 9
    1
      app/cmXScore.c
  2. 12
    4
      app/cmXScore.h

+ 9
- 1
app/cmXScore.c Voir le fichier

@@ -2359,7 +2359,7 @@ cmXsRC_t _cmXsApplyEditFile( cmXScore_t* p, const cmChar_t* fn )
2359 2359
             if((rc = _cmXScoreReorderParseDyn(p,b,ln+1,&r.dynIdx)) != kOkXsRC )
2360 2360
               goto errLabel;
2361 2361
             
2362
-            // parse the flag edits
2362
+            // parse the flag edits following a '~'
2363 2363
             if((rc = _cmXScoreReorderParseFlags(p,b,ln+1, &r.newFlags)) != kOkXsRC )
2364 2364
               goto errLabel;
2365 2365
 
@@ -3694,6 +3694,14 @@ cmXsRC_t cmXScoreTest(
3694 3694
   cmXsRC_t rc;
3695 3695
   cmXsH_t h = cmXsNullHandle;
3696 3696
 
3697
+  if( editFn!=NULL && !cmFsIsFile(editFn) )
3698
+  {
3699
+    cmRptPrintf(&ctx->rpt,"The edit file %s does not exist. A new edit file is therefore being created.",editFn);
3700
+    cmXScoreGenEditFile(ctx,xmlFn,editFn);
3701
+    editFn = NULL;
3702
+  }
3703
+  
3704
+
3697 3705
   // Parse the XML file and apply the changes in editFn.
3698 3706
   if((rc = cmXScoreInitialize( ctx, &h, xmlFn,editFn)) != kOkXsRC )
3699 3707
     return cmErrMsg(&ctx->err,rc,"XScore alloc failed.");

+ 12
- 4
app/cmXScore.h Voir le fichier

@@ -37,7 +37,7 @@ extern "C" {
37 37
   //       b. Emacs C-x <RET> f utf-8 <RET>
38 38
   //       c. Change: <?xml ... encoding = 'UTF-16' to encoding='UTF-8' ...?>
39 39
   //
40
-  // 2) Replace "DoletSibelius Unknown Symbol Index" with "DoletSibelius unknownSymIdx"
40
+  // 2) Replace "DoletSibelius Unknown Symbol Index " with "DoletSibelius unknownSymIdx="
41 41
   //
42 42
   // Steps 1) and 2) can be automated by in emacs by:
43 43
   //
@@ -45,9 +45,8 @@ extern "C" {
45 45
   //
46 46
 
47 47
   // Initialize an cmXScore object from a Sibelius generated MusicXML file.
48
-  // Optionally include an 'edit' file to attach additional score information.
49
-  // Note that the 'edit' file is created by marking up a file created via
50
-  // cmXScoreReport().
48
+  // 'editFn' is used to add additional information to the score.
49
+  // See cmXScoreGenEditFile()
51 50
   cmXsRC_t cmXScoreInitialize( cmCtx_t* ctx, cmXsH_t* hp, const cmChar_t* xmlFn, const cmChar_t* editFn );
52 51
   cmXsRC_t cmXScoreFinalize( cmXsH_t* hp );
53 52
 
@@ -58,9 +57,18 @@ extern "C" {
58 57
 
59 58
   void     cmXScoreReport( cmXsH_t h, cmRpt_t* rpt, bool sortFl );
60 59
 
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
62
+  // this file is used.
61 63
   cmXsRC_t cmXScoreGenEditFile( cmCtx_t* ctx, const cmChar_t* xmlFn, const cmChar_t* outFn );
62 64
 
63 65
   // Generate the CSV file suitable for use by cmScore.
66
+  //
67
+  // If the file referenced by 'reorderFn' exists then it is used to attach additional
68
+  // score information.  If it does not then a new edit file is created via an
69
+  // internal call to cmXScoreGenEditFile().  This file can then be edited
70
+  // to include the additional score file information and passed back by a later
71
+  // call to this same function.
64 72
   cmXsRC_t cmXScoreTest( cmCtx_t* ctx, const cmChar_t* xmlFn, const cmChar_t* reorderFn, const cmChar_t* csvOutFn, const cmChar_t* midiOutFn );
65 73
   
66 74
 #ifdef __cplusplus

Chargement…
Annuler
Enregistrer