|
@@ -33,6 +33,7 @@ enum
|
33
|
33
|
kNoActionIdSelectedCtRC,
|
34
|
34
|
kMissingRequiredFileNameCtRC,
|
35
|
35
|
kScoreGenFailedCtRC,
|
|
36
|
+ kScoreEditMergeFailedCtRC,
|
36
|
37
|
kScoreFollowFailedCtRC,
|
37
|
38
|
kMidiFileRptFailedCtRC,
|
38
|
39
|
kTimeLineRptFailedCtRC,
|
|
@@ -46,14 +47,14 @@ const cmChar_t poBegHelpStr[] =
|
46
|
47
|
"\n"
|
47
|
48
|
"USAGE:\n"
|
48
|
49
|
"\n"
|
49
|
|
- "Parse an XML score file and decoration file to produce a score file in CSV format.\n"
|
|
50
|
+ "Parse an XML score file and 'edit' file to produce a score file in CSV format.\n"
|
50
|
51
|
"\n"
|
51
|
|
- "cmtool --score_gen -x <xml_file> -d <dec_fn> {-c <csvScoreOutFn} {-m <midiOutFn>} {-s <svgOutFn>} {-r report} {-b begMeasNumb} {t begTempoBPM}\n"
|
|
52
|
+ "cmtool --score_gen -x <xml_file> -d <edit_fn> {-c <csvScoreOutFn} {-m <midiOutFn>} {-s <svgOutFn>} {-r report} {-b begMeasNumb} {t begTempoBPM}\n"
|
52
|
53
|
"\n"
|
53
|
54
|
"Notes:\n"
|
54
|
|
- "1. If <dec_fn> does not exist then a decoration template file will be generated based on the MusicXML file. \n"
|
55
|
|
- "2. Along with the CSV score file MIDI and HTML/SVG files will also be produced based on the contents of the MusicXML and decoration file.\n"
|
56
|
|
- "3. See README.md for a detailed description of the how to edit the decoration file.\n"
|
|
55
|
+ "1. If <edit_fn> does not exist then a edit template file will be generated based on the MusicXML file. \n"
|
|
56
|
+ "2. Along with the CSV score file MIDI and HTML/SVG files will also be produced based on the contents of the MusicXML and edit file.\n"
|
|
57
|
+ "3. See README.md for a detailed description of the how to edit the edit file.\n"
|
57
|
58
|
"\n"
|
58
|
59
|
"\n"
|
59
|
60
|
"Use the score follower to generate a timeline configuration file.\n"
|
|
@@ -103,18 +104,39 @@ bool verify_non_null_filename( cmCtx_t* ctx, const cmChar_t* fn, const cmChar_t*
|
103
|
104
|
return kOkCtRC;
|
104
|
105
|
}
|
105
|
106
|
|
106
|
|
-cmRC_t score_gen( cmCtx_t* ctx, const cmChar_t* xmlFn, const cmChar_t* decFn, const cmChar_t* csvOutFn, const cmChar_t* midiOutFn, const cmChar_t* svgOutFn, unsigned reportFl, int begMeasNumb, int begTempoBPM, bool svgStandAloneFl, bool svgPanZoomFl, bool damperRptFl )
|
|
107
|
+cmRC_t score_gen( cmCtx_t* ctx, const cmChar_t* xmlFn, const cmChar_t* editFn, const cmChar_t* csvOutFn, const cmChar_t* midiOutFn, const cmChar_t* svgOutFn, unsigned reportFl, int begMeasNumb, int begTempoBPM, bool svgStandAloneFl, bool svgPanZoomFl, bool damperRptFl )
|
107
|
108
|
{
|
108
|
109
|
cmRC_t rc;
|
109
|
110
|
if((rc = verify_file_exists(ctx,xmlFn,"XML file")) != kOkCtRC )
|
110
|
111
|
return rc;
|
111
|
112
|
|
112
|
|
- if( cmXScoreTest( ctx, xmlFn, decFn, csvOutFn, midiOutFn, svgOutFn, reportFl, begMeasNumb, begTempoBPM, svgStandAloneFl, svgPanZoomFl, damperRptFl ) != kOkXsRC )
|
|
113
|
+ if( cmXScoreTest( ctx, xmlFn, editFn, csvOutFn, midiOutFn, svgOutFn, reportFl, begMeasNumb, begTempoBPM, svgStandAloneFl, svgPanZoomFl, damperRptFl ) != kOkXsRC )
|
113
|
114
|
return cmErrMsg(&ctx->err,kScoreGenFailedCtRC,"score_gen failed.");
|
114
|
115
|
|
115
|
116
|
return kOkCtRC;
|
116
|
117
|
}
|
117
|
118
|
|
|
119
|
+cmRC_t score_edit_merge( cmCtx_t* ctx, const cmChar_t* xmlFn, const cmChar_t* editFn, unsigned begMeasNumb, const cmChar_t* keyEditFn, unsigned keyMeasNumb, const cmChar_t* outFn )
|
|
120
|
+{
|
|
121
|
+ cmRC_t rc;
|
|
122
|
+
|
|
123
|
+ if((rc = verify_file_exists(ctx,xmlFn,"XML file")) != kOkCtRC )
|
|
124
|
+ return rc;
|
|
125
|
+
|
|
126
|
+ if((rc = verify_file_exists(ctx,editFn,"reference edit file")) != kOkCtRC )
|
|
127
|
+ return rc;
|
|
128
|
+
|
|
129
|
+ if((rc = verify_file_exists(ctx,editFn,"key edit file")) != kOkCtRC )
|
|
130
|
+ return rc;
|
|
131
|
+
|
|
132
|
+ if( cmXScoreMergeEditFiles( ctx, xmlFn, editFn, begMeasNumb, keyEditFn, keyMeasNumb, outFn ) != kOkXsRC )
|
|
133
|
+ return cmErrMsg(&ctx->err,kScoreEditMergeFailedCtRC,"Score merge failed failed.");
|
|
134
|
+
|
|
135
|
+ return kOkCtRC;
|
|
136
|
+}
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
118
|
140
|
cmRC_t score_follow( cmCtx_t* ctx, const cmChar_t* csvScoreFn, const cmChar_t* midiInFn, const cmChar_t* matchRptOutFn, const cmChar_t* matchSvgOutFn, const cmChar_t* midiOutFn, const cmChar_t* timelineFn )
|
119
|
141
|
{
|
120
|
142
|
cmRC_t rc;
|
|
@@ -215,7 +237,10 @@ int main( int argc, char* argv[] )
|
215
|
237
|
kInvalidPoId = kBasePoId,
|
216
|
238
|
kActionPoId,
|
217
|
239
|
kXmlFileNamePoId,
|
218
|
|
- kDecorateFileNamePoId,
|
|
240
|
+ kEditFileNamePoId,
|
|
241
|
+ kKeyEditFileNamePoId,
|
|
242
|
+ kKeyMeasNumbPoId,
|
|
243
|
+ kOutEditFileNamePoId,
|
219
|
244
|
kCsvOutFileNamePoId,
|
220
|
245
|
kPgmRsrcFileNamePoId,
|
221
|
246
|
kMidiOutFileNamePoId,
|
|
@@ -238,6 +263,7 @@ int main( int argc, char* argv[] )
|
238
|
263
|
enum {
|
239
|
264
|
kNoSelId,
|
240
|
265
|
kScoreGenSelId,
|
|
266
|
+ kScoreEditMergeSelId,
|
241
|
267
|
kScoreFollowSelId,
|
242
|
268
|
kMeasGenSelId,
|
243
|
269
|
kScoreReportSelId,
|
|
@@ -256,7 +282,9 @@ int main( int argc, char* argv[] )
|
256
|
282
|
const cmChar_t* appTitle = "cmtools";
|
257
|
283
|
cmCtx_t ctx;
|
258
|
284
|
const cmChar_t* xmlFn = NULL;
|
259
|
|
- const cmChar_t* decFn = NULL;
|
|
285
|
+ const cmChar_t* editFn = NULL;
|
|
286
|
+ const cmChar_t* keyEditFn = NULL;
|
|
287
|
+ const cmChar_t* outEditFn = NULL;
|
260
|
288
|
const cmChar_t* pgmRsrcFn = NULL;
|
261
|
289
|
const cmChar_t* csvScoreFn = NULL;
|
262
|
290
|
const cmChar_t* midiOutFn = NULL;
|
|
@@ -270,6 +298,7 @@ int main( int argc, char* argv[] )
|
270
|
298
|
unsigned svgStandAloneFl = 1;
|
271
|
299
|
unsigned svgPanZoomFl = 1;
|
272
|
300
|
int begMeasNumb = 0;
|
|
301
|
+ int keyMeasNumb = 0;
|
273
|
302
|
int begTempoBPM = 60;
|
274
|
303
|
unsigned damperRptFl = 0;
|
275
|
304
|
unsigned begMidiUId = cmInvalidId;
|
|
@@ -288,6 +317,9 @@ int main( int argc, char* argv[] )
|
288
|
317
|
|
289
|
318
|
cmPgmOptInstallEnum( poH, kActionPoId, 'S', "score_gen", 0, kScoreGenSelId, kNoSelId, &actionSelId, 1,
|
290
|
319
|
"Run the score generation tool.","Action selector");
|
|
320
|
+
|
|
321
|
+ cmPgmOptInstallEnum( poH, kActionPoId, 'D', "merge_edit", 0, kScoreEditMergeSelId, kNoSelId, &actionSelId, 1,
|
|
322
|
+ "Synchronize and copy the edit information from one edit file into another.","Action selector");
|
291
|
323
|
|
292
|
324
|
cmPgmOptInstallEnum( poH, kActionPoId, 'F', "score_follow", 0, kScoreFollowSelId, kNoSelId, &actionSelId, 1,
|
293
|
325
|
"Run the time line marker generation tool.",NULL);
|
|
@@ -308,12 +340,22 @@ int main( int argc, char* argv[] )
|
308
|
340
|
"Generate an audio file report.",NULL);
|
309
|
341
|
|
310
|
342
|
|
311
|
|
- cmPgmOptInstallStr( poH, kXmlFileNamePoId, 'x', "muisic_xml_fn",0, NULL, &xmlFn, 1,
|
|
343
|
+ cmPgmOptInstallStr( poH, kXmlFileNamePoId, 'x', "music_xml_fn",0, NULL, &xmlFn, 1,
|
312
|
344
|
"Name of the input MusicXML file.");
|
313
|
345
|
|
314
|
|
- cmPgmOptInstallStr( poH, kDecorateFileNamePoId, 'd', "dec_fn", 0, NULL, &decFn, 1,
|
315
|
|
- "Name of a score decoration file.");
|
|
346
|
+ cmPgmOptInstallStr( poH, kEditFileNamePoId, 'd', "edit_fn", 0, NULL, &editFn, 1,
|
|
347
|
+ "Name of a score edit file.");
|
|
348
|
+
|
|
349
|
+ cmPgmOptInstallStr( poH, kKeyEditFileNamePoId, 'k', "key_edit_fn", 0, NULL, &keyEditFn, 1,
|
|
350
|
+ "Name of a score edit key file.");
|
316
|
351
|
|
|
352
|
+ cmPgmOptInstallInt( poH, kKeyMeasNumbPoId, 'q', "key_meas", 0, 1, &keyMeasNumb, 1,
|
|
353
|
+ "Number of the first measure number to merge in the edit key filke (see --key_edit_fn)." );
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+ cmPgmOptInstallStr( poH, kOutEditFileNamePoId, 'o', "out_edit_fn", 0, NULL, &outEditFn, 1,
|
|
357
|
+ "Name of a score edit merge file.");
|
|
358
|
+
|
317
|
359
|
cmPgmOptInstallStr( poH, kCsvOutFileNamePoId, 'c', "score_csv_fn",0, NULL, &csvScoreFn, 1,
|
318
|
360
|
"Name of a CSV score file.");
|
319
|
361
|
|
|
@@ -376,7 +418,11 @@ int main( int argc, char* argv[] )
|
376
|
418
|
switch( actionSelId )
|
377
|
419
|
{
|
378
|
420
|
case kScoreGenSelId:
|
379
|
|
- rc = score_gen( &ctx, xmlFn, decFn, csvScoreFn, midiOutFn, svgOutFn, reportFl, begMeasNumb, begTempoBPM, svgStandAloneFl, svgPanZoomFl, damperRptFl );
|
|
421
|
+ rc = score_gen( &ctx, xmlFn, editFn, csvScoreFn, midiOutFn, svgOutFn, reportFl, begMeasNumb, begTempoBPM, svgStandAloneFl, svgPanZoomFl, damperRptFl );
|
|
422
|
+ break;
|
|
423
|
+
|
|
424
|
+ case kScoreEditMergeSelId:
|
|
425
|
+ rc = score_edit_merge( &ctx, xmlFn, editFn, begMeasNumb, keyEditFn, keyMeasNumb, outEditFn );
|
380
|
426
|
break;
|
381
|
427
|
|
382
|
428
|
case kScoreFollowSelId:
|