Browse 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 7 years ago
parent
commit
71e9fdd169
2 changed files with 21 additions and 5 deletions
  1. 9
    1
      app/cmXScore.c
  2. 12
    4
      app/cmXScore.h

+ 9
- 1
app/cmXScore.c View File

2359
             if((rc = _cmXScoreReorderParseDyn(p,b,ln+1,&r.dynIdx)) != kOkXsRC )
2359
             if((rc = _cmXScoreReorderParseDyn(p,b,ln+1,&r.dynIdx)) != kOkXsRC )
2360
               goto errLabel;
2360
               goto errLabel;
2361
             
2361
             
2362
-            // parse the flag edits
2362
+            // parse the flag edits following a '~'
2363
             if((rc = _cmXScoreReorderParseFlags(p,b,ln+1, &r.newFlags)) != kOkXsRC )
2363
             if((rc = _cmXScoreReorderParseFlags(p,b,ln+1, &r.newFlags)) != kOkXsRC )
2364
               goto errLabel;
2364
               goto errLabel;
2365
 
2365
 
3694
   cmXsRC_t rc;
3694
   cmXsRC_t rc;
3695
   cmXsH_t h = cmXsNullHandle;
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
   // Parse the XML file and apply the changes in editFn.
3705
   // Parse the XML file and apply the changes in editFn.
3698
   if((rc = cmXScoreInitialize( ctx, &h, xmlFn,editFn)) != kOkXsRC )
3706
   if((rc = cmXScoreInitialize( ctx, &h, xmlFn,editFn)) != kOkXsRC )
3699
     return cmErrMsg(&ctx->err,rc,"XScore alloc failed.");
3707
     return cmErrMsg(&ctx->err,rc,"XScore alloc failed.");

+ 12
- 4
app/cmXScore.h View File

37
   //       b. Emacs C-x <RET> f utf-8 <RET>
37
   //       b. Emacs C-x <RET> f utf-8 <RET>
38
   //       c. Change: <?xml ... encoding = 'UTF-16' to encoding='UTF-8' ...?>
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
   // Steps 1) and 2) can be automated by in emacs by:
42
   // Steps 1) and 2) can be automated by in emacs by:
43
   //
43
   //
45
   //
45
   //
46
 
46
 
47
   // Initialize an cmXScore object from a Sibelius generated MusicXML file.
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
   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 );
52
   cmXsRC_t cmXScoreFinalize( cmXsH_t* hp );
51
   cmXsRC_t cmXScoreFinalize( cmXsH_t* hp );
53
 
52
 
58
 
57
 
59
   void     cmXScoreReport( cmXsH_t h, cmRpt_t* rpt, bool sortFl );
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
   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 );
62
 
64
 
63
   // Generate the CSV file suitable for use by cmScore.
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
   cmXsRC_t cmXScoreTest( cmCtx_t* ctx, const cmChar_t* xmlFn, const cmChar_t* reorderFn, const cmChar_t* csvOutFn, const cmChar_t* midiOutFn );
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
 #ifdef __cplusplus
74
 #ifdef __cplusplus

Loading…
Cancel
Save