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
;
131 pointer_default(unique),
132 uuid(726778cd
-f60a
-4eda
-82de
-e47610cd78aa
),
135 interface IAudioClient2
: IAudioClient
137 HRESULT IsOffloadCapable
(
138 AUDIO_STREAM_CATEGORY category
,
139 [out] BOOL
*offload_capable
142 HRESULT SetClientProperties
(
143 [in] const AudioClientProperties
*prop
146 HRESULT GetBufferSizeLimits
(
147 [in] const WAVEFORMATEX
*format
,
149 [out] REFERENCE_TIME
*min_duration
,
150 [out] REFERENCE_TIME
*max_duration
156 pointer_default(unique),
157 uuid(7ed4ee07
-8e67
-4cd4
-8c1a
-2b7a5987ad42
),
160 interface IAudioClient3
: IAudioClient2
162 HRESULT GetSharedModeEnginePeriod
(
163 [in] const WAVEFORMATEX
*format
,
164 [out] UINT32
*default_period_frames
,
165 [out] UINT32
*unit_period_frames
,
166 [out] UINT32
*min_period_frames
,
167 [out] UINT32
*max_period_frames
170 HRESULT GetCurrentSharedModeEnginePeriod
(
171 [out] WAVEFORMATEX
**cur_format
,
172 [out] UINT32
*cur_period_frames
175 HRESULT InitializeSharedAudioStream
(
177 [in] UINT32 period_frames
,
178 [in] const WAVEFORMATEX
*format
,
179 [in] const GUID
*session_guid
185 pointer_default(unique),
186 uuid(f294acfc
-3146-4483-a7bf
-addca7c260e2
),
189 interface IAudioRenderClient
: IUnknown
192 [in] UINT32 NumFramesRequested
,
195 HRESULT ReleaseBuffer
(
196 [in] UINT32 NumFramesWritten
,
203 pointer_default(unique),
204 uuid(c8adbd64
-e71e
-48a0
-a4de
-185c395cd317
),
207 interface IAudioCaptureClient
: IUnknown
211 [out] UINT32
*pNumFramesToRead
,
212 [out] DWORD
*pdwFlags
,
213 [unique,out] UINT64
*pu64DevicePosition
,
214 [unique,out] UINT64
*pu64QPCPosition
216 HRESULT ReleaseBuffer
(
217 [in] UINT32 NumFramesRead
219 HRESULT GetNextPacketSize
(
220 [out] UINT32
*pNumFramesInNextPacket
224 cpp_quote
("#define AUDIOCLOCK_CHARACTERISTIC_FIXED_FREQ 0x00000001")
228 pointer_default(unique),
229 uuid("cd63314f-3fba-4a1b-812c-ef96358728e7"),
232 interface IAudioClock
: IUnknown
234 HRESULT GetFrequency
(
235 [out] UINT64
*pu64Frequency
238 [out] UINT64
*pu64Position
,
239 [out,unique] UINT64
*pu64QPCPosition
241 HRESULT GetCharacteristics
(
242 [out] DWORD
*pdwCharacteristics
248 pointer_default(unique),
249 uuid("6f49ff73-6727-49ac-a008-d98cf5e70048"),
252 interface IAudioClock2
: IUnknown
255 [out] UINT64
*DevicePosition
,
256 [out,unique] UINT64
*QPCPosition
262 pointer_default(unique),
263 uuid("f6e4c0a0-46d9-4fb8-be21-57a3ef2b626c"),
266 interface IAudioClockAdjustment
: IUnknown
268 HRESULT SetSampleRate
(
269 [in] float flSampleRate
275 pointer_default(unique),
276 uuid("87ce5498-68d6-44e5-9215-6da47ef883d8"),
279 interface ISimpleAudioVolume
: IUnknown
281 HRESULT SetMasterVolume
(
283 [unique,in] LPCGUID EventContext
285 HRESULT GetMasterVolume
(
289 [in] const BOOL bMute
,
290 [unique,in] LPCGUID EventContext
299 pointer_default(unique),
300 uuid("93014887-242d-4068-8a15-cf5e93b90fe3"),
303 interface IAudioStreamVolume
: IUnknown
305 HRESULT GetChannelCount
(
306 [out] UINT32
*pdwCount
308 HRESULT SetChannelVolume
(
310 [in] const float fLevel
312 HRESULT GetChannelVolume
(
316 HRESULT SetAllVolumes
(
318 [size_is(dwCount
),in] const float *pfVolumes
320 HRESULT GetAllVolumes
(
322 [size_is(dwCount
),out] float *pfVolumes
328 pointer_default(unique),
329 uuid("1c158861-b533-4b30-b1cf-e853e51c59b8"),
332 interface IChannelAudioVolume
: IUnknown
334 HRESULT GetChannelCount
(
335 [out] UINT32
*pdwCount
337 HRESULT SetChannelVolume
(
339 [in] const float fLevel
,
340 [unique,in] LPCGUID EventContext
342 HRESULT GetChannelVolume
(
346 HRESULT SetAllVolumes
(
348 [size_is(dwCount
),in] const float *pfVolumes
,
349 [unique,in] LPCGUID EventContext
351 HRESULT GetAllVolumes
(
353 [size_is(dwCount
),out] float *pfVolumes
357 cpp_quote
("#define AUDCLNT_ERR(n) MAKE_HRESULT(SEVERITY_ERROR, FACILITY_AUDCLNT, n)")
358 cpp_quote
("#define AUDCLNT_SUCCESS(n) MAKE_SCODE(SEVERITY_SUCCESS, FACILITY_AUDCLNT, n)")
359 cpp_quote
("#define AUDCLNT_E_NOT_INITIALIZED AUDCLNT_ERR(1)")
360 cpp_quote
("#define AUDCLNT_E_ALREADY_INITIALIZED AUDCLNT_ERR(2)")
361 cpp_quote
("#define AUDCLNT_E_WRONG_ENDPOINT_TYPE AUDCLNT_ERR(3)")
362 cpp_quote
("#define AUDCLNT_E_DEVICE_INVALIDATED AUDCLNT_ERR(4)")
363 cpp_quote
("#define AUDCLNT_E_NOT_STOPPED AUDCLNT_ERR(5)")
364 cpp_quote
("#define AUDCLNT_E_BUFFER_TOO_LARGE AUDCLNT_ERR(6)")
365 cpp_quote
("#define AUDCLNT_E_OUT_OF_ORDER AUDCLNT_ERR(7)")
366 cpp_quote
("#define AUDCLNT_E_UNSUPPORTED_FORMAT AUDCLNT_ERR(8)")
367 cpp_quote
("#define AUDCLNT_E_INVALID_SIZE AUDCLNT_ERR(9)")
368 cpp_quote
("#define AUDCLNT_E_DEVICE_IN_USE AUDCLNT_ERR(0x0a)")
369 cpp_quote
("#define AUDCLNT_E_BUFFER_OPERATION_PENDING AUDCLNT_ERR(0x0b)")
370 cpp_quote
("#define AUDCLNT_E_THREAD_NOT_REGISTERED AUDCLNT_ERR(0x0c)")
371 /* Not defined? cpp_quote("#define AUDCLNT_E_UNKNOWN_XXX1 AUDCLNT_ERR(0x0d)") */
372 cpp_quote
("#define AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED AUDCLNT_ERR(0x0e)")
373 cpp_quote
("#define AUDCLNT_E_ENDPOINT_CREATE_FAILED AUDCLNT_ERR(0x0f)")
374 cpp_quote
("#define AUDCLNT_E_SERVICE_NOT_RUNNING AUDCLNT_ERR(0x10)")
375 cpp_quote
("#define AUDCLNT_E_EVENTHANDLE_NOT_EXPECTED AUDCLNT_ERR(0x11)")
376 cpp_quote
("#define AUDCLNT_E_EXCLUSIVE_MODE_ONLY AUDCLNT_ERR(0x12)")
377 cpp_quote
("#define AUDCLNT_E_BUFDURATION_PERIOD_NOT_EQUAL AUDCLNT_ERR(0x13)")
378 cpp_quote
("#define AUDCLNT_E_EVENTHANDLE_NOT_SET AUDCLNT_ERR(0x14)")
379 cpp_quote
("#define AUDCLNT_E_INCORRECT_BUFFER_SIZE AUDCLNT_ERR(0x15)")
380 cpp_quote
("#define AUDCLNT_E_BUFFER_SIZE_ERROR AUDCLNT_ERR(0x16)")
381 cpp_quote
("#define AUDCLNT_E_CPUUSAGE_EXCEEDED AUDCLNT_ERR(0x17)")
382 cpp_quote
("#define AUDCLNT_E_BUFFER_ERROR AUDCLNT_ERR(0x18)")
383 cpp_quote
("#define AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED AUDCLNT_ERR(0x19)")
385 cpp_quote
("#define AUDCLNT_E_INVALID_DEVICE_PERIOD AUDCLNT_ERR(0x20)")
386 cpp_quote
("#define AUDCLNT_E_INVALID_STREAM_FLAG AUDCLNT_ERR(0x021)")
387 cpp_quote
("#define AUDCLNT_E_ENDPOINT_OFFLOAD_NOT_CAPABLE AUDCLNT_ERR(0x022)")
388 cpp_quote
("#define AUDCLNT_E_OUT_OF_OFFLOAD_RESOURCES AUDCLNT_ERR(0x023)")
389 cpp_quote
("#define AUDCLNT_E_OFFLOAD_MODE_ONLY AUDCLNT_ERR(0x024)")
390 cpp_quote
("#define AUDCLNT_E_NONOFFLOAD_MODE_ONLY AUDCLNT_ERR(0x025)")
391 cpp_quote
("#define AUDCLNT_E_RESOURCES_INVALIDATED AUDCLNT_ERR(0x026)")
393 cpp_quote
("#define AUDCLNT_S_BUFFER_EMPTY AUDCLNT_SUCCESS(0x1)")
394 cpp_quote
("#define AUDCLNT_S_THREAD_ALREADY_REGISTERED AUDCLNT_SUCCESS(0x2)")
395 cpp_quote
("#define AUDCLNT_S_POSITION_STALLED AUDCLNT_SUCCESS(0x3)")