Chris@60
|
1 #ifndef PA_WIN_WASAPI_H
|
Chris@60
|
2 #define PA_WIN_WASAPI_H
|
Chris@60
|
3 /*
|
Chris@60
|
4 * $Id: $
|
Chris@60
|
5 * PortAudio Portable Real-Time Audio Library
|
Chris@60
|
6 * DirectSound specific extensions
|
Chris@60
|
7 *
|
Chris@60
|
8 * Copyright (c) 1999-2007 Ross Bencina and Phil Burk
|
Chris@60
|
9 *
|
Chris@60
|
10 * Permission is hereby granted, free of charge, to any person obtaining
|
Chris@60
|
11 * a copy of this software and associated documentation files
|
Chris@60
|
12 * (the "Software"), to deal in the Software without restriction,
|
Chris@60
|
13 * including without limitation the rights to use, copy, modify, merge,
|
Chris@60
|
14 * publish, distribute, sublicense, and/or sell copies of the Software,
|
Chris@60
|
15 * and to permit persons to whom the Software is furnished to do so,
|
Chris@60
|
16 * subject to the following conditions:
|
Chris@60
|
17 *
|
Chris@60
|
18 * The above copyright notice and this permission notice shall be
|
Chris@60
|
19 * included in all copies or substantial portions of the Software.
|
Chris@60
|
20 *
|
Chris@60
|
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
Chris@60
|
22 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
Chris@60
|
23 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
Chris@60
|
24 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
Chris@60
|
25 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
Chris@60
|
26 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
Chris@60
|
27 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
Chris@60
|
28 */
|
Chris@60
|
29
|
Chris@60
|
30 /*
|
Chris@60
|
31 * The text above constitutes the entire PortAudio license; however,
|
Chris@60
|
32 * the PortAudio community also makes the following non-binding requests:
|
Chris@60
|
33 *
|
Chris@60
|
34 * Any person wishing to distribute modifications to the Software is
|
Chris@60
|
35 * requested to send the modifications to the original developer so that
|
Chris@60
|
36 * they can be incorporated into the canonical version. It is also
|
Chris@60
|
37 * requested that these non-binding requests be included along with the
|
Chris@60
|
38 * license above.
|
Chris@60
|
39 */
|
Chris@60
|
40
|
Chris@60
|
41 /** @file
|
Chris@60
|
42 @ingroup public_header
|
Chris@60
|
43 @brief WASAPI-specific PortAudio API extension header file.
|
Chris@60
|
44 */
|
Chris@60
|
45
|
Chris@60
|
46 #include "portaudio.h"
|
Chris@60
|
47 #include "pa_win_waveformat.h"
|
Chris@60
|
48
|
Chris@60
|
49 #ifdef __cplusplus
|
Chris@60
|
50 extern "C"
|
Chris@60
|
51 {
|
Chris@60
|
52 #endif /* __cplusplus */
|
Chris@60
|
53
|
Chris@60
|
54
|
Chris@60
|
55 /* Setup flags */
|
Chris@60
|
56 typedef enum PaWasapiFlags
|
Chris@60
|
57 {
|
Chris@60
|
58 /* puts WASAPI into exclusive mode */
|
Chris@60
|
59 paWinWasapiExclusive = (1 << 0),
|
Chris@60
|
60
|
Chris@60
|
61 /* allows to skip internal PA processing completely */
|
Chris@60
|
62 paWinWasapiRedirectHostProcessor = (1 << 1),
|
Chris@60
|
63
|
Chris@60
|
64 /* assigns custom channel mask */
|
Chris@60
|
65 paWinWasapiUseChannelMask = (1 << 2),
|
Chris@60
|
66
|
Chris@60
|
67 /* selects non-Event driven method of data read/write
|
Chris@60
|
68 Note: WASAPI Event driven core is capable of 2ms latency!!!, but Polling
|
Chris@60
|
69 method can only provide 15-20ms latency. */
|
Chris@60
|
70 paWinWasapiPolling = (1 << 3),
|
Chris@60
|
71
|
Chris@60
|
72 /* forces custom thread priority setting, must be used if PaWasapiStreamInfo::threadPriority
|
Chris@60
|
73 is set to a custom value */
|
Chris@60
|
74 paWinWasapiThreadPriority = (1 << 4)
|
Chris@60
|
75 }
|
Chris@60
|
76 PaWasapiFlags;
|
Chris@60
|
77 #define paWinWasapiExclusive (paWinWasapiExclusive)
|
Chris@60
|
78 #define paWinWasapiRedirectHostProcessor (paWinWasapiRedirectHostProcessor)
|
Chris@60
|
79 #define paWinWasapiUseChannelMask (paWinWasapiUseChannelMask)
|
Chris@60
|
80 #define paWinWasapiPolling (paWinWasapiPolling)
|
Chris@60
|
81 #define paWinWasapiThreadPriority (paWinWasapiThreadPriority)
|
Chris@60
|
82
|
Chris@60
|
83
|
Chris@60
|
84 /* Host processor. Allows to skip internal PA processing completely.
|
Chris@60
|
85 You must set paWinWasapiRedirectHostProcessor flag to PaWasapiStreamInfo::flags member
|
Chris@60
|
86 in order to have host processor redirected to your callback.
|
Chris@60
|
87 Use with caution! inputFrames and outputFrames depend solely on final device setup.
|
Chris@60
|
88 To query maximal values of inputFrames/outputFrames use PaWasapi_GetFramesPerHostBuffer.
|
Chris@60
|
89 */
|
Chris@60
|
90 typedef void (*PaWasapiHostProcessorCallback) (void *inputBuffer, long inputFrames,
|
Chris@60
|
91 void *outputBuffer, long outputFrames,
|
Chris@60
|
92 void *userData);
|
Chris@60
|
93
|
Chris@60
|
94 /* Device role. */
|
Chris@60
|
95 typedef enum PaWasapiDeviceRole
|
Chris@60
|
96 {
|
Chris@60
|
97 eRoleRemoteNetworkDevice = 0,
|
Chris@60
|
98 eRoleSpeakers,
|
Chris@60
|
99 eRoleLineLevel,
|
Chris@60
|
100 eRoleHeadphones,
|
Chris@60
|
101 eRoleMicrophone,
|
Chris@60
|
102 eRoleHeadset,
|
Chris@60
|
103 eRoleHandset,
|
Chris@60
|
104 eRoleUnknownDigitalPassthrough,
|
Chris@60
|
105 eRoleSPDIF,
|
Chris@60
|
106 eRoleHDMI,
|
Chris@60
|
107 eRoleUnknownFormFactor
|
Chris@60
|
108 }
|
Chris@60
|
109 PaWasapiDeviceRole;
|
Chris@60
|
110
|
Chris@60
|
111
|
Chris@60
|
112 /* Jack connection type. */
|
Chris@60
|
113 typedef enum PaWasapiJackConnectionType
|
Chris@60
|
114 {
|
Chris@60
|
115 eJackConnTypeUnknown,
|
Chris@60
|
116 eJackConnType3Point5mm,
|
Chris@60
|
117 eJackConnTypeQuarter,
|
Chris@60
|
118 eJackConnTypeAtapiInternal,
|
Chris@60
|
119 eJackConnTypeRCA,
|
Chris@60
|
120 eJackConnTypeOptical,
|
Chris@60
|
121 eJackConnTypeOtherDigital,
|
Chris@60
|
122 eJackConnTypeOtherAnalog,
|
Chris@60
|
123 eJackConnTypeMultichannelAnalogDIN,
|
Chris@60
|
124 eJackConnTypeXlrProfessional,
|
Chris@60
|
125 eJackConnTypeRJ11Modem,
|
Chris@60
|
126 eJackConnTypeCombination
|
Chris@60
|
127 }
|
Chris@60
|
128 PaWasapiJackConnectionType;
|
Chris@60
|
129
|
Chris@60
|
130
|
Chris@60
|
131 /* Jack geometric location. */
|
Chris@60
|
132 typedef enum PaWasapiJackGeoLocation
|
Chris@60
|
133 {
|
Chris@60
|
134 eJackGeoLocUnk = 0,
|
Chris@60
|
135 eJackGeoLocRear = 0x1, /* matches EPcxGeoLocation::eGeoLocRear */
|
Chris@60
|
136 eJackGeoLocFront,
|
Chris@60
|
137 eJackGeoLocLeft,
|
Chris@60
|
138 eJackGeoLocRight,
|
Chris@60
|
139 eJackGeoLocTop,
|
Chris@60
|
140 eJackGeoLocBottom,
|
Chris@60
|
141 eJackGeoLocRearPanel,
|
Chris@60
|
142 eJackGeoLocRiser,
|
Chris@60
|
143 eJackGeoLocInsideMobileLid,
|
Chris@60
|
144 eJackGeoLocDrivebay,
|
Chris@60
|
145 eJackGeoLocHDMI,
|
Chris@60
|
146 eJackGeoLocOutsideMobileLid,
|
Chris@60
|
147 eJackGeoLocATAPI,
|
Chris@60
|
148 eJackGeoLocReserved5,
|
Chris@60
|
149 eJackGeoLocReserved6,
|
Chris@60
|
150 }
|
Chris@60
|
151 PaWasapiJackGeoLocation;
|
Chris@60
|
152
|
Chris@60
|
153
|
Chris@60
|
154 /* Jack general location. */
|
Chris@60
|
155 typedef enum PaWasapiJackGenLocation
|
Chris@60
|
156 {
|
Chris@60
|
157 eJackGenLocPrimaryBox = 0,
|
Chris@60
|
158 eJackGenLocInternal,
|
Chris@60
|
159 eJackGenLocSeparate,
|
Chris@60
|
160 eJackGenLocOther
|
Chris@60
|
161 }
|
Chris@60
|
162 PaWasapiJackGenLocation;
|
Chris@60
|
163
|
Chris@60
|
164
|
Chris@60
|
165 /* Jack's type of port. */
|
Chris@60
|
166 typedef enum PaWasapiJackPortConnection
|
Chris@60
|
167 {
|
Chris@60
|
168 eJackPortConnJack = 0,
|
Chris@60
|
169 eJackPortConnIntegratedDevice,
|
Chris@60
|
170 eJackPortConnBothIntegratedAndJack,
|
Chris@60
|
171 eJackPortConnUnknown
|
Chris@60
|
172 }
|
Chris@60
|
173 PaWasapiJackPortConnection;
|
Chris@60
|
174
|
Chris@60
|
175
|
Chris@60
|
176 /* Thread priority. */
|
Chris@60
|
177 typedef enum PaWasapiThreadPriority
|
Chris@60
|
178 {
|
Chris@60
|
179 eThreadPriorityNone = 0,
|
Chris@60
|
180 eThreadPriorityAudio, //!< Default for Shared mode.
|
Chris@60
|
181 eThreadPriorityCapture,
|
Chris@60
|
182 eThreadPriorityDistribution,
|
Chris@60
|
183 eThreadPriorityGames,
|
Chris@60
|
184 eThreadPriorityPlayback,
|
Chris@60
|
185 eThreadPriorityProAudio, //!< Default for Exclusive mode.
|
Chris@60
|
186 eThreadPriorityWindowManager
|
Chris@60
|
187 }
|
Chris@60
|
188 PaWasapiThreadPriority;
|
Chris@60
|
189
|
Chris@60
|
190
|
Chris@60
|
191 /* Stream descriptor. */
|
Chris@60
|
192 typedef struct PaWasapiJackDescription
|
Chris@60
|
193 {
|
Chris@60
|
194 unsigned long channelMapping;
|
Chris@60
|
195 unsigned long color; /* derived from macro: #define RGB(r,g,b) ((COLORREF)(((BYTE)(r)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(b))<<16))) */
|
Chris@60
|
196 PaWasapiJackConnectionType connectionType;
|
Chris@60
|
197 PaWasapiJackGeoLocation geoLocation;
|
Chris@60
|
198 PaWasapiJackGenLocation genLocation;
|
Chris@60
|
199 PaWasapiJackPortConnection portConnection;
|
Chris@60
|
200 unsigned int isConnected;
|
Chris@60
|
201 }
|
Chris@60
|
202 PaWasapiJackDescription;
|
Chris@60
|
203
|
Chris@60
|
204
|
Chris@60
|
205 /** Stream category.
|
Chris@60
|
206 Note:
|
Chris@60
|
207 - values are equal to WASAPI AUDIO_STREAM_CATEGORY enum
|
Chris@60
|
208 - supported since Windows 8.0, noop on earler versions
|
Chris@60
|
209 - values 1,2 are deprecated on Windows 10 and not included into enumeration
|
Chris@60
|
210
|
Chris@60
|
211 @version Available as of 19.6.0
|
Chris@60
|
212 */
|
Chris@60
|
213 typedef enum PaWasapiStreamCategory
|
Chris@60
|
214 {
|
Chris@60
|
215 eAudioCategoryOther = 0,
|
Chris@60
|
216 eAudioCategoryCommunications = 3,
|
Chris@60
|
217 eAudioCategoryAlerts = 4,
|
Chris@60
|
218 eAudioCategorySoundEffects = 5,
|
Chris@60
|
219 eAudioCategoryGameEffects = 6,
|
Chris@60
|
220 eAudioCategoryGameMedia = 7,
|
Chris@60
|
221 eAudioCategoryGameChat = 8,
|
Chris@60
|
222 eAudioCategorySpeech = 9,
|
Chris@60
|
223 eAudioCategoryMovie = 10,
|
Chris@60
|
224 eAudioCategoryMedia = 11
|
Chris@60
|
225 }
|
Chris@60
|
226 PaWasapiStreamCategory;
|
Chris@60
|
227
|
Chris@60
|
228
|
Chris@60
|
229 /** Stream option.
|
Chris@60
|
230 Note:
|
Chris@60
|
231 - values are equal to WASAPI AUDCLNT_STREAMOPTIONS enum
|
Chris@60
|
232 - supported since Windows 8.1, noop on earler versions
|
Chris@60
|
233
|
Chris@60
|
234 @version Available as of 19.6.0
|
Chris@60
|
235 */
|
Chris@60
|
236 typedef enum PaWasapiStreamOption
|
Chris@60
|
237 {
|
Chris@60
|
238 eStreamOptionNone = 0, //!< default
|
Chris@60
|
239 eStreamOptionRaw = 1, //!< bypass WASAPI Audio Engine DSP effects, supported since Windows 8.1
|
Chris@60
|
240 eStreamOptionMatchFormat = 2 //!< force WASAPI Audio Engine into a stream format, supported since Windows 10
|
Chris@60
|
241 }
|
Chris@60
|
242 PaWasapiStreamOption;
|
Chris@60
|
243
|
Chris@60
|
244
|
Chris@60
|
245 /* Stream descriptor. */
|
Chris@60
|
246 typedef struct PaWasapiStreamInfo
|
Chris@60
|
247 {
|
Chris@60
|
248 unsigned long size; /**< sizeof(PaWasapiStreamInfo) */
|
Chris@60
|
249 PaHostApiTypeId hostApiType; /**< paWASAPI */
|
Chris@60
|
250 unsigned long version; /**< 1 */
|
Chris@60
|
251
|
Chris@60
|
252 unsigned long flags; /**< collection of PaWasapiFlags */
|
Chris@60
|
253
|
Chris@60
|
254 /** Support for WAVEFORMATEXTENSIBLE channel masks. If flags contains
|
Chris@60
|
255 paWinWasapiUseChannelMask this allows you to specify which speakers
|
Chris@60
|
256 to address in a multichannel stream. Constants for channelMask
|
Chris@60
|
257 are specified in pa_win_waveformat.h. Will be used only if
|
Chris@60
|
258 paWinWasapiUseChannelMask flag is specified.
|
Chris@60
|
259 */
|
Chris@60
|
260 PaWinWaveFormatChannelMask channelMask;
|
Chris@60
|
261
|
Chris@60
|
262 /** Delivers raw data to callback obtained from GetBuffer() methods skipping
|
Chris@60
|
263 internal PortAudio processing inventory completely. userData parameter will
|
Chris@60
|
264 be the same that was passed to Pa_OpenStream method. Will be used only if
|
Chris@60
|
265 paWinWasapiRedirectHostProcessor flag is specified.
|
Chris@60
|
266 */
|
Chris@60
|
267 PaWasapiHostProcessorCallback hostProcessorOutput;
|
Chris@60
|
268 PaWasapiHostProcessorCallback hostProcessorInput;
|
Chris@60
|
269
|
Chris@60
|
270 /** Specifies thread priority explicitly. Will be used only if paWinWasapiThreadPriority flag
|
Chris@60
|
271 is specified.
|
Chris@60
|
272
|
Chris@60
|
273 Please note, if Input/Output streams are opened simultaniously (Full-Duplex mode)
|
Chris@60
|
274 you shall specify same value for threadPriority or othervise one of the values will be used
|
Chris@60
|
275 to setup thread priority.
|
Chris@60
|
276 */
|
Chris@60
|
277 PaWasapiThreadPriority threadPriority;
|
Chris@60
|
278
|
Chris@60
|
279 /** Stream category.
|
Chris@60
|
280 @see PaWasapiStreamCategory
|
Chris@60
|
281 @version Available as of 19.6.0
|
Chris@60
|
282 */
|
Chris@60
|
283 PaWasapiStreamCategory streamCategory;
|
Chris@60
|
284
|
Chris@60
|
285 /** Stream option.
|
Chris@60
|
286 @see PaWasapiStreamOption
|
Chris@60
|
287 @version Available as of 19.6.0
|
Chris@60
|
288 */
|
Chris@60
|
289 PaWasapiStreamOption streamOption;
|
Chris@60
|
290 }
|
Chris@60
|
291 PaWasapiStreamInfo;
|
Chris@60
|
292
|
Chris@60
|
293
|
Chris@60
|
294 /** Returns default sound format for device. Format is represented by PaWinWaveFormat or
|
Chris@60
|
295 WAVEFORMATEXTENSIBLE structure.
|
Chris@60
|
296
|
Chris@60
|
297 @param pFormat Pointer to PaWinWaveFormat or WAVEFORMATEXTENSIBLE structure.
|
Chris@60
|
298 @param nFormatSize Size of PaWinWaveFormat or WAVEFORMATEXTENSIBLE structure in bytes.
|
Chris@60
|
299 @param nDevice Device index.
|
Chris@60
|
300
|
Chris@60
|
301 @return Non-negative value indicating the number of bytes copied into format decriptor
|
Chris@60
|
302 or, a PaErrorCode (which are always negative) if PortAudio is not initialized
|
Chris@60
|
303 or an error is encountered.
|
Chris@60
|
304 */
|
Chris@60
|
305 int PaWasapi_GetDeviceDefaultFormat( void *pFormat, unsigned int nFormatSize, PaDeviceIndex nDevice );
|
Chris@60
|
306
|
Chris@60
|
307
|
Chris@60
|
308 /** Returns device role (PaWasapiDeviceRole enum).
|
Chris@60
|
309
|
Chris@60
|
310 @param nDevice device index.
|
Chris@60
|
311
|
Chris@60
|
312 @return Non-negative value indicating device role or, a PaErrorCode (which are always negative)
|
Chris@60
|
313 if PortAudio is not initialized or an error is encountered.
|
Chris@60
|
314 */
|
Chris@60
|
315 int/*PaWasapiDeviceRole*/ PaWasapi_GetDeviceRole( PaDeviceIndex nDevice );
|
Chris@60
|
316
|
Chris@60
|
317
|
Chris@60
|
318 /** Boost thread priority of calling thread (MMCSS). Use it for Blocking Interface only for thread
|
Chris@60
|
319 which makes calls to Pa_WriteStream/Pa_ReadStream.
|
Chris@60
|
320
|
Chris@60
|
321 @param hTask Handle to pointer to priority task. Must be used with PaWasapi_RevertThreadPriority
|
Chris@60
|
322 method to revert thread priority to initial state.
|
Chris@60
|
323
|
Chris@60
|
324 @param nPriorityClass Id of thread priority of PaWasapiThreadPriority type. Specifying
|
Chris@60
|
325 eThreadPriorityNone does nothing.
|
Chris@60
|
326
|
Chris@60
|
327 @return Error code indicating success or failure.
|
Chris@60
|
328 @see PaWasapi_RevertThreadPriority
|
Chris@60
|
329 */
|
Chris@60
|
330 PaError PaWasapi_ThreadPriorityBoost( void **hTask, PaWasapiThreadPriority nPriorityClass );
|
Chris@60
|
331
|
Chris@60
|
332
|
Chris@60
|
333 /** Boost thread priority of calling thread (MMCSS). Use it for Blocking Interface only for thread
|
Chris@60
|
334 which makes calls to Pa_WriteStream/Pa_ReadStream.
|
Chris@60
|
335
|
Chris@60
|
336 @param hTask Task handle obtained by PaWasapi_BoostThreadPriority method.
|
Chris@60
|
337 @return Error code indicating success or failure.
|
Chris@60
|
338 @see PaWasapi_BoostThreadPriority
|
Chris@60
|
339 */
|
Chris@60
|
340 PaError PaWasapi_ThreadPriorityRevert( void *hTask );
|
Chris@60
|
341
|
Chris@60
|
342
|
Chris@60
|
343 /** Get number of frames per host buffer. This is maximal value of frames of WASAPI buffer which
|
Chris@60
|
344 can be locked for operations. Use this method as helper to findout maximal values of
|
Chris@60
|
345 inputFrames/outputFrames of PaWasapiHostProcessorCallback.
|
Chris@60
|
346
|
Chris@60
|
347 @param pStream Pointer to PaStream to query.
|
Chris@60
|
348 @param nInput Pointer to variable to receive number of input frames. Can be NULL.
|
Chris@60
|
349 @param nOutput Pointer to variable to receive number of output frames. Can be NULL.
|
Chris@60
|
350 @return Error code indicating success or failure.
|
Chris@60
|
351 @see PaWasapiHostProcessorCallback
|
Chris@60
|
352 */
|
Chris@60
|
353 PaError PaWasapi_GetFramesPerHostBuffer( PaStream *pStream, unsigned int *nInput, unsigned int *nOutput );
|
Chris@60
|
354
|
Chris@60
|
355
|
Chris@60
|
356 /** Get number of jacks associated with a WASAPI device. Use this method to determine if
|
Chris@60
|
357 there are any jacks associated with the provided WASAPI device. Not all audio devices
|
Chris@60
|
358 will support this capability. This is valid for both input and output devices.
|
Chris@60
|
359 @param nDevice device index.
|
Chris@60
|
360 @param jcount Number of jacks is returned in this variable
|
Chris@60
|
361 @return Error code indicating success or failure
|
Chris@60
|
362 @see PaWasapi_GetJackDescription
|
Chris@60
|
363 */
|
Chris@60
|
364 PaError PaWasapi_GetJackCount(PaDeviceIndex nDevice, int *jcount);
|
Chris@60
|
365
|
Chris@60
|
366
|
Chris@60
|
367 /** Get the jack description associated with a WASAPI device and jack number
|
Chris@60
|
368 Before this function is called, use PaWasapi_GetJackCount to determine the
|
Chris@60
|
369 number of jacks associated with device. If jcount is greater than zero, then
|
Chris@60
|
370 each jack from 0 to jcount can be queried with this function to get the jack
|
Chris@60
|
371 description.
|
Chris@60
|
372 @param nDevice device index.
|
Chris@60
|
373 @param jindex Which jack to return information
|
Chris@60
|
374 @param KSJACK_DESCRIPTION This structure filled in on success.
|
Chris@60
|
375 @return Error code indicating success or failure
|
Chris@60
|
376 @see PaWasapi_GetJackCount
|
Chris@60
|
377 */
|
Chris@60
|
378 PaError PaWasapi_GetJackDescription(PaDeviceIndex nDevice, int jindex, PaWasapiJackDescription *pJackDescription);
|
Chris@60
|
379
|
Chris@60
|
380
|
Chris@60
|
381 /*
|
Chris@60
|
382 IMPORTANT:
|
Chris@60
|
383
|
Chris@60
|
384 WASAPI is implemented for Callback and Blocking interfaces. It supports Shared and Exclusive
|
Chris@60
|
385 share modes.
|
Chris@60
|
386
|
Chris@60
|
387 Exclusive Mode:
|
Chris@60
|
388
|
Chris@60
|
389 Exclusive mode allows to deliver audio data directly to hardware bypassing
|
Chris@60
|
390 software mixing.
|
Chris@60
|
391 Exclusive mode is specified by 'paWinWasapiExclusive' flag.
|
Chris@60
|
392
|
Chris@60
|
393 Callback Interface:
|
Chris@60
|
394
|
Chris@60
|
395 Provides best audio quality with low latency. Callback interface is implemented in
|
Chris@60
|
396 two versions:
|
Chris@60
|
397
|
Chris@60
|
398 1) Event-Driven:
|
Chris@60
|
399 This is the most powerful WASAPI implementation which provides glitch-free
|
Chris@60
|
400 audio at around 3ms latency in Exclusive mode. Lowest possible latency for this mode is
|
Chris@60
|
401 3 ms for HD Audio class audio chips. For the Shared mode latency can not be
|
Chris@60
|
402 lower than 20 ms.
|
Chris@60
|
403
|
Chris@60
|
404 2) Poll-Driven:
|
Chris@60
|
405 Polling is another 2-nd method to operate with WASAPI. It is less efficient than Event-Driven
|
Chris@60
|
406 and provides latency at around 10-13ms. Polling must be used to overcome a system bug
|
Chris@60
|
407 under Windows Vista x64 when application is WOW64(32-bit) and Event-Driven method simply
|
Chris@60
|
408 times out (event handle is never signalled on buffer completion). Please note, such WOW64 bug
|
Chris@60
|
409 does not exist in Vista x86 or Windows 7.
|
Chris@60
|
410 Polling can be setup by speciying 'paWinWasapiPolling' flag. Our WASAPI implementation detects
|
Chris@60
|
411 WOW64 bug and sets 'paWinWasapiPolling' automatically.
|
Chris@60
|
412
|
Chris@60
|
413 Thread priority:
|
Chris@60
|
414
|
Chris@60
|
415 Normally thread priority is set automatically and does not require modification. Although
|
Chris@60
|
416 if user wants some tweaking thread priority can be modified by setting 'paWinWasapiThreadPriority'
|
Chris@60
|
417 flag and specifying 'PaWasapiStreamInfo::threadPriority' with value from PaWasapiThreadPriority
|
Chris@60
|
418 enum.
|
Chris@60
|
419
|
Chris@60
|
420 Blocking Interface:
|
Chris@60
|
421
|
Chris@60
|
422 Blocking interface is implemented but due to above described Poll-Driven method can not
|
Chris@60
|
423 deliver lowest possible latency. Specifying too low latency in Shared mode will result in
|
Chris@60
|
424 distorted audio although Exclusive mode adds stability.
|
Chris@60
|
425
|
Chris@60
|
426 Pa_IsFormatSupported:
|
Chris@60
|
427
|
Chris@60
|
428 To check format with correct Share Mode (Exclusive/Shared) you must supply
|
Chris@60
|
429 PaWasapiStreamInfo with flags paWinWasapiExclusive set through member of
|
Chris@60
|
430 PaStreamParameters::hostApiSpecificStreamInfo structure.
|
Chris@60
|
431
|
Chris@60
|
432 Pa_OpenStream:
|
Chris@60
|
433
|
Chris@60
|
434 To set desired Share Mode (Exclusive/Shared) you must supply
|
Chris@60
|
435 PaWasapiStreamInfo with flags paWinWasapiExclusive set through member of
|
Chris@60
|
436 PaStreamParameters::hostApiSpecificStreamInfo structure.
|
Chris@60
|
437 */
|
Chris@60
|
438
|
Chris@60
|
439 #ifdef __cplusplus
|
Chris@60
|
440 }
|
Chris@60
|
441 #endif /* __cplusplus */
|
Chris@60
|
442
|
Chris@60
|
443 #endif /* PA_WIN_WASAPI_H */
|