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
22 cpp_quote("#ifndef __audioclient_h__")
23 cpp_quote("#define __audioclient_h__")
27 import "audiosessiontypes.h";
29 /* Forward declarations */
30 interface IAudioClient;
31 interface IAudioRenderClient;
32 interface IAudioCaptureClient;
33 interface IAudioClock;
34 interface IAudioClock2;
35 interface IAudioClockAdjustment;
36 interface ISimpleAudioVolume;
37 interface IAudioStreamVolume;
38 interface IChannelAudioVolume;
41 typedef struct WAVEFORMATEX /*[hidden,restricted]*/
46 DWORD nAvgBytesPerSec;
52 cpp_quote("#include <mmreg.h>")
56 typedef LONGLONG /*[hidden,restricted]*/ REFERENCE_TIME;
58 cpp_quote("#define _IKsControl_")
59 cpp_quote("#include <ks.h>")
60 cpp_quote("#include <ksmedia.h>")
63 enum _AUDCLNT_BUFFERFLAGS
65 AUDCLNT_BUFFERFLAGS_DATA_DISCONTINUITY = 0x1,
66 AUDCLNT_BUFFERFLAGS_SILENT = 0x2,
67 AUDCLNT_BUFFERFLAGS_TIMESTAMP_ERROR = 0x4
72 pointer_default(unique),
73 uuid(1cb9ad4c-dbfa-4c32-b178-c2f568a703b2),
76 interface IAudioClient : IUnknown
79 [in] AUDCLNT_SHAREMODE ShareMode,
80 [in] DWORD StreamFlags,
81 [in] REFERENCE_TIME hnsBufferDuration,
82 [in] REFERENCE_TIME hnsPeriodicity,
83 [in] const WAVEFORMATEX *pFormat,
84 [in] LPCGUID AudioSessionGuid
86 HRESULT GetBufferSize(
87 [out] UINT32 *pNumBufferFrames
89 HRESULT GetStreamLatency(
90 [out] REFERENCE_TIME *phnsLatency
92 HRESULT GetCurrentPadding(
93 [out] UINT32 *pNumPaddingFrames
95 HRESULT IsFormatSupported(
96 [in] AUDCLNT_SHAREMODE ShareMode,
97 [in] const WAVEFORMATEX *pFormat,
98 [out,unique] WAVEFORMATEX **ppClosestMatch
100 HRESULT GetMixFormat(
101 [out] WAVEFORMATEX **ppDeviceFormat
103 HRESULT GetDevicePeriod(
104 [out] REFERENCE_TIME *phnsDefaultDevicePeriod,
105 [out] REFERENCE_TIME *phnsMinimumDevicePeriod
110 HRESULT SetEventHandle([in] HANDLE eventHandle);
113 [iid_is(riid),out] void **ppv
119 pointer_default(unique),
120 uuid(f294acfc-3146-4483-a7bf-addca7c260e2),
123 interface IAudioRenderClient : IUnknown
126 [in] UINT32 NumFramesRequested,
129 HRESULT ReleaseBuffer(
130 [in] UINT32 NumFramesWritten,
137 pointer_default(unique),
138 uuid(c8adbd64-e71e-48a0-a4de-185c395cd317),
141 interface IAudioCaptureClient : IUnknown
145 [out] UINT32 *pNumFramesToRead,
146 [out] DWORD *pdwFlags,
147 [unique,out] UINT64 *pu64DevicePosition,
148 [unique,out] UINT64 *pu64QPCPosition
150 HRESULT ReleaseBuffer(
151 [in] UINT32 NumFramesRead
153 HRESULT GetNextPacketSize(
154 [out] UINT32 *pNumFramesInNextPacket
158 cpp_quote("#define AUDIOCLOCK_CHARACTERISTIC_FIXED_FREQ 0x00000001")
162 pointer_default(unique),
163 uuid("cd63314f-3fba-4a1b-812c-ef96358728e7"),
166 interface IAudioClock : IUnknown
168 HRESULT GetFrequency(
169 [out] UINT64 *pu64Frequency
172 [out] UINT64 *pu64Position,
173 [out,unique] UINT64 *pu64QPCPosition
175 HRESULT GetCharacteristics(
176 [out] DWORD *pdwCharacteristics
182 pointer_default(unique),
183 uuid("6f49ff73-6727-49ac-a008-d98cf5e70048"),
186 interface IAudioClock2 : IUnknown
189 [out] UINT64 *DevicePosition,
190 [out,unique] UINT64 *QPCPosition
196 pointer_default(unique),
197 uuid("f6e4c0a0-46d9-4fb9-be21-57a3ef2b626c"),
200 interface IAudioClockAdjustment : IUnknown
202 HRESULT SetSampleRate(
203 [in] float flSampleRate
209 pointer_default(unique),
210 uuid("87ce5498-68d6-44e5-9215-6da47ef883d8"),
213 interface ISimpleAudioVolume : IUnknown
215 HRESULT SetMasterVolume(
217 [unique,in] LPCGUID EventContext
219 HRESULT GetMasterVolume(
223 [in] const BOOL bMute,
224 [unique,in] LPCGUID EventContext
233 pointer_default(unique),
234 uuid("93014887-242d-4068-8a15-cf5e93b90fe3"),
237 interface IAudioStreamVolume : IUnknown
239 HRESULT GetChannelCount(
240 [out] UINT32 *pdwCount
242 HRESULT SetChannelVolume(
244 [in] const float fLevel
246 HRESULT GetChannelVolume(
250 HRESULT SetAllVolumes(
252 [size_is(dwCount),in] const float *pfVolumes
254 HRESULT GetAllVolumes(
256 [size_is(dwCount),out] float *pfVolumes
262 pointer_default(unique),
263 uuid("1c158861-b533-4b30-b1cf-e853e51c59b8"),
266 interface IChannelAudioVolume : IUnknown
268 HRESULT GetChannelCount(
269 [out] UINT32 *pdwCount
271 HRESULT SetChannelVolume(
273 [in] const float fLevel,
274 [unique,in] LPCGUID EventContext
276 HRESULT GetChannelVolume(
280 HRESULT SetAllVolumes(
282 [size_is(dwCount),in] const float *pfVolumes,
283 [unique,in] LPCGUID EventContext
285 HRESULT GetAllVolumes(
287 [size_is(dwCount),out] float *pfVolumes
291 cpp_quote("#define FACILIY_AUDCLNT 0x889")
292 cpp_quote("#define AUDCLNT_ERR(n) MAKE_HRESULT(SEVERITY_ERROR, FACILIY_AUDCLNT, n)")
293 cpp_quote("#define AUDCLNT_SUCCESS(n) MAKE_SCODE(SEVERITY_SUCCESS, FACILIY_AUDCLNT, n)")
294 cpp_quote("#define AUDCLNT_E_NOT_INITIALIZED AUDCLNT_ERR(1)")
295 cpp_quote("#define AUDCLNT_E_ALREADY_INITIALIZED AUDCLNT_ERR(2)")
296 cpp_quote("#define AUDCLNT_E_WRONG_ENDPOINT_TYPE AUDCLNT_ERR(3)")
297 cpp_quote("#define AUDCLNT_E_DEVICE_INVALIDATED AUDCLNT_ERR(4)")
298 cpp_quote("#define AUDCLNT_E_NOT_STOPPED AUDCLNT_ERR(5)")
299 cpp_quote("#define AUDCLNT_E_BUFFER_TOO_LARGE AUDCLNT_ERR(6)")
300 cpp_quote("#define AUDCLNT_E_OUT_OF_ORDER AUDCLNT_ERR(7)")
301 cpp_quote("#define AUDCLNT_E_UNSUPPORTED_FORMAT AUDCLNT_ERR(8)")
302 cpp_quote("#define AUDCLNT_E_INVALID_SIZE AUDCLNT_ERR(9)")
303 cpp_quote("#define AUDCLNT_E_DEVICE_IN_USE AUDCLNT_ERR(0x0a)")
304 cpp_quote("#define AUDCLNT_E_BUFFER_OPERATION_PENDING AUDCLNT_ERR(0x0b)")
305 cpp_quote("#define AUDCLNT_E_THREAD_NOT_REGISTERED AUDCLNT_ERR(0x0c)")
306 /* Not defined? cpp_quote("#define AUDCLNT_E_UNKNOWN_XXX1 AUDCLNT_ERR(0x0d)") */
307 cpp_quote("#define AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED AUDCLNT_ERR(0x0e)")
308 cpp_quote("#define AUDCLNT_E_ENDPOINT_CREATE_FAILED AUDCLNT_ERR(0x0f)")
309 cpp_quote("#define AUDCLNT_E_SERVICE_NOT_RUNNING AUDCLNT_ERR(0x10)")
310 cpp_quote("#define AUDCLNT_E_EVENTHANDLE_NOT_EXPECTED AUDCLNT_ERR(0x11)")
311 cpp_quote("#define AUDCLNT_E_EXCLUSIVE_MODE_ONLY AUDCLNT_ERR(0x12)")
312 cpp_quote("#define AUDCLNT_E_BUFDURATION_PERIOD_NOT_EQUAL AUDCLNT_ERR(0x13)")
313 cpp_quote("#define AUDCLNT_E_EVENTHANDLE_NOT_SET AUDCLNT_ERR(0x14)")
314 cpp_quote("#define AUDCLNT_E_INCORRECT_BUFFER_SIZE AUDCLNT_ERR(0x15)")
315 cpp_quote("#define AUDCLNT_E_BUFFER_SIZE_ERROR AUDCLNT_ERR(0x16)")
316 cpp_quote("#define AUDCLNT_E_CPUUSAGE_EXCEEDED AUDCLNT_ERR(0x17)")
317 cpp_quote("#define AUDCLNT_E_BUFFER_ERROR AUDCLNT_ERR(0x18)")
318 cpp_quote("#define AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED AUDCLNT_ERR(0x19)")
320 cpp_quote("#define AUDCLNT_E_INVALID_DEVICE_PERIOD AUDCLNT_ERR(0x20)")
322 cpp_quote("#define AUDCLNT_S_BUFFER_EMPTY AUDCLNT_SUCCESS(0x1)")
323 cpp_quote("#define AUDCLNT_S_THREAD_ALREADY_REGISTERED AUDCLNT_SUCCESS(0x2)")
324 cpp_quote("#define AUDCLNT_S_POSITION_STALLED AUDCLNT_SUCCESS(0x3)")
326 cpp_quote("#endif /*__audioclient_h__*/")