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.

cmAudioNrtDev.h 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 cmAudioNrtDev_h
  4. #define cmAudioNrtDev_h
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. //( { file_desc:"Audio device driver which generates the callbacks to run cmAudioPort in a non-real time mode." kw:[audio rt]}
  9. cmApRC_t cmApNrtAllocate( cmRpt_t* rpt );
  10. cmApRC_t cmApNrtFree();
  11. cmApRC_t cmApNrtCreateDevice(
  12. const cmChar_t* label,
  13. double srate,
  14. unsigned iChCnt,
  15. unsigned oChCnt,
  16. unsigned cbPeriodMs );
  17. /// Setup the audio port management object for this machine.
  18. cmApRC_t cmApNrtInitialize( cmRpt_t* rpt, unsigned baseApDevIdx );
  19. /// Stop all audio devices and release any resources held
  20. /// by the audio port management object.
  21. cmApRC_t cmApNrtFinalize();
  22. /// Return the count of audio devices attached to this machine.
  23. unsigned cmApNrtDeviceCount();
  24. /// Get a textual description of the device at index 'devIdx'.
  25. const char* cmApNrtDeviceLabel( unsigned devIdx );
  26. /// Get the count of audio input or output channesl on device at index 'devIdx'.
  27. unsigned cmApNrtDeviceChannelCount( unsigned devIdx, bool inputFl );
  28. /// Get the current sample rate of a device. Note that if the device has both
  29. /// input and output capability then the sample rate is the same for both.
  30. double cmApNrtDeviceSampleRate( unsigned devIdx );
  31. /// Get the count of samples per callback for the input or output for this device.
  32. unsigned cmApNrtDeviceFramesPerCycle( unsigned devIdx, bool inputFl );
  33. /// Configure a device.
  34. cmApRC_t cmApNrtDeviceSetup(
  35. unsigned devIdx,
  36. double srate,
  37. unsigned framesPerCycle,
  38. cmApCallbackPtr_t callbackPtr,
  39. void* userCbPtr );
  40. /// Start a device. Note that the callback may be made prior to this function returning.
  41. cmApRC_t cmApNrtDeviceStart( unsigned devIdx );
  42. /// Stop a device.
  43. cmApRC_t cmApNrtDeviceStop( unsigned devIdx );
  44. /// Return true if the device is currently started.
  45. bool cmApNrtDeviceIsStarted( unsigned devIdx );
  46. //)
  47. #ifdef __cplusplus
  48. }
  49. #endif
  50. #endif