comparison win64-msvc/include/pa_win_wasapi.h @ 145:13a516fa8999

Update PortAudio build for Win64
author Chris Cannam <cannam@all-day-breakfast.com>
date Tue, 10 Jan 2017 11:28:20 +0000
parents 1c067f014d80
children
comparison
equal deleted inserted replaced
144:a0c5ef2265f5 145:13a516fa8999
67 /* selects non-Event driven method of data read/write 67 /* selects non-Event driven method of data read/write
68 Note: WASAPI Event driven core is capable of 2ms latency!!!, but Polling 68 Note: WASAPI Event driven core is capable of 2ms latency!!!, but Polling
69 method can only provide 15-20ms latency. */ 69 method can only provide 15-20ms latency. */
70 paWinWasapiPolling = (1 << 3), 70 paWinWasapiPolling = (1 << 3),
71 71
72 /* forces custom thread priority setting. must be used if PaWasapiStreamInfo::threadPriority 72 /* forces custom thread priority setting, must be used if PaWasapiStreamInfo::threadPriority
73 is set to custom value. */ 73 is set to a custom value */
74 paWinWasapiThreadPriority = (1 << 4) 74 paWinWasapiThreadPriority = (1 << 4)
75 } 75 }
76 PaWasapiFlags; 76 PaWasapiFlags;
77 #define paWinWasapiExclusive (paWinWasapiExclusive) 77 #define paWinWasapiExclusive (paWinWasapiExclusive)
78 #define paWinWasapiRedirectHostProcessor (paWinWasapiRedirectHostProcessor) 78 #define paWinWasapiRedirectHostProcessor (paWinWasapiRedirectHostProcessor)
89 */ 89 */
90 typedef void (*PaWasapiHostProcessorCallback) (void *inputBuffer, long inputFrames, 90 typedef void (*PaWasapiHostProcessorCallback) (void *inputBuffer, long inputFrames,
91 void *outputBuffer, long outputFrames, 91 void *outputBuffer, long outputFrames,
92 void *userData); 92 void *userData);
93 93
94 /* Device role */ 94 /* Device role. */
95 typedef enum PaWasapiDeviceRole 95 typedef enum PaWasapiDeviceRole
96 { 96 {
97 eRoleRemoteNetworkDevice = 0, 97 eRoleRemoteNetworkDevice = 0,
98 eRoleSpeakers, 98 eRoleSpeakers,
99 eRoleLineLevel, 99 eRoleLineLevel,
107 eRoleUnknownFormFactor 107 eRoleUnknownFormFactor
108 } 108 }
109 PaWasapiDeviceRole; 109 PaWasapiDeviceRole;
110 110
111 111
112 /* Jack connection type */ 112 /* Jack connection type. */
113 typedef enum PaWasapiJackConnectionType 113 typedef enum PaWasapiJackConnectionType
114 { 114 {
115 eJackConnTypeUnknown, 115 eJackConnTypeUnknown,
116 eJackConnType3Point5mm, 116 eJackConnType3Point5mm,
117 eJackConnTypeQuarter, 117 eJackConnTypeQuarter,
126 eJackConnTypeCombination 126 eJackConnTypeCombination
127 } 127 }
128 PaWasapiJackConnectionType; 128 PaWasapiJackConnectionType;
129 129
130 130
131 /* Jack geometric location */ 131 /* Jack geometric location. */
132 typedef enum PaWasapiJackGeoLocation 132 typedef enum PaWasapiJackGeoLocation
133 { 133 {
134 eJackGeoLocUnk = 0, 134 eJackGeoLocUnk = 0,
135 eJackGeoLocRear = 0x1, /* matches EPcxGeoLocation::eGeoLocRear */ 135 eJackGeoLocRear = 0x1, /* matches EPcxGeoLocation::eGeoLocRear */
136 eJackGeoLocFront, 136 eJackGeoLocFront,
137 eJackGeoLocLeft, 137 eJackGeoLocLeft,
138 eJackGeoLocRight, 138 eJackGeoLocRight,
139 eJackGeoLocTop, 139 eJackGeoLocTop,
149 eJackGeoLocReserved6, 149 eJackGeoLocReserved6,
150 } 150 }
151 PaWasapiJackGeoLocation; 151 PaWasapiJackGeoLocation;
152 152
153 153
154 /* Jack general location */ 154 /* Jack general location. */
155 typedef enum PaWasapiJackGenLocation 155 typedef enum PaWasapiJackGenLocation
156 { 156 {
157 eJackGenLocPrimaryBox = 0, 157 eJackGenLocPrimaryBox = 0,
158 eJackGenLocInternal, 158 eJackGenLocInternal,
159 eJackGenLocSeparate, 159 eJackGenLocSeparate,
160 eJackGenLocOther 160 eJackGenLocOther
161 } 161 }
162 PaWasapiJackGenLocation; 162 PaWasapiJackGenLocation;
163 163
164 164
165 /* Jack's type of port */ 165 /* Jack's type of port. */
166 typedef enum PaWasapiJackPortConnection 166 typedef enum PaWasapiJackPortConnection
167 { 167 {
168 eJackPortConnJack = 0, 168 eJackPortConnJack = 0,
169 eJackPortConnIntegratedDevice, 169 eJackPortConnIntegratedDevice,
170 eJackPortConnBothIntegratedAndJack, 170 eJackPortConnBothIntegratedAndJack,
171 eJackPortConnUnknown 171 eJackPortConnUnknown
172 } 172 }
173 PaWasapiJackPortConnection; 173 PaWasapiJackPortConnection;
174 174
175 175
176 /* Thread priority */ 176 /* Thread priority. */
177 typedef enum PaWasapiThreadPriority 177 typedef enum PaWasapiThreadPriority
178 { 178 {
179 eThreadPriorityNone = 0, 179 eThreadPriorityNone = 0,
180 eThreadPriorityAudio, //!< Default for Shared mode. 180 eThreadPriorityAudio, //!< Default for Shared mode.
181 eThreadPriorityCapture, 181 eThreadPriorityCapture,
200 unsigned int isConnected; 200 unsigned int isConnected;
201 } 201 }
202 PaWasapiJackDescription; 202 PaWasapiJackDescription;
203 203
204 204
205 /** Stream category.
206 Note:
207 - values are equal to WASAPI AUDIO_STREAM_CATEGORY enum
208 - supported since Windows 8.0, noop on earler versions
209 - values 1,2 are deprecated on Windows 10 and not included into enumeration
210
211 @version Available as of 19.6.0
212 */
213 typedef enum PaWasapiStreamCategory
214 {
215 eAudioCategoryOther = 0,
216 eAudioCategoryCommunications = 3,
217 eAudioCategoryAlerts = 4,
218 eAudioCategorySoundEffects = 5,
219 eAudioCategoryGameEffects = 6,
220 eAudioCategoryGameMedia = 7,
221 eAudioCategoryGameChat = 8,
222 eAudioCategorySpeech = 9,
223 eAudioCategoryMovie = 10,
224 eAudioCategoryMedia = 11
225 }
226 PaWasapiStreamCategory;
227
228
229 /** Stream option.
230 Note:
231 - values are equal to WASAPI AUDCLNT_STREAMOPTIONS enum
232 - supported since Windows 8.1, noop on earler versions
233
234 @version Available as of 19.6.0
235 */
236 typedef enum PaWasapiStreamOption
237 {
238 eStreamOptionNone = 0, //!< default
239 eStreamOptionRaw = 1, //!< bypass WASAPI Audio Engine DSP effects, supported since Windows 8.1
240 eStreamOptionMatchFormat = 2 //!< force WASAPI Audio Engine into a stream format, supported since Windows 10
241 }
242 PaWasapiStreamOption;
243
244
205 /* Stream descriptor. */ 245 /* Stream descriptor. */
206 typedef struct PaWasapiStreamInfo 246 typedef struct PaWasapiStreamInfo
207 { 247 {
208 unsigned long size; /**< sizeof(PaWasapiStreamInfo) */ 248 unsigned long size; /**< sizeof(PaWasapiStreamInfo) */
209 PaHostApiTypeId hostApiType; /**< paWASAPI */ 249 PaHostApiTypeId hostApiType; /**< paWASAPI */
210 unsigned long version; /**< 1 */ 250 unsigned long version; /**< 1 */
211 251
212 unsigned long flags; /**< collection of PaWasapiFlags */ 252 unsigned long flags; /**< collection of PaWasapiFlags */
213 253
214 /* Support for WAVEFORMATEXTENSIBLE channel masks. If flags contains 254 /** Support for WAVEFORMATEXTENSIBLE channel masks. If flags contains
215 paWinWasapiUseChannelMask this allows you to specify which speakers 255 paWinWasapiUseChannelMask this allows you to specify which speakers
216 to address in a multichannel stream. Constants for channelMask 256 to address in a multichannel stream. Constants for channelMask
217 are specified in pa_win_waveformat.h. Will be used only if 257 are specified in pa_win_waveformat.h. Will be used only if
218 paWinWasapiUseChannelMask flag is specified. 258 paWinWasapiUseChannelMask flag is specified.
219 */ 259 */
220 PaWinWaveFormatChannelMask channelMask; 260 PaWinWaveFormatChannelMask channelMask;
221 261
222 /* Delivers raw data to callback obtained from GetBuffer() methods skipping 262 /** Delivers raw data to callback obtained from GetBuffer() methods skipping
223 internal PortAudio processing inventory completely. userData parameter will 263 internal PortAudio processing inventory completely. userData parameter will
224 be the same that was passed to Pa_OpenStream method. Will be used only if 264 be the same that was passed to Pa_OpenStream method. Will be used only if
225 paWinWasapiRedirectHostProcessor flag is specified. 265 paWinWasapiRedirectHostProcessor flag is specified.
226 */ 266 */
227 PaWasapiHostProcessorCallback hostProcessorOutput; 267 PaWasapiHostProcessorCallback hostProcessorOutput;
228 PaWasapiHostProcessorCallback hostProcessorInput; 268 PaWasapiHostProcessorCallback hostProcessorInput;
229 269
230 /* Specifies thread priority explicitly. Will be used only if paWinWasapiThreadPriority flag 270 /** Specifies thread priority explicitly. Will be used only if paWinWasapiThreadPriority flag
231 is specified. 271 is specified.
232 272
233 Please note, if Input/Output streams are opened simultaniously (Full-Duplex mode) 273 Please note, if Input/Output streams are opened simultaniously (Full-Duplex mode)
234 you shall specify same value for threadPriority or othervise one of the values will be used 274 you shall specify same value for threadPriority or othervise one of the values will be used
235 to setup thread priority. 275 to setup thread priority.
236 */ 276 */
237 PaWasapiThreadPriority threadPriority; 277 PaWasapiThreadPriority threadPriority;
278
279 /** Stream category.
280 @see PaWasapiStreamCategory
281 @version Available as of 19.6.0
282 */
283 PaWasapiStreamCategory streamCategory;
284
285 /** Stream option.
286 @see PaWasapiStreamOption
287 @version Available as of 19.6.0
288 */
289 PaWasapiStreamOption streamOption;
238 } 290 }
239 PaWasapiStreamInfo; 291 PaWasapiStreamInfo;
240 292
241 293
242 /** Returns default sound format for device. Format is represented by PaWinWaveFormat or 294 /** Returns default sound format for device. Format is represented by PaWinWaveFormat or
301 PaError PaWasapi_GetFramesPerHostBuffer( PaStream *pStream, unsigned int *nInput, unsigned int *nOutput ); 353 PaError PaWasapi_GetFramesPerHostBuffer( PaStream *pStream, unsigned int *nInput, unsigned int *nOutput );
302 354
303 355
304 /** Get number of jacks associated with a WASAPI device. Use this method to determine if 356 /** Get number of jacks associated with a WASAPI device. Use this method to determine if
305 there are any jacks associated with the provided WASAPI device. Not all audio devices 357 there are any jacks associated with the provided WASAPI device. Not all audio devices
306 will support this capability. This is valid for both input and output devices. 358 will support this capability. This is valid for both input and output devices.
307 @param nDevice device index. 359 @param nDevice device index.
308 @param jcount Number of jacks is returned in this variable 360 @param jcount Number of jacks is returned in this variable
309 @return Error code indicating success or failure 361 @return Error code indicating success or failure
310 @see PaWasapi_GetJackDescription 362 @see PaWasapi_GetJackDescription
311 */ 363 */
312 PaError PaWasapi_GetJackCount(PaDeviceIndex nDevice, int *jcount); 364 PaError PaWasapi_GetJackCount(PaDeviceIndex nDevice, int *jcount);
313 365
314 366
315 /** Get the jack description associated with a WASAPI device and jack number 367 /** Get the jack description associated with a WASAPI device and jack number
316 Before this function is called, use PaWasapi_GetJackCount to determine the 368 Before this function is called, use PaWasapi_GetJackCount to determine the
317 number of jacks associated with device. If jcount is greater than zero, then 369 number of jacks associated with device. If jcount is greater than zero, then
318 each jack from 0 to jcount can be queried with this function to get the jack 370 each jack from 0 to jcount can be queried with this function to get the jack
319 description. 371 description.
320 @param nDevice device index. 372 @param nDevice device index.
321 @param jindex Which jack to return information 373 @param jindex Which jack to return information
322 @param KSJACK_DESCRIPTION This structure filled in on success. 374 @param KSJACK_DESCRIPTION This structure filled in on success.
323 @return Error code indicating success or failure 375 @return Error code indicating success or failure
324 @see PaWasapi_GetJackCount 376 @see PaWasapi_GetJackCount
345 397
346 1) Event-Driven: 398 1) Event-Driven:
347 This is the most powerful WASAPI implementation which provides glitch-free 399 This is the most powerful WASAPI implementation which provides glitch-free
348 audio at around 3ms latency in Exclusive mode. Lowest possible latency for this mode is 400 audio at around 3ms latency in Exclusive mode. Lowest possible latency for this mode is
349 3 ms for HD Audio class audio chips. For the Shared mode latency can not be 401 3 ms for HD Audio class audio chips. For the Shared mode latency can not be
350 lower than 20 ms. 402 lower than 20 ms.
351 403
352 2) Poll-Driven: 404 2) Poll-Driven:
353 Polling is another 2-nd method to operate with WASAPI. It is less efficient than Event-Driven 405 Polling is another 2-nd method to operate with WASAPI. It is less efficient than Event-Driven
354 and provides latency at around 10-13ms. Polling must be used to overcome a system bug 406 and provides latency at around 10-13ms. Polling must be used to overcome a system bug
355 under Windows Vista x64 when application is WOW64(32-bit) and Event-Driven method simply 407 under Windows Vista x64 when application is WOW64(32-bit) and Event-Driven method simply