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.1KB

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