libcm is a C development framework with an emphasis on audio signal processing applications.
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

cmScore.h 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #ifndef cmScore_h
  2. #define cmScore_h
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. enum
  7. {
  8. kOkScRC = cmOkRC,
  9. kCsvFailScRC,
  10. kSyntaxErrScRC,
  11. kInvalidIdxScRC,
  12. kTimeLineFailScRC
  13. };
  14. enum
  15. {
  16. kInvalidEvtScId = 0,
  17. kTimeSigEvtScId,
  18. kKeySigEvtScId,
  19. kTempoEvtScId,
  20. kTrackEvtScId,
  21. kTextEvtScId,
  22. kEOTrackEvtScId,
  23. kCopyEvtScId,
  24. kBlankEvtScId,
  25. kBarEvtScId,
  26. kPgmEvtScId,
  27. kCtlEvtScId,
  28. kNonEvtScId
  29. };
  30. enum
  31. {
  32. kEvenScFl = 0x01, // This note is marked for evenness measurement
  33. kDynScFl = 0x02, // This note is marked for dynamics measurement
  34. kTempoScFl = 0x03, // This note is marked for tempo measurement
  35. kSkipScFl = 0x04 // this isn't a real event (e.g. tied note) skip over it
  36. };
  37. typedef struct
  38. {
  39. unsigned type; // Event type
  40. double dsecs; //
  41. cmMidiByte_t pitch; // MIDI pitch of this note
  42. unsigned flags; // Attribute flags for this event
  43. unsigned dynVal; // Dynamcis value pppp to ffff (1 to 11) for this note.
  44. unsigned barNumb; // bar number of this event
  45. unsigned barNoteIdx; // index of this note in this bar
  46. } cmScoreEvt_t;
  47. typedef void (*cmScCb_t)( void* arg, const void* data, unsigned byteCnt );
  48. typedef cmRC_t cmScRC_t;
  49. typedef cmHandle_t cmScH_t;
  50. typedef void (*cmScCb_t)( void* arg, const void* data, unsigned byteCnt );
  51. extern cmScH_t cmScNullHandle;
  52. const cmChar_t* cmScEvtTypeIdToLabel( unsigned id );
  53. const cmChar_t* cmScDynIdToLabel( unsigned id );
  54. // Initialize a score object from a CSV File generated from a score spreadsheet.
  55. cmScRC_t cmScoreInitialize( cmCtx_t* ctx, cmScH_t* hp, const cmChar_t* fn, cmScCb_t cbFunc, void* cbArg );
  56. cmScRC_t cmScoreFinalize( cmScH_t* hp );
  57. // Filename of last successfuly loaded score file.
  58. const cmChar_t* cmScoreFileName( cmScH_t h );
  59. bool cmScoreIsValid( cmScH_t h );
  60. // Access the score data.
  61. unsigned cmScoreEvtCount( cmScH_t h );
  62. cmScoreEvt_t* cmScoreEvt( cmScH_t h, unsigned idx );
  63. cmScRC_t cmScoreSeqNotify( cmScH_t h );
  64. typedef enum
  65. {
  66. kInvalidMsgScId,
  67. kBeginMsgScId,
  68. kEventMsgScId,
  69. kEndMsgScId
  70. } cmScMsgTypeId_t;
  71. typedef struct
  72. {
  73. cmScMsgTypeId_t typeId;
  74. cmScoreEvt_t evt; // only used when typeId == kEventMsgScId
  75. } cmScMsg_t;
  76. cmScRC_t cmScoreDecode( const void* msg, unsigned msgByteCnt, cmScMsg_t* );
  77. void cmScorePrint( cmScH_t h, cmRpt_t* rpt );
  78. cmScRC_t cmScoreSyncTimeLine( cmScH_t scH, cmTlH_t tlH, unsigned editDistWndCnt, cmReal_t maxNoteOffsetSecs );
  79. cmScRC_t cmScoreSyncTimeLineTest( cmCtx_t* ctx, const cmChar_t* timeLineJsFn, const cmChar_t* scoreCsvFn );
  80. void cmScoreTest( cmCtx_t* ctx, const cmChar_t* fn );
  81. #ifdef __cplusplus
  82. }
  83. #endif
  84. #endif