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

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