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 2.7KB

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