libcm is a C development framework with an emphasis on audio signal processing applications.
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

cmAudioAggDev.h 3.9KB

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