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
116 pointer_default(unique),
117 uuid(f294acfc-3146-4483-a7bf-addca7c260e2),
120 interface IAudioRenderClient : IUnknown
123 [in] UINT32 NumFramesRequested,
126 HRESULT ReleaseBuffer(
127 [in] UINT32 NumFramesWritten,
134 pointer_default(unique),
135 uuid(c8adbd64-e71e-48a0-a4de-185c395cd317),
138 interface IAudioCaptureClient : IUnknown
142 [out] UINT32 *pNumFramesToRead,
143 [out] DWORD *pdwFlags,
144 [unique,out] UINT64 *pu64DevicePosition,
145 [unique,out] UINT64 *pu64QPCPosition
147 HRESULT ReleaseBuffer(
148 [in] UINT32 NumFramesRead
150 HRESULT GetNextPacketSize(
151 [out] UINT32 *pNumFramesInNextPacket
155 cpp_quote("#define AUDIOCLOCK_CHARACTERISTIC_FIXED_FREQ 0x00000001")
159 pointer_default(unique),
160 uuid("cd63314f-3fba-4a1b-812c-ef96358728e7"),
163 interface IAudioClock : IUnknown
165 HRESULT GetFrequency(
166 [out] UINT64 *pu64Frequency
169 [out] UINT64 *pu64Position,
170 [out,unique] UINT64 *pu64QPCPosition
172 HRESULT GetCharacteristics(
173 [out] DWORD *pdwCharacteristics
179 pointer_default(unique),
180 uuid("6f49ff73-6727-49ac-a008-d98cf5e70048"),
183 interface IAudioClock2 : IUnknown
186 [out] UINT64 *DevicePosition,
187 [out,unique] UINT64 *QPCPosition
193 pointer_default(unique),
194 uuid("f6e4c0a0-46d9-4fb9-be21-57a3ef2b626c"),
197 interface IAudioClockAdjustment : IUnknown
199 HRESULT SetSampleRate(
200 [in] float flSampleRate
206 pointer_default(unique),
207 uuid("87ce5498-68d6-44e5-9215-6da47ef883d8"),
210 interface ISimpleAudioVolume : IUnknown
212 HRESULT SetMasterVolume(
214 [unique,in] LPCGUID EventContext
216 HRESULT GetMasterVolume(
220 [in] const BOOL bMute,
221 [unique,in] LPCGUID EventContext
230 pointer_default(unique),
231 uuid("93014887-242d-4068-8a15-cf5e93b90fe3"),
234 interface IAudioStreamVolume : IUnknown
236 HRESULT GetChannelCount(
237 [out] UINT32 *pdwCount
239 HRESULT SetChannelVolume(
241 [in] const float fLevel
243 HRESULT GetChannelVolume(
247 HRESULT SetAllVolumes(
249 [size_is(dwCount),in] const float *pfVolumes
251 HRESULT GetAllVolumes(
253 [size_is(dwCount),out] float *pfVolumes
259 pointer_default(unique),
260 uuid("1c158861-b533-4b30-b1cf-e853e51c59b8"),
263 interface IChannelAudioVolume : IUnknown
265 HRESULT GetChannelCount(
266 [out] UINT32 *pdwCount
268 HRESULT SetChannelVolume(
270 [in] const float fLevel,
271 [unique,in] LPCGUID EventContext
273 HRESULT GetChannelVolume(
277 HRESULT SetAllVolumes(
279 [size_is(dwCount),in] const float *pfVolumes,
280 [unique,in] LPCGUID EventContext
282 HRESULT GetAllVolumes(
284 [size_is(dwCount),out] float *pfVolumes
288 cpp_quote("#define FACILIY_AUDCLNT 0x889")
289 cpp_quote("#define AUDCLNT_ERR(n) MAKE_HRESULT(SEVERITY_ERROR, FACILIY_AUDCLNT, n)")
290 cpp_quote("#define AUDCLNT_SUCCESS(n) MAKE_SCODE(SEVERITY_SUCCESS, FACILIY_AUDCLNT, n)")
291 cpp_quote("#define AUDCLNT_E_NOT_INITIALIZED AUDCLNT_ERR(1)")
292 cpp_quote("#define AUDCLNT_E_ALREADY_INITIALIZED AUDCLNT_ERR(2)")
293 cpp_quote("#define AUDCLNT_E_WRONG_ENDPOINT_TYPE AUDCLNT_ERR(3)")
294 cpp_quote("#define AUDCLNT_E_DEVICE_INVALIDATED AUDCLNT_ERR(4)")
295 cpp_quote("#define AUDCLNT_E_NOT_STOPPED AUDCLNT_ERR(5)")
296 cpp_quote("#define AUDCLNT_E_BUFFER_TOO_LARGE AUDCLNT_ERR(6)")
297 cpp_quote("#define AUDCLNT_E_OUT_OF_ORDER AUDCLNT_ERR(7)")
298 cpp_quote("#define AUDCLNT_E_UNSUPPORTED_FORMAT AUDCLNT_ERR(8)")
299 cpp_quote("#define AUDCLNT_E_INVALID_SIZE AUDCLNT_ERR(9)")
300 cpp_quote("#define AUDCLNT_E_DEVICE_IN_USE AUDCLNT_ERR(0x0a)")
301 cpp_quote("#define AUDCLNT_E_BUFFER_OPERATION_PENDING AUDCLNT_ERR(0x0b)")
302 cpp_quote("#define AUDCLNT_E_THREAD_NOT_REGISTERED AUDCLNT_ERR(0x0c)")
303 /* Not defined? cpp_quote("#define AUDCLNT_E_UNKNOWN_XXX1 AUDCLNT_ERR(0x0d)") */
304 cpp_quote("#define AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED AUDCLNT_ERR(0x0e)")
305 cpp_quote("#define AUDCLNT_E_ENDPOINT_CREATE_FAILED AUDCLNT_ERR(0x0f)")
306 cpp_quote("#define AUDCLNT_E_SERVICE_NOT_RUNNING AUDCLNT_ERR(0x10)")
307 cpp_quote("#define AUDCLNT_E_EVENTHANDLE_NOT_EXPECTED AUDCLNT_ERR(0x11)")
308 cpp_quote("#define AUDCLNT_E_EXCLUSIVE_MODE_ONLY AUDCLNT_ERR(0x12)")
309 cpp_quote("#define AUDCLNT_E_BUFDURATION_PERIOD_NOT_EQUAL AUDCLNT_ERR(0x13)")
310 cpp_quote("#define AUDCLNT_E_EVENTHANDLE_NOT_SET AUDCLNT_ERR(0x14)")
311 cpp_quote("#define AUDCLNT_E_INCORRECT_BUFFER_SIZE AUDCLNT_ERR(0x15)")
312 cpp_quote("#define AUDCLNT_E_BUFFER_SIZE_ERROR AUDCLNT_ERR(0x16)")
313 cpp_quote("#define AUDCLNT_E_CPUUSAGE_EXCEEDED AUDCLNT_ERR(0x17)")
314 cpp_quote("#define AUDCLNT_E_BUFFER_ERROR AUDCLNT_ERR(0x18)")
315 cpp_quote("#define AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED AUDCLNT_ERR(0x19)")
317 cpp_quote("#define AUDCLNT_E_INVALID_DEVICE_PERIOD AUDCLNT_ERR(0x20)")
319 cpp_quote("#define AUDCLNT_S_BUFFER_EMPTY AUDCLNT_SUCCESS(0x1)")
320 cpp_quote("#define AUDCLNT_S_THREAD_ALREADY_REGISTERED AUDCLNT_SUCCESS(0x2)")
321 cpp_quote("#define AUDCLNT_S_POSITION_STALLED AUDCLNT_SUCCESS(0x3)")