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 2.1KB

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