2
0

pa_win_wmme.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. #ifndef PA_WIN_WMME_H
  2. #define PA_WIN_WMME_H
  3. /*
  4. * $Id$
  5. * PortAudio Portable Real-Time Audio Library
  6. * MME 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 WMME-specific PortAudio API extension header file.
  42. */
  43. #include "portaudio.h"
  44. #include "pa_win_waveformat.h"
  45. #ifdef __cplusplus
  46. extern "C"
  47. {
  48. #endif /* __cplusplus */
  49. /* The following are flags which can be set in
  50. PaWinMmeStreamInfo's flags field.
  51. */
  52. #define paWinMmeUseLowLevelLatencyParameters (0x01)
  53. #define paWinMmeUseMultipleDevices (0x02) /* use mme specific multiple device feature */
  54. #define paWinMmeUseChannelMask (0x04)
  55. /* By default, the mme implementation drops the processing thread's priority
  56. to THREAD_PRIORITY_NORMAL and sleeps the thread if the CPU load exceeds 100%
  57. This flag disables any priority throttling. The processing thread will always
  58. run at THREAD_PRIORITY_TIME_CRITICAL.
  59. */
  60. #define paWinMmeDontThrottleOverloadedProcessingThread (0x08)
  61. /* Flags for non-PCM spdif passthrough.
  62. */
  63. #define paWinMmeWaveFormatDolbyAc3Spdif (0x10)
  64. #define paWinMmeWaveFormatWmaSpdif (0x20)
  65. typedef struct PaWinMmeDeviceAndChannelCount{
  66. PaDeviceIndex device;
  67. int channelCount;
  68. }PaWinMmeDeviceAndChannelCount;
  69. typedef struct PaWinMmeStreamInfo{
  70. unsigned long size; /**< sizeof(PaWinMmeStreamInfo) */
  71. PaHostApiTypeId hostApiType; /**< paMME */
  72. unsigned long version; /**< 1 */
  73. unsigned long flags;
  74. /* low-level latency setting support
  75. These settings control the number and size of host buffers in order
  76. to set latency. They will be used instead of the generic parameters
  77. to Pa_OpenStream() if flags contains the PaWinMmeUseLowLevelLatencyParameters
  78. flag.
  79. If PaWinMmeStreamInfo structures with PaWinMmeUseLowLevelLatencyParameters
  80. are supplied for both input and output in a full duplex stream, then the
  81. input and output framesPerBuffer must be the same, or the larger of the
  82. two must be a multiple of the smaller, otherwise a
  83. paIncompatibleHostApiSpecificStreamInfo error will be returned from
  84. Pa_OpenStream().
  85. */
  86. unsigned long framesPerBuffer;
  87. unsigned long bufferCount; /* formerly numBuffers */
  88. /* multiple devices per direction support
  89. If flags contains the PaWinMmeUseMultipleDevices flag,
  90. this functionality will be used, otherwise the device parameter to
  91. Pa_OpenStream() will be used instead.
  92. If devices are specified here, the corresponding device parameter
  93. to Pa_OpenStream() should be set to paUseHostApiSpecificDeviceSpecification,
  94. otherwise an paInvalidDevice error will result.
  95. The total number of channels across all specified devices
  96. must agree with the corresponding channelCount parameter to
  97. Pa_OpenStream() otherwise a paInvalidChannelCount error will result.
  98. */
  99. PaWinMmeDeviceAndChannelCount *devices;
  100. unsigned long deviceCount;
  101. /*
  102. support for WAVEFORMATEXTENSIBLE channel masks. If flags contains
  103. paWinMmeUseChannelMask this allows you to specify which speakers
  104. to address in a multichannel stream. Constants for channelMask
  105. are specified in pa_win_waveformat.h
  106. */
  107. PaWinWaveFormatChannelMask channelMask;
  108. }PaWinMmeStreamInfo;
  109. /** Retrieve the number of wave in handles used by a PortAudio WinMME stream.
  110. Returns zero if the stream is output only.
  111. @return A non-negative value indicating the number of wave in handles
  112. or, a PaErrorCode (which are always negative) if PortAudio is not initialized
  113. or an error is encountered.
  114. @see PaWinMME_GetStreamInputHandle
  115. */
  116. int PaWinMME_GetStreamInputHandleCount( PaStream* stream );
  117. /** Retrieve a wave in handle used by a PortAudio WinMME stream.
  118. @param stream The stream to query.
  119. @param handleIndex The zero based index of the wave in handle to retrieve. This
  120. should be in the range [0, PaWinMME_GetStreamInputHandleCount(stream)-1].
  121. @return A valid wave in handle, or NULL if an error occurred.
  122. @see PaWinMME_GetStreamInputHandle
  123. */
  124. HWAVEIN PaWinMME_GetStreamInputHandle( PaStream* stream, int handleIndex );
  125. /** Retrieve the number of wave out handles used by a PortAudio WinMME stream.
  126. Returns zero if the stream is input only.
  127. @return A non-negative value indicating the number of wave out handles
  128. or, a PaErrorCode (which are always negative) if PortAudio is not initialized
  129. or an error is encountered.
  130. @see PaWinMME_GetStreamOutputHandle
  131. */
  132. int PaWinMME_GetStreamOutputHandleCount( PaStream* stream );
  133. /** Retrieve a wave out handle used by a PortAudio WinMME stream.
  134. @param stream The stream to query.
  135. @param handleIndex The zero based index of the wave out handle to retrieve.
  136. This should be in the range [0, PaWinMME_GetStreamOutputHandleCount(stream)-1].
  137. @return A valid wave out handle, or NULL if an error occurred.
  138. @see PaWinMME_GetStreamOutputHandleCount
  139. */
  140. HWAVEOUT PaWinMME_GetStreamOutputHandle( PaStream* stream, int handleIndex );
  141. #ifdef __cplusplus
  142. }
  143. #endif /* __cplusplus */
  144. #endif /* PA_WIN_WMME_H */