libcm is a C development framework with an emphasis on audio signal processing applications.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cmXScore.h 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #ifndef cmXScore_h
  2. #define cmXScore_h
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. enum
  7. {
  8. kOkXsRC = cmOkRC,
  9. kXmlFailXsRC,
  10. kLHeapFailXsRC,
  11. kSyntaxErrorXsRC,
  12. kCsvFailXsRC,
  13. kUnterminatedTieXsRC,
  14. kUnterminatedSlurXsRC,
  15. kUnterminatedOctaveShiftXsrRC,
  16. kPedalStateErrorXsRc,
  17. kMidiFailXsRC,
  18. kFileFailXsRC,
  19. kSvgFailXsRC,
  20. kOverlapWarnXsRC,
  21. kZeroLengthEventXsRC,
  22. kEventNotFoundXsRC
  23. };
  24. typedef cmRC_t cmXsRC_t;
  25. typedef cmHandle_t cmXsH_t;
  26. extern cmXsH_t cmXsNullHandle;
  27. // Prepare the MusicXML file:
  28. //
  29. // 1) Convert XML to UTF-8:
  30. // a. Change: encoding = 'UTF-16' to encoding='UTF-8'
  31. // b. Emacs C-x <RET> f utf-8 <RET>
  32. // c. Change: <?xml ... encoding = 'UTF-16' to encoding='UTF-8' ...?>
  33. //
  34. // 2) Replace "DoletSibelius Unknown Symbol Index " with "DoletSibelius unknownSymIdx="
  35. //
  36. // Steps 1) and 2) can be automated by in emacs by:
  37. //
  38. // M-x load-file ~/src/emacs/proc_music_xml.el
  39. //
  40. // Initialize an cmXScore object from a Sibelius generated MusicXML file.
  41. // 'editFn' is used to add additional information to the score.
  42. // See cmXScoreGenEditFile()
  43. cmXsRC_t cmXScoreInitialize( cmCtx_t* ctx, cmXsH_t* hp, const cmChar_t* xmlFn, const cmChar_t* editFn, bool damperRptFl );
  44. cmXsRC_t cmXScoreFinalize( cmXsH_t* hp );
  45. bool cmXScoreIsValid( cmXsH_t h );
  46. cmXsRC_t cmXScoreWriteCsv( cmXsH_t h, int beginMeasNumb, const cmChar_t* csvFn );
  47. void cmXScoreReport( cmXsH_t h, cmRpt_t* rpt, bool sortFl );
  48. // Generate a template 'edit file'. This file can be edited by hand to included additional
  49. // information in the score. See the 'editFn' argument to cmXScoreInitialize() for where
  50. // this file is used.
  51. cmXsRC_t cmXScoreGenEditFile( cmCtx_t* ctx, const cmChar_t* xmlFn, const cmChar_t* outFn, bool damperRptFl );
  52. // Generate the CSV file suitable for use by cmScore.
  53. //
  54. // If the file referenced by 'reorderFn' exists then it is used to attach additional
  55. // score information. If it does not then a new edit file is created via an
  56. // internal call to cmXScoreGenEditFile(). This file can then be edited
  57. // to include the additional score file information and passed back by a later
  58. // call to this same function.
  59. // Set reportFl to true to print a report of the score following processing.
  60. // Set begMeasNumb to the first measure the to be written to the output csv, MIDI and SVG files.
  61. // Set begBPM to 0 to use the tempo from the score otherwise set it to the tempo at begMeasNumb.
  62. 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 );
  63. cmXsRC_t cmXScoreMergeEditFiles( cmCtx_t* ctx, const cmChar_t* xmlFn, const cmChar_t* refEditFn, unsigned refBegMeasNumb, const cmChar_t* editFn, unsigned keyMeasNumb, const cmChar_t* outFn );
  64. #ifdef __cplusplus
  65. }
  66. #endif
  67. #endif