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.

cmAudioFileDev.h 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 cmAudioFileDev_h
  4. #define cmAudioFileDev_h
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. //( { file_desc:"Implements cmAudioFileDev for reading and writing audio files under control of cmAudioPort.", kw:[audio file rt]}
  9. enum
  10. {
  11. kOkAfdRC = cmOkRC,
  12. kAudioFileFailAfdRC,
  13. kThreadFailAfdRC,
  14. kRestartFailAfdRC
  15. };
  16. typedef unsigned cmAfdRC_t;
  17. typedef cmHandle_t cmAfdH_t;
  18. extern cmAfdH_t cmAfdNullHandle;
  19. /// Initialize an audio file device.
  20. /// Called by cmApPortInitialize().
  21. cmAfdRC_t cmAudioFileDevInitialize(
  22. cmAfdH_t* hp,
  23. const cmChar_t* label,
  24. unsigned devIdx,
  25. const cmChar_t* iFn,
  26. const cmChar_t* oFn,
  27. unsigned oBits,
  28. unsigned oChCnt,
  29. cmRpt_t* rpt );
  30. /// Finalize an audio file device.
  31. /// Called by cmApPortFinalize().
  32. cmAfdRC_t cmAudioFileDevFinalize( cmAfdH_t* hp );
  33. /// Return true if 'h' represents a successfully initialized audio file device.
  34. bool cmAudioFileDevIsValid( cmAfdH_t h );
  35. /// Setup the device. This function must be called prior to cmAudioFileDevStart().
  36. cmAfdRC_t cmAudioFileDevSetup(
  37. cmAfdH_t h,
  38. unsigned baseApDevIdx,
  39. double srate,
  40. unsigned framesPerCycle,
  41. cmApCallbackPtr_t callbackPtr,
  42. void* cbDataPtr );
  43. /// Return a device label.
  44. const char* cmAudioFileDevLabel( cmAfdH_t h );
  45. /// Return a channel count.
  46. unsigned cmAudioFileDevChannelCount( cmAfdH_t h, bool inputFl );
  47. /// Return the sample rate.
  48. double cmAudioFileDevSampleRate( cmAfdH_t h );
  49. /// Return frames per cycle.
  50. unsigned cmAudioFileDevFramesPerCycle( cmAfdH_t h, bool inputFl );
  51. /// Rewind the input file.
  52. cmAfdRC_t cmAudioFileDevRewind( cmAfdH_t h );
  53. /// Start the file device playing/recording.
  54. cmAfdRC_t cmAudioFileDevStart( cmAfdH_t h );
  55. /// Stop the file device playing/recording.
  56. cmAfdRC_t cmAudioFileDevStop( cmAfdH_t h );
  57. /// Return true if the file device is currently started.
  58. bool cmAudioFileDevIsStarted( cmAfdH_t h );
  59. ///
  60. void cmAudioFileDevReport( cmAfdH_t h, cmRpt_t* rpt );
  61. void cmAudioFileDevTest( cmRpt_t* rpt );
  62. //)
  63. #ifdef __cplusplus
  64. }
  65. #endif
  66. #endif