libcm is a C development framework with an emphasis on audio signal processing applications.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

cmXScore.h 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. //| Copyright: (C) 2009-2020 Kevin Larke <contact AT larke DOT org>
  2. //| License: GNU GPL version 3.0 or above. See the accompanying LICENSE file.
  3. #ifndef cmXScore_h
  4. #define cmXScore_h
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. //( { file_desc:"Process a Music XML score in a variety of ways." kw[score] }
  9. //$
  10. // cmScoreTest() performs a the following functions:
  11. // - Parses Music XML files into a text (edit) file.
  12. // - The 'edit' file can then be manually edited to modify and add information to the score.
  13. // - The modified 'edit' file can then be used to generate a CSV file
  14. // suitable for use with cmScore(), a MIDI file which can render the modified score,
  15. // and a SVG file which will display the score as a piano roll.
  16. //
  17. enum
  18. {
  19. kOkXsRC = cmOkRC,
  20. kXmlFailXsRC,
  21. kLHeapFailXsRC,
  22. kSyntaxErrorXsRC,
  23. kCsvFailXsRC,
  24. kUnterminatedTieXsRC,
  25. kUnterminatedSlurXsRC,
  26. kUnterminatedOctaveShiftXsrRC,
  27. kPedalStateErrorXsRc,
  28. kMidiFailXsRC,
  29. kFileFailXsRC,
  30. kSvgFailXsRC,
  31. kOverlapWarnXsRC,
  32. kZeroLengthEventXsRC,
  33. kEventNotFoundXsRC
  34. };
  35. typedef cmRC_t cmXsRC_t;
  36. typedef cmHandle_t cmXsH_t;
  37. extern cmXsH_t cmXsNullHandle;
  38. // Prepare the MusicXML file:
  39. //
  40. // 1) Convert XML to UTF-8:
  41. // a. Change: encoding = 'UTF-16' to encoding='UTF-8'
  42. // b. Emacs C-x <RET> f utf-8 <RET>
  43. // c. Change: <?xml ... encoding = 'UTF-16' to encoding='UTF-8' ...?>
  44. //
  45. // 2) Replace "DoletSibelius Unknown Symbol Index " with "DoletSibelius unknownSymIdx="
  46. //
  47. // Steps 1) and 2) can be automated by in emacs by:
  48. //
  49. // M-x load-file ~/src/emacs/proc_music_xml.el
  50. //
  51. // Initialize an cmXScore object from a Sibelius generated MusicXML file.
  52. // 'editFn' is used to add additional information to the score.
  53. // See cmXScoreGenEditFile()
  54. cmXsRC_t cmXScoreInitialize( cmCtx_t* ctx, cmXsH_t* hp, const cmChar_t* xmlFn, const cmChar_t* editFn, bool damperRptFl );
  55. cmXsRC_t cmXScoreFinalize( cmXsH_t* hp );
  56. bool cmXScoreIsValid( cmXsH_t h );
  57. cmXsRC_t cmXScoreWriteCsv( cmXsH_t h, int beginMeasNumb, const cmChar_t* csvFn );
  58. void cmXScoreReport( cmXsH_t h, cmRpt_t* rpt, bool sortFl );
  59. // Generate a template 'edit file'. This file can be edited by hand to included additional
  60. // information in the score. See the 'editFn' argument to cmXScoreInitialize() for where
  61. // this file is used.
  62. cmXsRC_t cmXScoreGenEditFile( cmCtx_t* ctx, const cmChar_t* xmlFn, const cmChar_t* outFn, bool damperRptFl );
  63. // Generate the CSV file suitable for use by cmScore.
  64. //
  65. // If the file referenced by 'reorderFn' exists then it is used to attach additional
  66. // score information. If it does not then a new edit file is created via an
  67. // internal call to cmXScoreGenEditFile(). This file can then be edited
  68. // to include the additional score file information and passed back by a later
  69. // call to this same function.
  70. // Set reportFl to true to print a report of the score following processing.
  71. // Set begMeasNumb to the first measure the to be written to the output csv, MIDI and SVG files.
  72. // Set begBPM to 0 to use the tempo from the score otherwise set it to the tempo at begMeasNumb.
  73. 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 );
  74. 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 );
  75. //)
  76. #ifdef __cplusplus
  77. }
  78. #endif
  79. #endif