widl: Make headers guards compatible with midl.
[wine] / include / audioclient.idl
1 /*
2  * Core Audio audioclient definitions
3  *
4  * Copyright 2009 Maarten Lankhorst
5  *
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.
10  *
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.
15  *
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
19  *
20  */
21
22 import "wtypes.idl";
23 import "unknwn.idl";
24 import "audiosessiontypes.h";
25
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;
36
37 cpp_quote("#if 0")
38 typedef struct WAVEFORMATEX /*[hidden,restricted]*/
39 {
40     WORD wFormatTag;
41     WORD nChannels;
42     DWORD nSamplesPerSec;
43     DWORD nAvgBytesPerSec;
44     WORD nBlockAlign;
45     WORD wBitsPerSample;
46     WORD cbSize;
47 } WAVEFORMATEX;
48 cpp_quote("#else")
49 cpp_quote("#include <mmreg.h>")
50 cpp_quote("#endif")
51
52 cpp_quote("#if 0")
53 typedef LONGLONG /*[hidden,restricted]*/ REFERENCE_TIME;
54 cpp_quote("#else")
55 cpp_quote("#define _IKsControl_")
56 cpp_quote("#include <ks.h>")
57 cpp_quote("#include <ksmedia.h>")
58 cpp_quote("#endif")
59
60 enum _AUDCLNT_BUFFERFLAGS
61 {
62     AUDCLNT_BUFFERFLAGS_DATA_DISCONTINUITY = 0x1,
63     AUDCLNT_BUFFERFLAGS_SILENT = 0x2,
64     AUDCLNT_BUFFERFLAGS_TIMESTAMP_ERROR = 0x4
65 };
66
67 [
68     local,
69     pointer_default(unique),
70     uuid(1cb9ad4c-dbfa-4c32-b178-c2f568a703b2),
71     object,
72 ]
73 interface IAudioClient : IUnknown
74 {
75     HRESULT Initialize(
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
82     );
83     HRESULT GetBufferSize(
84         [out] UINT32 *pNumBufferFrames
85     );
86     HRESULT GetStreamLatency(
87         [out] REFERENCE_TIME *phnsLatency
88     );
89     HRESULT GetCurrentPadding(
90         [out] UINT32 *pNumPaddingFrames
91     );
92     HRESULT IsFormatSupported(
93         [in] AUDCLNT_SHAREMODE ShareMode,
94         [in] const WAVEFORMATEX *pFormat,
95         [out,unique] WAVEFORMATEX **ppClosestMatch
96     );
97     HRESULT GetMixFormat(
98         [out] WAVEFORMATEX **ppDeviceFormat
99     );
100     HRESULT GetDevicePeriod(
101         [out] REFERENCE_TIME *phnsDefaultDevicePeriod,
102         [out] REFERENCE_TIME *phnsMinimumDevicePeriod
103     );
104     HRESULT Start(void);
105     HRESULT Stop(void);
106     HRESULT Reset(void);
107     HRESULT SetEventHandle([in] HANDLE eventHandle);
108     HRESULT GetService(
109         [in] REFIID riid,
110         [iid_is(riid),out] void **ppv
111     );
112 }
113
114 [
115     local,
116     pointer_default(unique),
117     uuid(f294acfc-3146-4483-a7bf-addca7c260e2),
118     object,
119 ]
120 interface IAudioRenderClient : IUnknown
121 {
122     HRESULT GetBuffer(
123         [in] UINT32 NumFramesRequested,
124         [out] BYTE **ppData
125     );
126     HRESULT ReleaseBuffer(
127         [in] UINT32 NumFramesWritten,
128         [in] DWORD dwFlags
129     );
130 }
131
132 [
133     local,
134     pointer_default(unique),
135     uuid(c8adbd64-e71e-48a0-a4de-185c395cd317),
136     object,
137 ]
138 interface IAudioCaptureClient : IUnknown
139 {
140     HRESULT GetBuffer(
141         [out] BYTE **ppData,
142         [out] UINT32 *pNumFramesToRead,
143         [out] DWORD *pdwFlags,
144         [unique,out] UINT64 *pu64DevicePosition,
145         [unique,out] UINT64 *pu64QPCPosition
146     );
147     HRESULT ReleaseBuffer(
148         [in] UINT32 NumFramesRead
149     );
150     HRESULT GetNextPacketSize(
151         [out] UINT32 *pNumFramesInNextPacket
152     );
153 }
154
155 cpp_quote("#define AUDIOCLOCK_CHARACTERISTIC_FIXED_FREQ 0x00000001")
156
157 [
158     local,
159     pointer_default(unique),
160     uuid("cd63314f-3fba-4a1b-812c-ef96358728e7"),
161     object,
162 ]
163 interface IAudioClock : IUnknown
164 {
165     HRESULT GetFrequency(
166         [out] UINT64 *pu64Frequency
167     );
168     HRESULT GetPosition(
169         [out] UINT64 *pu64Position,
170         [out,unique] UINT64 *pu64QPCPosition
171     );
172     HRESULT GetCharacteristics(
173         [out] DWORD *pdwCharacteristics
174     );
175 }
176
177 [
178     local,
179     pointer_default(unique),
180     uuid("6f49ff73-6727-49ac-a008-d98cf5e70048"),
181     object,
182 ]
183 interface IAudioClock2 : IUnknown
184 {
185     HRESULT GetPosition(
186         [out] UINT64 *DevicePosition,
187         [out,unique] UINT64 *QPCPosition
188     );
189 }
190
191 [
192     local,
193     pointer_default(unique),
194     uuid("f6e4c0a0-46d9-4fb9-be21-57a3ef2b626c"),
195     object,
196 ]
197 interface IAudioClockAdjustment : IUnknown
198 {
199     HRESULT SetSampleRate(
200         [in] float flSampleRate
201     );
202 }
203
204 [
205     local,
206     pointer_default(unique),
207     uuid("87ce5498-68d6-44e5-9215-6da47ef883d8"),
208     object,
209 ]
210 interface ISimpleAudioVolume : IUnknown
211 {
212     HRESULT SetMasterVolume(
213         [in] float fLevel,
214         [unique,in] LPCGUID EventContext
215     );
216     HRESULT GetMasterVolume(
217         [out] float *pfLevel
218     );
219     HRESULT SetMute(
220         [in] const BOOL bMute,
221         [unique,in] LPCGUID EventContext
222     );
223     HRESULT GetMute(
224         [out] BOOL *pbMute
225     );
226 }
227
228 [
229     local,
230     pointer_default(unique),
231     uuid("93014887-242d-4068-8a15-cf5e93b90fe3"),
232     object,
233 ]
234 interface IAudioStreamVolume : IUnknown
235 {
236     HRESULT GetChannelCount(
237         [out] UINT32 *pdwCount
238     );
239     HRESULT SetChannelVolume(
240         [in] UINT32 dwIndex,
241         [in] const float fLevel
242     );
243     HRESULT GetChannelVolume(
244         [in] UINT32 dwIndex,
245         [out] float *pfLevel
246     );
247     HRESULT SetAllVolumes(
248         [in] UINT32 dwCount,
249         [size_is(dwCount),in] const float *pfVolumes
250     );
251     HRESULT GetAllVolumes(
252         [in] UINT32 dwCount,
253         [size_is(dwCount),out] float *pfVolumes
254     );
255 }
256
257 [
258     local,
259     pointer_default(unique),
260     uuid("1c158861-b533-4b30-b1cf-e853e51c59b8"),
261     object,
262 ]
263 interface IChannelAudioVolume : IUnknown
264 {
265     HRESULT GetChannelCount(
266         [out] UINT32 *pdwCount
267     );
268     HRESULT SetChannelVolume(
269         [in] UINT32 dwIndex,
270         [in] const float fLevel,
271         [unique,in] LPCGUID EventContext
272     );
273     HRESULT GetChannelVolume(
274         [in] UINT32 dwIndex,
275         [out] float *pfLevel
276     );
277     HRESULT SetAllVolumes(
278         [in] UINT32 dwCount,
279         [size_is(dwCount),in] const float *pfVolumes,
280         [unique,in] LPCGUID EventContext
281     );
282     HRESULT GetAllVolumes(
283         [in] UINT32 dwCount,
284         [size_is(dwCount),out] float *pfVolumes
285     );
286 }
287
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)")
316 /* Hex fail */
317 cpp_quote("#define AUDCLNT_E_INVALID_DEVICE_PERIOD AUDCLNT_ERR(0x20)")
318
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)")