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