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.

cmTakeSeqBldr.h 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #ifndef cmTakeSeqBldr_h
  2. #define cmTakeSeqBldr_h
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. enum
  7. {
  8. kOkTsbRC = cmOkRC,
  9. kJsonFailTsbRC,
  10. kParseFailTsbRC,
  11. kTimeLineFailTsbRC,
  12. kScoreFailTsbRC,
  13. kInvalidArgTsbRC,
  14. kMidiFileFailTsbRC
  15. };
  16. typedef cmRC_t cmTsbRC_t;
  17. typedef cmHandle_t cmTakeSeqBldrH_t;
  18. extern cmTakeSeqBldrH_t cmTakeSeqBldrNullHandle;
  19. cmTsbRC_t cmTakeSeqBldrAlloc( cmCtx_t* ctx, cmTakeSeqBldrH_t* hp );
  20. cmTsbRC_t cmTakeSeqBldrAllocFn( cmCtx_t* ctx, cmTakeSeqBldrH_t* hp, const cmChar_t* scoreTrkFn );
  21. cmTsbRC_t cmTakeSeqBldrFree( cmTakeSeqBldrH_t* hp );
  22. bool cmTakeSeqBldrIsValid( cmTakeSeqBldrH_t h );
  23. cmTsbRC_t cmTakeSeqBldrInitialize( cmTakeSeqBldrH_t h, const cmChar_t* scoreTrkFn );
  24. // Load a group of notes delinated by a time-line marker into the sequence.
  25. // If notes overlap with existing notes according to their 'scEvtIdx' attribute:
  26. // a. If 'overWriteFl' is set then the incoming overlapped notes are enabled
  27. // and the existing overlapped notes are disabled, otherwise the incoming
  28. // overlapped notes are disabled and the existing notes remain enabled.
  29. // b. The incoming section is time aligned with the first or last existing
  30. // note depending on whether the new section aligns best with the beginning
  31. // or ending of the existing notes.
  32. //
  33. // If no overlapping notes exist then the incoming section is aligned by estimating
  34. // the alignment with existing notes using the score alone.
  35. cmTsbRC_t cmTakeSeqBldrLoadTake( cmTakeSeqBldrH_t h, unsigned tlMarkUid, bool overwriteFL );
  36. cmTsbRC_t cmTakeSeqBldrUnloadTake( cmTakeSeqBldrH_t h, unsigned tlMarkUid );
  37. // Fill in missing notes from the score.
  38. cmTsbRC_t cmTakeSeqBldrInsertScoreNotes( cmTakeSeqBldrH_t h, unsigned begScEvtIdx, unsigned endScEvtId );
  39. cmTsbRC_t cmTakeSeqBldrRemoveScoreNotes( cmTakeSeqBldrH_t h, unsigned begScEvtIdx, unsigned endScEvtId );
  40. //enum { kMarkTsbFl = 0x01, kTlNoteTsbFl=0x02, kScoreNoteTsbFl = 0x04, kPedalTsbFl = 0x08 };
  41. cmTsbRC_t cmTakeSeqBldrSelectEnable( cmTakeSeqBldrH_t h, unsigned flags, unsigned id, bool selectFl );
  42. cmTsbRC_t cmTakeSeqBldrEnableNote( cmTakeSeqBldrH_t h, unsigned ssqId, bool enableFl );
  43. cmTsbRC_t cmTakeSeqBldrMoveNote( cmTakeSeqBldrH_t h, unsigned ssqId, int deltaSmpIdx );
  44. cmTsbRC_t cmTakeSeqBldrWriteMidiFile( cmTakeSeqBldrH_t h, const char* fn );
  45. cmTsbRC_t cmTakeSeqBldrTest( cmCtx_t* ctx );
  46. #ifdef __cplusplus
  47. }
  48. #endif
  49. #endif