xref: /reactos/sdk/include/psdk/audioclient.idl (revision c2c66aff)
1*c2c66affSColin Finck/*
2*c2c66affSColin Finck * Core Audio audioclient definitions
3*c2c66affSColin Finck *
4*c2c66affSColin Finck * Copyright 2009 Maarten Lankhorst
5*c2c66affSColin Finck *
6*c2c66affSColin Finck * This library is free software; you can redistribute it and/or
7*c2c66affSColin Finck * modify it under the terms of the GNU Lesser General Public
8*c2c66affSColin Finck * License as published by the Free Software Foundation; either
9*c2c66affSColin Finck * version 2.1 of the License, or (at your option) any later version.
10*c2c66affSColin Finck *
11*c2c66affSColin Finck * This library is distributed in the hope that it will be useful,
12*c2c66affSColin Finck * but WITHOUT ANY WARRANTY; without even the implied warranty of
13*c2c66affSColin Finck * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14*c2c66affSColin Finck * Lesser General Public License for more details.
15*c2c66affSColin Finck *
16*c2c66affSColin Finck * You should have received a copy of the GNU Lesser General Public
17*c2c66affSColin Finck * License along with this library; if not, write to the Free Software
18*c2c66affSColin Finck * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19*c2c66affSColin Finck *
20*c2c66affSColin Finck */
21*c2c66affSColin Finck
22*c2c66affSColin Finckimport "wtypes.idl";
23*c2c66affSColin Finckimport "unknwn.idl";
24*c2c66affSColin Finckimport "audiosessiontypes.h";
25*c2c66affSColin Finck
26*c2c66affSColin Finck/* Forward declarations */
27*c2c66affSColin Finckinterface IAudioClient;
28*c2c66affSColin Finckinterface IAudioRenderClient;
29*c2c66affSColin Finckinterface IAudioCaptureClient;
30*c2c66affSColin Finckinterface IAudioClock;
31*c2c66affSColin Finckinterface IAudioClock2;
32*c2c66affSColin Finckinterface IAudioClockAdjustment;
33*c2c66affSColin Finckinterface ISimpleAudioVolume;
34*c2c66affSColin Finckinterface IAudioStreamVolume;
35*c2c66affSColin Finckinterface IChannelAudioVolume;
36*c2c66affSColin Finck
37*c2c66affSColin Finckcpp_quote("#if 0")
38*c2c66affSColin Fincktypedef struct WAVEFORMATEX /*[hidden,restricted]*/
39*c2c66affSColin Finck{
40*c2c66affSColin Finck    WORD wFormatTag;
41*c2c66affSColin Finck    WORD nChannels;
42*c2c66affSColin Finck    DWORD nSamplesPerSec;
43*c2c66affSColin Finck    DWORD nAvgBytesPerSec;
44*c2c66affSColin Finck    WORD nBlockAlign;
45*c2c66affSColin Finck    WORD wBitsPerSample;
46*c2c66affSColin Finck    WORD cbSize;
47*c2c66affSColin Finck} WAVEFORMATEX;
48*c2c66affSColin Finckcpp_quote("#else")
49*c2c66affSColin Finckcpp_quote("#include <mmreg.h>")
50*c2c66affSColin Finckcpp_quote("#endif")
51*c2c66affSColin Finck
52*c2c66affSColin Finckcpp_quote("#if 0")
53*c2c66affSColin Fincktypedef LONGLONG /*[hidden,restricted]*/ REFERENCE_TIME;
54*c2c66affSColin Finckcpp_quote("#else")
55*c2c66affSColin Finckcpp_quote("#define _IKsControl_")
56*c2c66affSColin Finckcpp_quote("#include <ks.h>")
57*c2c66affSColin Finckcpp_quote("#include <ksmedia.h>")
58*c2c66affSColin Finckcpp_quote("#endif")
59*c2c66affSColin Finck
60*c2c66affSColin Finckenum _AUDCLNT_BUFFERFLAGS
61*c2c66affSColin Finck{
62*c2c66affSColin Finck    AUDCLNT_BUFFERFLAGS_DATA_DISCONTINUITY = 0x1,
63*c2c66affSColin Finck    AUDCLNT_BUFFERFLAGS_SILENT = 0x2,
64*c2c66affSColin Finck    AUDCLNT_BUFFERFLAGS_TIMESTAMP_ERROR = 0x4
65*c2c66affSColin Finck};
66*c2c66affSColin Finck
67*c2c66affSColin Finck[
68*c2c66affSColin Finck    local,
69*c2c66affSColin Finck    pointer_default(unique),
70*c2c66affSColin Finck    uuid(1cb9ad4c-dbfa-4c32-b178-c2f568a703b2),
71*c2c66affSColin Finck    object,
72*c2c66affSColin Finck]
73*c2c66affSColin Finckinterface IAudioClient : IUnknown
74*c2c66affSColin Finck{
75*c2c66affSColin Finck    HRESULT Initialize(
76*c2c66affSColin Finck        [in] AUDCLNT_SHAREMODE ShareMode,
77*c2c66affSColin Finck        [in] DWORD StreamFlags,
78*c2c66affSColin Finck        [in] REFERENCE_TIME hnsBufferDuration,
79*c2c66affSColin Finck        [in] REFERENCE_TIME hnsPeriodicity,
80*c2c66affSColin Finck        [in] const WAVEFORMATEX *pFormat,
81*c2c66affSColin Finck        [in] LPCGUID AudioSessionGuid
82*c2c66affSColin Finck    );
83*c2c66affSColin Finck    HRESULT GetBufferSize(
84*c2c66affSColin Finck        [out] UINT32 *pNumBufferFrames
85*c2c66affSColin Finck    );
86*c2c66affSColin Finck    HRESULT GetStreamLatency(
87*c2c66affSColin Finck        [out] REFERENCE_TIME *phnsLatency
88*c2c66affSColin Finck    );
89*c2c66affSColin Finck    HRESULT GetCurrentPadding(
90*c2c66affSColin Finck        [out] UINT32 *pNumPaddingFrames
91*c2c66affSColin Finck    );
92*c2c66affSColin Finck    HRESULT IsFormatSupported(
93*c2c66affSColin Finck        [in] AUDCLNT_SHAREMODE ShareMode,
94*c2c66affSColin Finck        [in] const WAVEFORMATEX *pFormat,
95*c2c66affSColin Finck        [out,unique] WAVEFORMATEX **ppClosestMatch
96*c2c66affSColin Finck    );
97*c2c66affSColin Finck    HRESULT GetMixFormat(
98*c2c66affSColin Finck        [out] WAVEFORMATEX **ppDeviceFormat
99*c2c66affSColin Finck    );
100*c2c66affSColin Finck    HRESULT GetDevicePeriod(
101*c2c66affSColin Finck        [out] REFERENCE_TIME *phnsDefaultDevicePeriod,
102*c2c66affSColin Finck        [out] REFERENCE_TIME *phnsMinimumDevicePeriod
103*c2c66affSColin Finck    );
104*c2c66affSColin Finck    HRESULT Start(void);
105*c2c66affSColin Finck    HRESULT Stop(void);
106*c2c66affSColin Finck    HRESULT Reset(void);
107*c2c66affSColin Finck    HRESULT SetEventHandle([in] HANDLE eventHandle);
108*c2c66affSColin Finck    HRESULT GetService(
109*c2c66affSColin Finck        [in] REFIID riid,
110*c2c66affSColin Finck        [iid_is(riid),out] void **ppv
111*c2c66affSColin Finck    );
112*c2c66affSColin Finck}
113*c2c66affSColin Finck
114*c2c66affSColin Finck[
115*c2c66affSColin Finck    local,
116*c2c66affSColin Finck    pointer_default(unique),
117*c2c66affSColin Finck    uuid(f294acfc-3146-4483-a7bf-addca7c260e2),
118*c2c66affSColin Finck    object,
119*c2c66affSColin Finck]
120*c2c66affSColin Finckinterface IAudioRenderClient : IUnknown
121*c2c66affSColin Finck{
122*c2c66affSColin Finck    HRESULT GetBuffer(
123*c2c66affSColin Finck        [in] UINT32 NumFramesRequested,
124*c2c66affSColin Finck        [out] BYTE **ppData
125*c2c66affSColin Finck    );
126*c2c66affSColin Finck    HRESULT ReleaseBuffer(
127*c2c66affSColin Finck        [in] UINT32 NumFramesWritten,
128*c2c66affSColin Finck        [in] DWORD dwFlags
129*c2c66affSColin Finck    );
130*c2c66affSColin Finck}
131*c2c66affSColin Finck
132*c2c66affSColin Finck[
133*c2c66affSColin Finck    local,
134*c2c66affSColin Finck    pointer_default(unique),
135*c2c66affSColin Finck    uuid(c8adbd64-e71e-48a0-a4de-185c395cd317),
136*c2c66affSColin Finck    object,
137*c2c66affSColin Finck]
138*c2c66affSColin Finckinterface IAudioCaptureClient : IUnknown
139*c2c66affSColin Finck{
140*c2c66affSColin Finck    HRESULT GetBuffer(
141*c2c66affSColin Finck        [out] BYTE **ppData,
142*c2c66affSColin Finck        [out] UINT32 *pNumFramesToRead,
143*c2c66affSColin Finck        [out] DWORD *pdwFlags,
144*c2c66affSColin Finck        [unique,out] UINT64 *pu64DevicePosition,
145*c2c66affSColin Finck        [unique,out] UINT64 *pu64QPCPosition
146*c2c66affSColin Finck    );
147*c2c66affSColin Finck    HRESULT ReleaseBuffer(
148*c2c66affSColin Finck        [in] UINT32 NumFramesRead
149*c2c66affSColin Finck    );
150*c2c66affSColin Finck    HRESULT GetNextPacketSize(
151*c2c66affSColin Finck        [out] UINT32 *pNumFramesInNextPacket
152*c2c66affSColin Finck    );
153*c2c66affSColin Finck}
154*c2c66affSColin Finck
155*c2c66affSColin Finckcpp_quote("#define AUDIOCLOCK_CHARACTERISTIC_FIXED_FREQ 0x00000001")
156*c2c66affSColin Finck
157*c2c66affSColin Finck[
158*c2c66affSColin Finck    local,
159*c2c66affSColin Finck    pointer_default(unique),
160*c2c66affSColin Finck    uuid("cd63314f-3fba-4a1b-812c-ef96358728e7"),
161*c2c66affSColin Finck    object,
162*c2c66affSColin Finck]
163*c2c66affSColin Finckinterface IAudioClock : IUnknown
164*c2c66affSColin Finck{
165*c2c66affSColin Finck    HRESULT GetFrequency(
166*c2c66affSColin Finck        [out] UINT64 *pu64Frequency
167*c2c66affSColin Finck    );
168*c2c66affSColin Finck    HRESULT GetPosition(
169*c2c66affSColin Finck        [out] UINT64 *pu64Position,
170*c2c66affSColin Finck        [out,unique] UINT64 *pu64QPCPosition
171*c2c66affSColin Finck    );
172*c2c66affSColin Finck    HRESULT GetCharacteristics(
173*c2c66affSColin Finck        [out] DWORD *pdwCharacteristics
174*c2c66affSColin Finck    );
175*c2c66affSColin Finck}
176*c2c66affSColin Finck
177*c2c66affSColin Finck[
178*c2c66affSColin Finck    local,
179*c2c66affSColin Finck    pointer_default(unique),
180*c2c66affSColin Finck    uuid("6f49ff73-6727-49ac-a008-d98cf5e70048"),
181*c2c66affSColin Finck    object,
182*c2c66affSColin Finck]
183*c2c66affSColin Finckinterface IAudioClock2 : IUnknown
184*c2c66affSColin Finck{
185*c2c66affSColin Finck    HRESULT GetPosition(
186*c2c66affSColin Finck        [out] UINT64 *DevicePosition,
187*c2c66affSColin Finck        [out,unique] UINT64 *QPCPosition
188*c2c66affSColin Finck    );
189*c2c66affSColin Finck}
190*c2c66affSColin Finck
191*c2c66affSColin Finck[
192*c2c66affSColin Finck    local,
193*c2c66affSColin Finck    pointer_default(unique),
194*c2c66affSColin Finck    uuid("f6e4c0a0-46d9-4fb9-be21-57a3ef2b626c"),
195*c2c66affSColin Finck    object,
196*c2c66affSColin Finck]
197*c2c66affSColin Finckinterface IAudioClockAdjustment : IUnknown
198*c2c66affSColin Finck{
199*c2c66affSColin Finck    HRESULT SetSampleRate(
200*c2c66affSColin Finck        [in] float flSampleRate
201*c2c66affSColin Finck    );
202*c2c66affSColin Finck}
203*c2c66affSColin Finck
204*c2c66affSColin Finck[
205*c2c66affSColin Finck    local,
206*c2c66affSColin Finck    pointer_default(unique),
207*c2c66affSColin Finck    uuid("87ce5498-68d6-44e5-9215-6da47ef883d8"),
208*c2c66affSColin Finck    object,
209*c2c66affSColin Finck]
210*c2c66affSColin Finckinterface ISimpleAudioVolume : IUnknown
211*c2c66affSColin Finck{
212*c2c66affSColin Finck    HRESULT SetMasterVolume(
213*c2c66affSColin Finck        [in] float fLevel,
214*c2c66affSColin Finck        [unique,in] LPCGUID EventContext
215*c2c66affSColin Finck    );
216*c2c66affSColin Finck    HRESULT GetMasterVolume(
217*c2c66affSColin Finck        [out] float *pfLevel
218*c2c66affSColin Finck    );
219*c2c66affSColin Finck    HRESULT SetMute(
220*c2c66affSColin Finck        [in] const BOOL bMute,
221*c2c66affSColin Finck        [unique,in] LPCGUID EventContext
222*c2c66affSColin Finck    );
223*c2c66affSColin Finck    HRESULT GetMute(
224*c2c66affSColin Finck        [out] BOOL *pbMute
225*c2c66affSColin Finck    );
226*c2c66affSColin Finck}
227*c2c66affSColin Finck
228*c2c66affSColin Finck[
229*c2c66affSColin Finck    local,
230*c2c66affSColin Finck    pointer_default(unique),
231*c2c66affSColin Finck    uuid("93014887-242d-4068-8a15-cf5e93b90fe3"),
232*c2c66affSColin Finck    object,
233*c2c66affSColin Finck]
234*c2c66affSColin Finckinterface IAudioStreamVolume : IUnknown
235*c2c66affSColin Finck{
236*c2c66affSColin Finck    HRESULT GetChannelCount(
237*c2c66affSColin Finck        [out] UINT32 *pdwCount
238*c2c66affSColin Finck    );
239*c2c66affSColin Finck    HRESULT SetChannelVolume(
240*c2c66affSColin Finck        [in] UINT32 dwIndex,
241*c2c66affSColin Finck        [in] const float fLevel
242*c2c66affSColin Finck    );
243*c2c66affSColin Finck    HRESULT GetChannelVolume(
244*c2c66affSColin Finck        [in] UINT32 dwIndex,
245*c2c66affSColin Finck        [out] float *pfLevel
246*c2c66affSColin Finck    );
247*c2c66affSColin Finck    HRESULT SetAllVolumes(
248*c2c66affSColin Finck        [in] UINT32 dwCount,
249*c2c66affSColin Finck        [size_is(dwCount),in] const float *pfVolumes
250*c2c66affSColin Finck    );
251*c2c66affSColin Finck    HRESULT GetAllVolumes(
252*c2c66affSColin Finck        [in] UINT32 dwCount,
253*c2c66affSColin Finck        [size_is(dwCount),out] float *pfVolumes
254*c2c66affSColin Finck    );
255*c2c66affSColin Finck}
256*c2c66affSColin Finck
257*c2c66affSColin Finck[
258*c2c66affSColin Finck    local,
259*c2c66affSColin Finck    pointer_default(unique),
260*c2c66affSColin Finck    uuid("1c158861-b533-4b30-b1cf-e853e51c59b8"),
261*c2c66affSColin Finck    object,
262*c2c66affSColin Finck]
263*c2c66affSColin Finckinterface IChannelAudioVolume : IUnknown
264*c2c66affSColin Finck{
265*c2c66affSColin Finck    HRESULT GetChannelCount(
266*c2c66affSColin Finck        [out] UINT32 *pdwCount
267*c2c66affSColin Finck    );
268*c2c66affSColin Finck    HRESULT SetChannelVolume(
269*c2c66affSColin Finck        [in] UINT32 dwIndex,
270*c2c66affSColin Finck        [in] const float fLevel,
271*c2c66affSColin Finck        [unique,in] LPCGUID EventContext
272*c2c66affSColin Finck    );
273*c2c66affSColin Finck    HRESULT GetChannelVolume(
274*c2c66affSColin Finck        [in] UINT32 dwIndex,
275*c2c66affSColin Finck        [out] float *pfLevel
276*c2c66affSColin Finck    );
277*c2c66affSColin Finck    HRESULT SetAllVolumes(
278*c2c66affSColin Finck        [in] UINT32 dwCount,
279*c2c66affSColin Finck        [size_is(dwCount),in] const float *pfVolumes,
280*c2c66affSColin Finck        [unique,in] LPCGUID EventContext
281*c2c66affSColin Finck    );
282*c2c66affSColin Finck    HRESULT GetAllVolumes(
283*c2c66affSColin Finck        [in] UINT32 dwCount,
284*c2c66affSColin Finck        [size_is(dwCount),out] float *pfVolumes
285*c2c66affSColin Finck    );
286*c2c66affSColin Finck}
287*c2c66affSColin Finck
288*c2c66affSColin Finckcpp_quote("#define FACILIY_AUDCLNT 0x889")
289*c2c66affSColin Finckcpp_quote("#define AUDCLNT_ERR(n) MAKE_HRESULT(SEVERITY_ERROR, FACILIY_AUDCLNT, n)")
290*c2c66affSColin Finckcpp_quote("#define AUDCLNT_SUCCESS(n) MAKE_SCODE(SEVERITY_SUCCESS, FACILIY_AUDCLNT, n)")
291*c2c66affSColin Finckcpp_quote("#define AUDCLNT_E_NOT_INITIALIZED AUDCLNT_ERR(1)")
292*c2c66affSColin Finckcpp_quote("#define AUDCLNT_E_ALREADY_INITIALIZED AUDCLNT_ERR(2)")
293*c2c66affSColin Finckcpp_quote("#define AUDCLNT_E_WRONG_ENDPOINT_TYPE AUDCLNT_ERR(3)")
294*c2c66affSColin Finckcpp_quote("#define AUDCLNT_E_DEVICE_INVALIDATED AUDCLNT_ERR(4)")
295*c2c66affSColin Finckcpp_quote("#define AUDCLNT_E_NOT_STOPPED AUDCLNT_ERR(5)")
296*c2c66affSColin Finckcpp_quote("#define AUDCLNT_E_BUFFER_TOO_LARGE AUDCLNT_ERR(6)")
297*c2c66affSColin Finckcpp_quote("#define AUDCLNT_E_OUT_OF_ORDER AUDCLNT_ERR(7)")
298*c2c66affSColin Finckcpp_quote("#define AUDCLNT_E_UNSUPPORTED_FORMAT AUDCLNT_ERR(8)")
299*c2c66affSColin Finckcpp_quote("#define AUDCLNT_E_INVALID_SIZE AUDCLNT_ERR(9)")
300*c2c66affSColin Finckcpp_quote("#define AUDCLNT_E_DEVICE_IN_USE AUDCLNT_ERR(0x0a)")
301*c2c66affSColin Finckcpp_quote("#define AUDCLNT_E_BUFFER_OPERATION_PENDING AUDCLNT_ERR(0x0b)")
302*c2c66affSColin Finckcpp_quote("#define AUDCLNT_E_THREAD_NOT_REGISTERED AUDCLNT_ERR(0x0c)")
303*c2c66affSColin Finck/* Not defined? cpp_quote("#define AUDCLNT_E_UNKNOWN_XXX1 AUDCLNT_ERR(0x0d)") */
304*c2c66affSColin Finckcpp_quote("#define AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED AUDCLNT_ERR(0x0e)")
305*c2c66affSColin Finckcpp_quote("#define AUDCLNT_E_ENDPOINT_CREATE_FAILED AUDCLNT_ERR(0x0f)")
306*c2c66affSColin Finckcpp_quote("#define AUDCLNT_E_SERVICE_NOT_RUNNING AUDCLNT_ERR(0x10)")
307*c2c66affSColin Finckcpp_quote("#define AUDCLNT_E_EVENTHANDLE_NOT_EXPECTED AUDCLNT_ERR(0x11)")
308*c2c66affSColin Finckcpp_quote("#define AUDCLNT_E_EXCLUSIVE_MODE_ONLY AUDCLNT_ERR(0x12)")
309*c2c66affSColin Finckcpp_quote("#define AUDCLNT_E_BUFDURATION_PERIOD_NOT_EQUAL AUDCLNT_ERR(0x13)")
310*c2c66affSColin Finckcpp_quote("#define AUDCLNT_E_EVENTHANDLE_NOT_SET AUDCLNT_ERR(0x14)")
311*c2c66affSColin Finckcpp_quote("#define AUDCLNT_E_INCORRECT_BUFFER_SIZE AUDCLNT_ERR(0x15)")
312*c2c66affSColin Finckcpp_quote("#define AUDCLNT_E_BUFFER_SIZE_ERROR AUDCLNT_ERR(0x16)")
313*c2c66affSColin Finckcpp_quote("#define AUDCLNT_E_CPUUSAGE_EXCEEDED AUDCLNT_ERR(0x17)")
314*c2c66affSColin Finckcpp_quote("#define AUDCLNT_E_BUFFER_ERROR AUDCLNT_ERR(0x18)")
315*c2c66affSColin Finckcpp_quote("#define AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED AUDCLNT_ERR(0x19)")
316*c2c66affSColin Finck/* Hex fail */
317*c2c66affSColin Finckcpp_quote("#define AUDCLNT_E_INVALID_DEVICE_PERIOD AUDCLNT_ERR(0x20)")
318*c2c66affSColin Finckcpp_quote("#define AUDCLNT_E_INVALID_STREAM_FLAG AUDCLNT_ERR(0x021)")
319*c2c66affSColin Finckcpp_quote("#define AUDCLNT_E_ENDPOINT_OFFLOAD_NOT_CAPABLE AUDCLNT_ERR(0x022)")
320*c2c66affSColin Finckcpp_quote("#define AUDCLNT_E_OUT_OF_OFFLOAD_RESOURCES AUDCLNT_ERR(0x023)")
321*c2c66affSColin Finckcpp_quote("#define AUDCLNT_E_OFFLOAD_MODE_ONLY AUDCLNT_ERR(0x024)")
322*c2c66affSColin Finckcpp_quote("#define AUDCLNT_E_NONOFFLOAD_MODE_ONLY AUDCLNT_ERR(0x025)")
323*c2c66affSColin Finckcpp_quote("#define AUDCLNT_E_RESOURCES_INVALIDATED AUDCLNT_ERR(0x026)")
324*c2c66affSColin Finck
325*c2c66affSColin Finckcpp_quote("#define AUDCLNT_S_BUFFER_EMPTY AUDCLNT_SUCCESS(0x1)")
326*c2c66affSColin Finckcpp_quote("#define AUDCLNT_S_THREAD_ALREADY_REGISTERED AUDCLNT_SUCCESS(0x2)")
327*c2c66affSColin Finckcpp_quote("#define AUDCLNT_S_POSITION_STALLED AUDCLNT_SUCCESS(0x3)")
328