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.

cmScore.h 2.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 cmRC_t cmScRC_t;
  48. typedef cmHandle_t cmScH_t;
  49. extern cmScH_t cmScNullHandle;
  50. // Initialize a score object from a CSV File generated from a score spreadsheet.
  51. cmScRC_t cmScoreInitialize( cmCtx_t* ctx, cmScH_t* hp, const cmChar_t* fn );
  52. cmScRC_t cmScoreFinalize( cmScH_t* hp );
  53. bool cmScoreIsValid( cmScH_t h );
  54. // Access the score data.
  55. unsigned cmScoreEvtCount( cmScH_t h );
  56. cmScoreEvt_t* cmScoreEvt( cmScH_t h, unsigned idx );
  57. void cmScorePrint( cmScH_t h, cmRpt_t* rpt );
  58. cmScRC_t cmScoreSyncTimeLine( cmScH_t scH, cmTlH_t tlH, unsigned editDistWndCnt, cmReal_t maxNoteOffsetSecs );
  59. cmScRC_t cmScoreSyncTimeLineTest( cmCtx_t* ctx, const cmChar_t* timeLineJsFn, const cmChar_t* scoreCsvFn );
  60. void cmScoreTest( cmCtx_t* ctx, const cmChar_t* fn );
  61. #ifdef __cplusplus
  62. }
  63. #endif
  64. #endif