libcm is a C development framework with an emphasis on audio signal processing applications.
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

cmAudioAggDev.h 3.8KB

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