libcm is a C development framework with an emphasis on audio signal processing applications.
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

cmAudioAggDev.h 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. #ifndef cmAudioAggDev_h
  2. #define cmAudioAggDev_h
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. enum
  7. {
  8. kOkAgRC = cmOkRC,
  9. kMustAggTwoAgRC,
  10. kCantUseStartedDevAgRC,
  11. kDevAlreadyAggAgRC,
  12. kInvalidDevIdxAgRC,
  13. kPhysDevSetupFailAgRC,
  14. kPhysDevStartFailAgRC,
  15. kPhysDevStopFailAgRC
  16. };
  17. typedef cmRC_t cmAgRC_t;
  18. /// Allocate/free the aggregate device management system
  19. cmAgRC_t cmApAggAllocate( cmRpt_t* rpt );
  20. cmAgRC_t cmApAggFree();
  21. /// Called by cmAudioPort() driver to notify the aggregate device
  22. /// system that the hardware ports have been initialized.
  23. /// Setup the aggregate audio device management object for this machine.
  24. cmAgRC_t cmApAggInitialize( cmRpt_t* rpt, unsigned baseApDevIdx );
  25. /// Called by cmAudioPort() driver to notify the aggregate device
  26. /// system that the hardware ports have been finalized.
  27. /// Stop all aggregate audio devices and release any resources held
  28. /// by the agg. audio dev. management object.
  29. cmAgRC_t cmApAggFinalize();
  30. /// Create an aggregate device from physical devices.
  31. /// Set flags to kInApFl, kOutApFl or both to indicate whether the
  32. /// device should aggregate input audio, output audio or both.
  33. enum { kInAggFl = 0x01, kOutAggFl = 0x02 };
  34. cmAgRC_t cmApAggCreateDevice(
  35. const cmChar_t* label,
  36. unsigned devCnt,
  37. const unsigned physDevIdxArray[],
  38. unsigned flags );
  39. // Return true if the specified physical device is included
  40. // in an aggregated device.
  41. bool cmApAggIsDeviceAggregated( unsigned physDevIdx );
  42. /// Return the count of aggregate audio devices attached to this machine.
  43. cmAgRC_t cmApAggDeviceCount();
  44. /// Get a textual description of the device at index 'aggDevIdx'.
  45. const char* cmApAggDeviceLabel( unsigned aggDevIdx );
  46. /// Get the count of audio input or output channels on device at index 'aggDevIdx'.
  47. unsigned cmApAggDeviceChannelCount( unsigned aggDevIdx, bool inputFl );
  48. /// Get the current sample rate of a device. Note that if the device has both
  49. /// input and output capability then the sample rate is the same for both.
  50. double cmApAggDeviceSampleRate( unsigned aggDevIdx );
  51. /// Get the count of samples per callback for the input or output for this device.
  52. unsigned cmApAggDeviceFramesPerCycle( unsigned aggDevIdx, bool inputFl );
  53. /// Configure a device.
  54. /// All devices must be setup before they are started.
  55. /// framesPerCycle is the requested number of samples per audio callback. The
  56. /// actual number of samples made from a callback may be smaller. See the note
  57. /// regarding this in cmApAggAudioPacket_t.
  58. /// If the device cannot support the requested configuration then the function
  59. /// will return an error code.
  60. /// If the device is started when this function is called then it will be
  61. /// automatically stopped and then restarted following the reconfiguration.
  62. /// If the reconfiguration fails then the device may not be restared.
  63. cmAgRC_t cmApAggDeviceSetup(
  64. unsigned aggDevIdx,
  65. double srate,
  66. unsigned framesPerCycle,
  67. cmApCallbackPtr_t callbackPtr,
  68. void* userCbPtr );
  69. /// Start a device. Note that the callback may be made prior to this function returning.
  70. cmAgRC_t cmApAggDeviceStart( unsigned aggDevIdx );
  71. /// Stop a device.
  72. cmAgRC_t cmApAggDeviceStop( unsigned aggDevIdx );
  73. /// Return true if the device is currently started.
  74. bool cmApAggDeviceIsStarted( unsigned aggDevIdx );
  75. int cmApAggTest( bool runFl, cmCtx_t* ctx, int argc, const char* argv[] );
  76. #ifdef __cplusplus
  77. }
  78. #endif
  79. #endif