2 * Core Audio audioclient definitions
4 * Copyright 2009 Maarten Lankhorst
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 import
"audiosessiontypes.h";
26 /* Forward declarations */
27 interface IAudioClient
;
28 interface IAudioRenderClient
;
29 interface IAudioCaptureClient
;
30 interface IAudioClock
;
31 interface IAudioClock2
;
32 interface IAudioClockAdjustment
;
33 interface ISimpleAudioVolume
;
34 interface IAudioStreamVolume
;
35 interface IChannelAudioVolume
;
38 typedef struct WAVEFORMATEX
/*[hidden,restricted]*/
43 DWORD nAvgBytesPerSec
;
49 cpp_quote
("#include <mmreg.h>")
53 typedef LONGLONG
/*[hidden,restricted]*/ REFERENCE_TIME
;
55 cpp_quote
("#define _IKsControl_")
56 cpp_quote
("#include <ks.h>")
57 cpp_quote
("#include <ksmedia.h>")
60 enum _AUDCLNT_BUFFERFLAGS
62 AUDCLNT_BUFFERFLAGS_DATA_DISCONTINUITY
= 0x1,
63 AUDCLNT_BUFFERFLAGS_SILENT
= 0x2,
64 AUDCLNT_BUFFERFLAGS_TIMESTAMP_ERROR
= 0x4
69 pointer_default(unique),
70 uuid(1cb9ad4c
-dbfa
-4c32
-b178
-c2f568a703b2
),
73 interface IAudioClient
: IUnknown
76 [in] AUDCLNT_SHAREMODE ShareMode
,
77 [in] DWORD StreamFlags
,
78 [in] REFERENCE_TIME hnsBufferDuration
,
79 [in] REFERENCE_TIME hnsPeriodicity
,
80 [in] const WAVEFORMATEX
*pFormat
,
81 [in] LPCGUID AudioSessionGuid
83 HRESULT GetBufferSize
(
84 [out] UINT32
*pNumBufferFrames
86 HRESULT GetStreamLatency
(
87 [out] REFERENCE_TIME
*phnsLatency
89 HRESULT GetCurrentPadding
(
90 [out] UINT32
*pNumPaddingFrames
92 HRESULT IsFormatSupported
(
93 [in] AUDCLNT_SHAREMODE ShareMode
,
94 [in] const WAVEFORMATEX
*pFormat
,
95 [out,unique] WAVEFORMATEX
**ppClosestMatch
98 [out] WAVEFORMATEX
**ppDeviceFormat
100 HRESULT GetDevicePeriod
(
101 [out] REFERENCE_TIME
*phnsDefaultDevicePeriod
,
102 [out] REFERENCE_TIME
*phnsMinimumDevicePeriod
107 HRESULT SetEventHandle
([in] HANDLE eventHandle
);
110 [iid_is(riid
),out] void **ppv
114 typedef enum _AUDCLNT_STREAMOPTIONS
116 AUDCLNT_STREAMOPTIONS_NONE
= 0x0,
117 AUDCLNT_STREAMOPTIONS_RAW
= 0x1,
118 AUDCLNT_STREAMOPTIONS_MATCH_FORMAT
= 0x2,
119 AUDCLNT_STREAMOPTIONS_AMBISONICS
= 0x4
120 } AUDCLNT_STREAMOPTIONS
;
121 cpp_quote
("DEFINE_ENUM_FLAG_OPERATORS(AUDCLNT_STREAMOPTIONS);")
123 typedef struct _AudioClientProperties
127 AUDIO_STREAM_CATEGORY eCategory
;
128 AUDCLNT_STREAMOPTIONS Options
;
129 } AudioClientProperties
;
131 typedef struct _Win8AudioClientProperties
135 AUDIO_STREAM_CATEGORY eCategory
;
136 /* Options field added in Win 8.1 */
137 } Win8AudioClientProperties
;
141 pointer_default(unique),
142 uuid(726778cd
-f60a
-4eda
-82de
-e47610cd78aa
),
145 interface IAudioClient2
: IAudioClient
147 HRESULT IsOffloadCapable
(
148 AUDIO_STREAM_CATEGORY category
,
149 [out] BOOL
*offload_capable
152 HRESULT SetClientProperties
(
153 [in] const AudioClientProperties
*prop
156 HRESULT GetBufferSizeLimits
(
157 [in] const WAVEFORMATEX
*format
,
159 [out] REFERENCE_TIME
*min_duration
,
160 [out] REFERENCE_TIME
*max_duration
166 pointer_default(unique),
167 uuid(7ed4ee07
-8e67
-4cd4
-8c1a
-2b7a5987ad42
),
170 interface IAudioClient3
: IAudioClient2
172 HRESULT GetSharedModeEnginePeriod
(
173 [in] const WAVEFORMATEX
*format
,
174 [out] UINT32
*default_period_frames
,
175 [out] UINT32
*unit_period_frames
,
176 [out] UINT32
*min_period_frames
,
177 [out] UINT32
*max_period_frames
180 HRESULT GetCurrentSharedModeEnginePeriod
(
181 [out] WAVEFORMATEX
**cur_format
,
182 [out] UINT32
*cur_period_frames
185 HRESULT InitializeSharedAudioStream
(
187 [in] UINT32 period_frames
,
188 [in] const WAVEFORMATEX
*format
,
189 [in] const GUID
*session_guid
195 pointer_default(unique),
196 uuid(f294acfc
-3146-4483-a7bf
-addca7c260e2
),
199 interface IAudioRenderClient
: IUnknown
202 [in] UINT32 NumFramesRequested
,
205 HRESULT ReleaseBuffer
(
206 [in] UINT32 NumFramesWritten
,
213 pointer_default(unique),
214 uuid(c8adbd64
-e71e
-48a0
-a4de
-185c395cd317
),
217 interface IAudioCaptureClient
: IUnknown
221 [out] UINT32
*pNumFramesToRead
,
222 [out] DWORD
*pdwFlags
,
223 [unique,out] UINT64
*pu64DevicePosition
,
224 [unique,out] UINT64
*pu64QPCPosition
226 HRESULT ReleaseBuffer
(
227 [in] UINT32 NumFramesRead
229 HRESULT GetNextPacketSize
(
230 [out] UINT32
*pNumFramesInNextPacket
234 cpp_quote
("#define AUDIOCLOCK_CHARACTERISTIC_FIXED_FREQ 0x00000001")
238 pointer_default(unique),
239 uuid("cd63314f-3fba-4a1b-812c-ef96358728e7"),
242 interface IAudioClock
: IUnknown
244 HRESULT GetFrequency
(
245 [out] UINT64
*pu64Frequency
248 [out] UINT64
*pu64Position
,
249 [out,unique] UINT64
*pu64QPCPosition
251 HRESULT GetCharacteristics
(
252 [out] DWORD
*pdwCharacteristics
258 pointer_default(unique),
259 uuid("6f49ff73-6727-49ac-a008-d98cf5e70048"),
262 interface IAudioClock2
: IUnknown
265 [out] UINT64
*DevicePosition
,
266 [out,unique] UINT64
*QPCPosition
272 pointer_default(unique),
273 uuid("f6e4c0a0-46d9-4fb8-be21-57a3ef2b626c"),
276 interface IAudioClockAdjustment
: IUnknown
278 HRESULT SetSampleRate
(
279 [in] float flSampleRate
285 pointer_default(unique),
286 uuid("87ce5498-68d6-44e5-9215-6da47ef883d8"),
289 interface ISimpleAudioVolume
: IUnknown
291 HRESULT SetMasterVolume
(
293 [unique,in] LPCGUID EventContext
295 HRESULT GetMasterVolume
(
299 [in] const BOOL bMute
,
300 [unique,in] LPCGUID EventContext
309 pointer_default(unique),
310 uuid("93014887-242d-4068-8a15-cf5e93b90fe3"),
313 interface IAudioStreamVolume
: IUnknown
315 HRESULT GetChannelCount
(
316 [out] UINT32
*pdwCount
318 HRESULT SetChannelVolume
(
320 [in] const float fLevel
322 HRESULT GetChannelVolume
(
326 HRESULT SetAllVolumes
(
328 [size_is(dwCount
),in] const float *pfVolumes
330 HRESULT GetAllVolumes
(
332 [size_is(dwCount
),out] float *pfVolumes
336 typedef enum AMBISONICS_TYPE
338 AMBISONICS_TYPE_FULL3D
= 0x0,
341 typedef enum AMBISONICS_CHANNEL_ORDERING
343 AMBISONICS_CHANNEL_ORDERING_ACN
= 0x0,
344 } AMBISONICS_CHANNEL_ORDERING
;
346 typedef enum AMBISONICS_NORMALIZATION
348 AMBISONICS_NORMALIZATION_SN3D
= 0x0,
349 AMBISONICS_NORMALIZATION_N3D
= 0x1,
350 } AMBISONICS_NORMALIZATION
;
352 typedef struct AMBISONICS_PARAMS
356 AMBISONICS_TYPE u32Type
;
357 AMBISONICS_CHANNEL_ORDERING u32ChannelOrdering
;
358 AMBISONICS_NORMALIZATION u32Normalization
;
360 UINT32 u32NumChannels
;
361 UINT32
*pu32ChannelMap
;
366 pointer_default(unique),
367 uuid(28724c91
-df35
-4856-9f76
-d6a26413f3df
),
370 interface IAudioAmbisonicsControl
: IUnknown
373 [in] const AMBISONICS_PARAMS
*param
,
376 HRESULT SetHeadTracking
(
379 HRESULT GetHeadTracking
(
392 pointer_default(unique),
393 uuid("1c158861-b533-4b30-b1cf-e853e51c59b8"),
396 interface IChannelAudioVolume
: IUnknown
398 HRESULT GetChannelCount
(
399 [out] UINT32
*pdwCount
401 HRESULT SetChannelVolume
(
403 [in] const float fLevel
,
404 [unique,in] LPCGUID EventContext
406 HRESULT GetChannelVolume
(
410 HRESULT SetAllVolumes
(
412 [size_is(dwCount
),in] const float *pfVolumes
,
413 [unique,in] LPCGUID EventContext
415 HRESULT GetAllVolumes
(
417 [size_is(dwCount
),out] float *pfVolumes
421 cpp_quote
("#define AUDCLNT_ERR(n) MAKE_HRESULT(SEVERITY_ERROR, FACILITY_AUDCLNT, n)")
422 cpp_quote
("#define AUDCLNT_SUCCESS(n) MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_AUDCLNT, n)")
423 cpp_quote
("#define AUDCLNT_E_NOT_INITIALIZED AUDCLNT_ERR(1)")
424 cpp_quote
("#define AUDCLNT_E_ALREADY_INITIALIZED AUDCLNT_ERR(2)")
425 cpp_quote
("#define AUDCLNT_E_WRONG_ENDPOINT_TYPE AUDCLNT_ERR(3)")
426 cpp_quote
("#define AUDCLNT_E_DEVICE_INVALIDATED AUDCLNT_ERR(4)")
427 cpp_quote
("#define AUDCLNT_E_NOT_STOPPED AUDCLNT_ERR(5)")
428 cpp_quote
("#define AUDCLNT_E_BUFFER_TOO_LARGE AUDCLNT_ERR(6)")
429 cpp_quote
("#define AUDCLNT_E_OUT_OF_ORDER AUDCLNT_ERR(7)")
430 cpp_quote
("#define AUDCLNT_E_UNSUPPORTED_FORMAT AUDCLNT_ERR(8)")
431 cpp_quote
("#define AUDCLNT_E_INVALID_SIZE AUDCLNT_ERR(9)")
432 cpp_quote
("#define AUDCLNT_E_DEVICE_IN_USE AUDCLNT_ERR(0x0a)")
433 cpp_quote
("#define AUDCLNT_E_BUFFER_OPERATION_PENDING AUDCLNT_ERR(0x0b)")
434 cpp_quote
("#define AUDCLNT_E_THREAD_NOT_REGISTERED AUDCLNT_ERR(0x0c)")
435 /* Not defined? cpp_quote("#define AUDCLNT_E_UNKNOWN_XXX1 AUDCLNT_ERR(0x0d)") */
436 cpp_quote
("#define AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED AUDCLNT_ERR(0x0e)")
437 cpp_quote
("#define AUDCLNT_E_ENDPOINT_CREATE_FAILED AUDCLNT_ERR(0x0f)")
438 cpp_quote
("#define AUDCLNT_E_SERVICE_NOT_RUNNING AUDCLNT_ERR(0x10)")
439 cpp_quote
("#define AUDCLNT_E_EVENTHANDLE_NOT_EXPECTED AUDCLNT_ERR(0x11)")
440 cpp_quote
("#define AUDCLNT_E_EXCLUSIVE_MODE_ONLY AUDCLNT_ERR(0x12)")
441 cpp_quote
("#define AUDCLNT_E_BUFDURATION_PERIOD_NOT_EQUAL AUDCLNT_ERR(0x13)")
442 cpp_quote
("#define AUDCLNT_E_EVENTHANDLE_NOT_SET AUDCLNT_ERR(0x14)")
443 cpp_quote
("#define AUDCLNT_E_INCORRECT_BUFFER_SIZE AUDCLNT_ERR(0x15)")
444 cpp_quote
("#define AUDCLNT_E_BUFFER_SIZE_ERROR AUDCLNT_ERR(0x16)")
445 cpp_quote
("#define AUDCLNT_E_CPUUSAGE_EXCEEDED AUDCLNT_ERR(0x17)")
446 cpp_quote
("#define AUDCLNT_E_BUFFER_ERROR AUDCLNT_ERR(0x18)")
447 cpp_quote
("#define AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED AUDCLNT_ERR(0x19)")
449 cpp_quote
("#define AUDCLNT_E_INVALID_DEVICE_PERIOD AUDCLNT_ERR(0x20)")
450 cpp_quote
("#define AUDCLNT_E_INVALID_STREAM_FLAG AUDCLNT_ERR(0x021)")
451 cpp_quote
("#define AUDCLNT_E_ENDPOINT_OFFLOAD_NOT_CAPABLE AUDCLNT_ERR(0x022)")
452 cpp_quote
("#define AUDCLNT_E_OUT_OF_OFFLOAD_RESOURCES AUDCLNT_ERR(0x023)")
453 cpp_quote
("#define AUDCLNT_E_OFFLOAD_MODE_ONLY AUDCLNT_ERR(0x024)")
454 cpp_quote
("#define AUDCLNT_E_NONOFFLOAD_MODE_ONLY AUDCLNT_ERR(0x025)")
455 cpp_quote
("#define AUDCLNT_E_RESOURCES_INVALIDATED AUDCLNT_ERR(0x026)")
456 cpp_quote
("#define AUDCLNT_E_RAW_MODE_UNSUPPORTED AUDCLNT_ERR(0x027)")
457 cpp_quote
("#define AUDCLNT_E_ENGINE_PERIODICITY_LOCKED AUDCLNT_ERR(0x028)")
458 cpp_quote
("#define AUDCLNT_E_ENGINE_FORMAT_LOCKED AUDCLNT_ERR(0x029)")
459 cpp_quote
("#define AUDCLNT_E_HEADTRACKING_ENABLED AUDCLNT_ERR(0x030)")
460 cpp_quote
("#define AUDCLNT_E_HEADTRACKING_UNSUPPORTED AUDCLNT_ERR(0x040)")
462 cpp_quote
("#define AUDCLNT_S_BUFFER_EMPTY AUDCLNT_SUCCESS(0x1)")
463 cpp_quote
("#define AUDCLNT_S_THREAD_ALREADY_REGISTERED AUDCLNT_SUCCESS(0x2)")
464 cpp_quote
("#define AUDCLNT_S_POSITION_STALLED AUDCLNT_SUCCESS(0x3)")