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
= 0,
117 AUDCLNT_STREAMOPTIONS_RAW
= 1,
118 AUDCLNT_STREAMOPTIONS_MATCH_FORMAT
= 2,
119 } AUDCLNT_STREAMOPTIONS
;
121 typedef struct _AudioClientProperties
125 AUDIO_STREAM_CATEGORY eCategory
;
126 AUDCLNT_STREAMOPTIONS Options
;
127 } AudioClientProperties
;
129 typedef struct _Win8AudioClientProperties
133 AUDIO_STREAM_CATEGORY eCategory
;
134 /* Options field added in Win 8.1 */
135 } Win8AudioClientProperties
;
139 pointer_default(unique),
140 uuid(726778cd
-f60a
-4eda
-82de
-e47610cd78aa
),
143 interface IAudioClient2
: IAudioClient
145 HRESULT IsOffloadCapable
(
146 AUDIO_STREAM_CATEGORY category
,
147 [out] BOOL
*offload_capable
150 HRESULT SetClientProperties
(
151 [in] const AudioClientProperties
*prop
154 HRESULT GetBufferSizeLimits
(
155 [in] const WAVEFORMATEX
*format
,
157 [out] REFERENCE_TIME
*min_duration
,
158 [out] REFERENCE_TIME
*max_duration
164 pointer_default(unique),
165 uuid(7ed4ee07
-8e67
-4cd4
-8c1a
-2b7a5987ad42
),
168 interface IAudioClient3
: IAudioClient2
170 HRESULT GetSharedModeEnginePeriod
(
171 [in] const WAVEFORMATEX
*format
,
172 [out] UINT32
*default_period_frames
,
173 [out] UINT32
*unit_period_frames
,
174 [out] UINT32
*min_period_frames
,
175 [out] UINT32
*max_period_frames
178 HRESULT GetCurrentSharedModeEnginePeriod
(
179 [out] WAVEFORMATEX
**cur_format
,
180 [out] UINT32
*cur_period_frames
183 HRESULT InitializeSharedAudioStream
(
185 [in] UINT32 period_frames
,
186 [in] const WAVEFORMATEX
*format
,
187 [in] const GUID
*session_guid
193 pointer_default(unique),
194 uuid(f294acfc
-3146-4483-a7bf
-addca7c260e2
),
197 interface IAudioRenderClient
: IUnknown
200 [in] UINT32 NumFramesRequested
,
203 HRESULT ReleaseBuffer
(
204 [in] UINT32 NumFramesWritten
,
211 pointer_default(unique),
212 uuid(c8adbd64
-e71e
-48a0
-a4de
-185c395cd317
),
215 interface IAudioCaptureClient
: IUnknown
219 [out] UINT32
*pNumFramesToRead
,
220 [out] DWORD
*pdwFlags
,
221 [unique,out] UINT64
*pu64DevicePosition
,
222 [unique,out] UINT64
*pu64QPCPosition
224 HRESULT ReleaseBuffer
(
225 [in] UINT32 NumFramesRead
227 HRESULT GetNextPacketSize
(
228 [out] UINT32
*pNumFramesInNextPacket
232 cpp_quote
("#define AUDIOCLOCK_CHARACTERISTIC_FIXED_FREQ 0x00000001")
236 pointer_default(unique),
237 uuid("cd63314f-3fba-4a1b-812c-ef96358728e7"),
240 interface IAudioClock
: IUnknown
242 HRESULT GetFrequency
(
243 [out] UINT64
*pu64Frequency
246 [out] UINT64
*pu64Position
,
247 [out,unique] UINT64
*pu64QPCPosition
249 HRESULT GetCharacteristics
(
250 [out] DWORD
*pdwCharacteristics
256 pointer_default(unique),
257 uuid("6f49ff73-6727-49ac-a008-d98cf5e70048"),
260 interface IAudioClock2
: IUnknown
263 [out] UINT64
*DevicePosition
,
264 [out,unique] UINT64
*QPCPosition
270 pointer_default(unique),
271 uuid("f6e4c0a0-46d9-4fb8-be21-57a3ef2b626c"),
274 interface IAudioClockAdjustment
: IUnknown
276 HRESULT SetSampleRate
(
277 [in] float flSampleRate
283 pointer_default(unique),
284 uuid("87ce5498-68d6-44e5-9215-6da47ef883d8"),
287 interface ISimpleAudioVolume
: IUnknown
289 HRESULT SetMasterVolume
(
291 [unique,in] LPCGUID EventContext
293 HRESULT GetMasterVolume
(
297 [in] const BOOL bMute
,
298 [unique,in] LPCGUID EventContext
307 pointer_default(unique),
308 uuid("93014887-242d-4068-8a15-cf5e93b90fe3"),
311 interface IAudioStreamVolume
: IUnknown
313 HRESULT GetChannelCount
(
314 [out] UINT32
*pdwCount
316 HRESULT SetChannelVolume
(
318 [in] const float fLevel
320 HRESULT GetChannelVolume
(
324 HRESULT SetAllVolumes
(
326 [size_is(dwCount
),in] const float *pfVolumes
328 HRESULT GetAllVolumes
(
330 [size_is(dwCount
),out] float *pfVolumes
336 pointer_default(unique),
337 uuid("1c158861-b533-4b30-b1cf-e853e51c59b8"),
340 interface IChannelAudioVolume
: IUnknown
342 HRESULT GetChannelCount
(
343 [out] UINT32
*pdwCount
345 HRESULT SetChannelVolume
(
347 [in] const float fLevel
,
348 [unique,in] LPCGUID EventContext
350 HRESULT GetChannelVolume
(
354 HRESULT SetAllVolumes
(
356 [size_is(dwCount
),in] const float *pfVolumes
,
357 [unique,in] LPCGUID EventContext
359 HRESULT GetAllVolumes
(
361 [size_is(dwCount
),out] float *pfVolumes
365 cpp_quote
("#define AUDCLNT_ERR(n) MAKE_HRESULT(SEVERITY_ERROR, FACILITY_AUDCLNT, n)")
366 cpp_quote
("#define AUDCLNT_SUCCESS(n) MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_AUDCLNT, n)")
367 cpp_quote
("#define AUDCLNT_E_NOT_INITIALIZED AUDCLNT_ERR(1)")
368 cpp_quote
("#define AUDCLNT_E_ALREADY_INITIALIZED AUDCLNT_ERR(2)")
369 cpp_quote
("#define AUDCLNT_E_WRONG_ENDPOINT_TYPE AUDCLNT_ERR(3)")
370 cpp_quote
("#define AUDCLNT_E_DEVICE_INVALIDATED AUDCLNT_ERR(4)")
371 cpp_quote
("#define AUDCLNT_E_NOT_STOPPED AUDCLNT_ERR(5)")
372 cpp_quote
("#define AUDCLNT_E_BUFFER_TOO_LARGE AUDCLNT_ERR(6)")
373 cpp_quote
("#define AUDCLNT_E_OUT_OF_ORDER AUDCLNT_ERR(7)")
374 cpp_quote
("#define AUDCLNT_E_UNSUPPORTED_FORMAT AUDCLNT_ERR(8)")
375 cpp_quote
("#define AUDCLNT_E_INVALID_SIZE AUDCLNT_ERR(9)")
376 cpp_quote
("#define AUDCLNT_E_DEVICE_IN_USE AUDCLNT_ERR(0x0a)")
377 cpp_quote
("#define AUDCLNT_E_BUFFER_OPERATION_PENDING AUDCLNT_ERR(0x0b)")
378 cpp_quote
("#define AUDCLNT_E_THREAD_NOT_REGISTERED AUDCLNT_ERR(0x0c)")
379 /* Not defined? cpp_quote("#define AUDCLNT_E_UNKNOWN_XXX1 AUDCLNT_ERR(0x0d)") */
380 cpp_quote
("#define AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED AUDCLNT_ERR(0x0e)")
381 cpp_quote
("#define AUDCLNT_E_ENDPOINT_CREATE_FAILED AUDCLNT_ERR(0x0f)")
382 cpp_quote
("#define AUDCLNT_E_SERVICE_NOT_RUNNING AUDCLNT_ERR(0x10)")
383 cpp_quote
("#define AUDCLNT_E_EVENTHANDLE_NOT_EXPECTED AUDCLNT_ERR(0x11)")
384 cpp_quote
("#define AUDCLNT_E_EXCLUSIVE_MODE_ONLY AUDCLNT_ERR(0x12)")
385 cpp_quote
("#define AUDCLNT_E_BUFDURATION_PERIOD_NOT_EQUAL AUDCLNT_ERR(0x13)")
386 cpp_quote
("#define AUDCLNT_E_EVENTHANDLE_NOT_SET AUDCLNT_ERR(0x14)")
387 cpp_quote
("#define AUDCLNT_E_INCORRECT_BUFFER_SIZE AUDCLNT_ERR(0x15)")
388 cpp_quote
("#define AUDCLNT_E_BUFFER_SIZE_ERROR AUDCLNT_ERR(0x16)")
389 cpp_quote
("#define AUDCLNT_E_CPUUSAGE_EXCEEDED AUDCLNT_ERR(0x17)")
390 cpp_quote
("#define AUDCLNT_E_BUFFER_ERROR AUDCLNT_ERR(0x18)")
391 cpp_quote
("#define AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED AUDCLNT_ERR(0x19)")
393 cpp_quote
("#define AUDCLNT_E_INVALID_DEVICE_PERIOD AUDCLNT_ERR(0x20)")
394 cpp_quote
("#define AUDCLNT_E_INVALID_STREAM_FLAG AUDCLNT_ERR(0x021)")
395 cpp_quote
("#define AUDCLNT_E_ENDPOINT_OFFLOAD_NOT_CAPABLE AUDCLNT_ERR(0x022)")
396 cpp_quote
("#define AUDCLNT_E_OUT_OF_OFFLOAD_RESOURCES AUDCLNT_ERR(0x023)")
397 cpp_quote
("#define AUDCLNT_E_OFFLOAD_MODE_ONLY AUDCLNT_ERR(0x024)")
398 cpp_quote
("#define AUDCLNT_E_NONOFFLOAD_MODE_ONLY AUDCLNT_ERR(0x025)")
399 cpp_quote
("#define AUDCLNT_E_RESOURCES_INVALIDATED AUDCLNT_ERR(0x026)")
401 cpp_quote
("#define AUDCLNT_S_BUFFER_EMPTY AUDCLNT_SUCCESS(0x1)")
402 cpp_quote
("#define AUDCLNT_S_THREAD_ALREADY_REGISTERED AUDCLNT_SUCCESS(0x2)")
403 cpp_quote
("#define AUDCLNT_S_POSITION_STALLED AUDCLNT_SUCCESS(0x3)")