libcm is a C development framework with an emphasis on audio signal processing applications.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

cmMidiFilePlay.h 2.2KB

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