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.

cmMidiFilePlay.h 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #ifndef midiFilePlay_h
  2. #define midiFilePlay_h
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. typedef cmHandle_t cmMfpH_t;
  7. typedef cmRC_t cmMfpRC_t;
  8. typedef void (*cmMfpCallback_t)( void* userCbPtr, unsigned dmicros, const cmMidiTrackMsg_t* msgPtr );
  9. enum
  10. {
  11. kOkMfpRC = cmOkRC, // 0
  12. kInvalidHandleMfpRC, // 1
  13. kFileOpenFailMfpRC, // 2
  14. kInvalidFileMfpRC, // 3
  15. kMemAllocFailMfpRC, // 4
  16. kSmpteTickNotImpleMfpRC, // 5
  17. kEndOfFileMfpRC, // 6
  18. kSmpteTickNotImplMfpRC // 7
  19. };
  20. extern cmMfpH_t cmMfpNullHandle;
  21. cmMfpRC_t cmMfpCreate( cmMfpH_t* hp, cmMfpCallback_t cbFunc, void* userCbPtr, cmCtx_t* ctx );
  22. cmMfpRC_t cmMfpDestroy( cmMfpH_t* hp );
  23. bool cmMfpIsValid( cmMfpH_t h );
  24. // Load a MIDI file into the player. This MIDI file will be automatically
  25. // closed when a new file is loaded at a later time or the MIDI file player handle is destroyed.
  26. cmMfpRC_t cmMfpLoadFile( cmMfpH_t h, const char* fn );
  27. // Load a MIDI file into the player using a file owned by the host.
  28. // This file will NOT be closed when a new file is loaded at a later time
  29. // or the MIDI file player handle is destroyed.
  30. cmMfpRC_t cmMfpLoadHandle( cmMfpH_t h, cmMidiFileH_t mfH );
  31. // Reset the play position of the player to an offset in microseconds from
  32. // the beginning of the file. If there are no message at or after 'offsMicrosecs'
  33. // then the function will return kEndOfFileMfpRC.
  34. cmMfpRC_t cmMfpSeek( cmMfpH_t h, unsigned offsMicrosecs );
  35. // This is the driving clock call for the player. 'deltaMicroSecs' is the
  36. // elapsed time in microseconds since the last call to this function.
  37. // Call to 'cbFunc', as set in by cmMfpCreate() occur from this function.
  38. cmMfpRC_t cmMfpClock( cmMfpH_t h, unsigned deltaMicroSecs );
  39. cmMfpRC_t cmMfpTest( const char* fn, cmCtx_t* ctx );
  40. cmRC_t cmMfpTest2( const char* midiFn, const char* audioFn, cmCtx_t* ctx );
  41. #ifdef __cplusplus
  42. }
  43. #endif
  44. #endif