pa_asio.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. #ifndef PA_ASIO_H
  2. #define PA_ASIO_H
  3. /*
  4. * $Id: pa_asio.h 1667 2011-05-02 15:49:20Z rossb $
  5. * PortAudio Portable Real-Time Audio Library
  6. * ASIO specific extensions
  7. *
  8. * Copyright (c) 1999-2000 Ross Bencina and Phil Burk
  9. *
  10. * Permission is hereby granted, free of charge, to any person obtaining
  11. * a copy of this software and associated documentation files
  12. * (the "Software"), to deal in the Software without restriction,
  13. * including without limitation the rights to use, copy, modify, merge,
  14. * publish, distribute, sublicense, and/or sell copies of the Software,
  15. * and to permit persons to whom the Software is furnished to do so,
  16. * subject to the following conditions:
  17. *
  18. * The above copyright notice and this permission notice shall be
  19. * included in all copies or substantial portions of the Software.
  20. *
  21. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  22. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  23. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  24. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
  25. * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
  26. * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  27. * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  28. */
  29. /*
  30. * The text above constitutes the entire PortAudio license; however,
  31. * the PortAudio community also makes the following non-binding requests:
  32. *
  33. * Any person wishing to distribute modifications to the Software is
  34. * requested to send the modifications to the original developer so that
  35. * they can be incorporated into the canonical version. It is also
  36. * requested that these non-binding requests be included along with the
  37. * license above.
  38. */
  39. /** @file
  40. @ingroup public_header
  41. @brief ASIO-specific PortAudio API extension header file.
  42. */
  43. #include "portaudio.h"
  44. #ifdef __cplusplus
  45. extern "C"
  46. {
  47. #endif /* __cplusplus */
  48. /** Retrieve legal native buffer sizes for the specificed device, in sample frames.
  49. @param device The global index of the device about which the query is being made.
  50. @param minBufferSizeFrames A pointer to the location which will receive the minimum buffer size value.
  51. @param maxBufferSizeFrames A pointer to the location which will receive the maximum buffer size value.
  52. @param preferredBufferSizeFrames A pointer to the location which will receive the preferred buffer size value.
  53. @param granularity A pointer to the location which will receive the "granularity". This value determines
  54. the step size used to compute the legal values between minBufferSizeFrames and maxBufferSizeFrames.
  55. If granularity is -1 then available buffer size values are powers of two.
  56. @see ASIOGetBufferSize in the ASIO SDK.
  57. @note: this function used to be called PaAsio_GetAvailableLatencyValues. There is a
  58. #define that maps PaAsio_GetAvailableLatencyValues to this function for backwards compatibility.
  59. */
  60. PaError PaAsio_GetAvailableBufferSizes( PaDeviceIndex device,
  61. long *minBufferSizeFrames, long *maxBufferSizeFrames, long *preferredBufferSizeFrames, long *granularity );
  62. /** Backwards compatibility alias for PaAsio_GetAvailableBufferSizes
  63. @see PaAsio_GetAvailableBufferSizes
  64. */
  65. #define PaAsio_GetAvailableLatencyValues PaAsio_GetAvailableBufferSizes
  66. /** Display the ASIO control panel for the specified device.
  67. @param device The global index of the device whose control panel is to be displayed.
  68. @param systemSpecific On Windows, the calling application's main window handle,
  69. on Macintosh this value should be zero.
  70. */
  71. PaError PaAsio_ShowControlPanel( PaDeviceIndex device, void* systemSpecific );
  72. /** Retrieve a pointer to a string containing the name of the specified
  73. input channel. The string is valid until Pa_Terminate is called.
  74. The string will be no longer than 32 characters including the null terminator.
  75. */
  76. PaError PaAsio_GetInputChannelName( PaDeviceIndex device, int channelIndex,
  77. const char** channelName );
  78. /** Retrieve a pointer to a string containing the name of the specified
  79. input channel. The string is valid until Pa_Terminate is called.
  80. The string will be no longer than 32 characters including the null terminator.
  81. */
  82. PaError PaAsio_GetOutputChannelName( PaDeviceIndex device, int channelIndex,
  83. const char** channelName );
  84. /** Set the sample rate of an open paASIO stream.
  85. @param stream The stream to operate on.
  86. @param sampleRate The new sample rate.
  87. Note that this function may fail if the stream is alredy running and the
  88. ASIO driver does not support switching the sample rate of a running stream.
  89. Returns paIncompatibleStreamHostApi if stream is not a paASIO stream.
  90. */
  91. PaError PaAsio_SetStreamSampleRate( PaStream* stream, double sampleRate );
  92. #define paAsioUseChannelSelectors (0x01)
  93. typedef struct PaAsioStreamInfo{
  94. unsigned long size; /**< sizeof(PaAsioStreamInfo) */
  95. PaHostApiTypeId hostApiType; /**< paASIO */
  96. unsigned long version; /**< 1 */
  97. unsigned long flags;
  98. /* Support for opening only specific channels of an ASIO device.
  99. If the paAsioUseChannelSelectors flag is set, channelSelectors is a
  100. pointer to an array of integers specifying the device channels to use.
  101. When used, the length of the channelSelectors array must match the
  102. corresponding channelCount parameter to Pa_OpenStream() otherwise a
  103. crash may result.
  104. The values in the selectors array must specify channels within the
  105. range of supported channels for the device or paInvalidChannelCount will
  106. result.
  107. */
  108. int *channelSelectors;
  109. }PaAsioStreamInfo;
  110. #ifdef __cplusplus
  111. }
  112. #endif /* __cplusplus */
  113. #endif /* PA_ASIO_H */