widl: Set the default calling convention at header generation time, not at parsing...
[wine/hramrach.git] / dlls / mmdevapi / audiovolume.c
blob0a0dbc44e303a6a50d50d7b394e020af5071ed8d
1 /*
2 * Copyright 2010 Maarten Lankhorst for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #define NONAMELESSUNION
21 #define COBJMACROS
22 #include "config.h"
24 #include <stdarg.h>
25 #ifdef HAVE_AL_AL_H
26 #include <AL/al.h>
27 #include <AL/alc.h>
28 #elif defined(HAVE_OPENAL_AL_H)
29 #include <OpenAL/al.h>
30 #include <OpenAL/alc.h>
31 #endif
33 #include "windef.h"
34 #include "winbase.h"
35 #include "winnls.h"
36 #include "winreg.h"
37 #include "wine/debug.h"
38 #include "wine/unicode.h"
40 #include "ole2.h"
41 #include "mmdeviceapi.h"
42 #include "dshow.h"
43 #include "dsound.h"
44 #include "audioclient.h"
45 #include "endpointvolume.h"
46 #include "audiopolicy.h"
48 #include "mmdevapi.h"
50 WINE_DEFAULT_DEBUG_CHANNEL(mmdevapi);
52 #ifdef HAVE_OPENAL
54 static const IAudioEndpointVolumeExVtbl AEVImpl_Vtbl;
56 typedef struct AEVImpl {
57 const IAudioEndpointVolumeExVtbl *lpVtbl;
58 LONG ref;
59 } AEVImpl;
61 HRESULT AudioEndpointVolume_Create(MMDevice *parent, IAudioEndpointVolume **ppv)
63 AEVImpl *This;
64 This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*This));
65 *ppv = (IAudioEndpointVolume*)This;
66 if (!This)
67 return E_OUTOFMEMORY;
68 This->lpVtbl = &AEVImpl_Vtbl;
69 This->ref = 1;
70 return S_OK;
73 static void AudioEndpointVolume_Destroy(AEVImpl *This)
75 HeapFree(GetProcessHeap(), 0, This);
78 static HRESULT WINAPI AEV_QueryInterface(IAudioEndpointVolumeEx *iface, REFIID riid, void **ppv)
80 AEVImpl *This = (AEVImpl*)iface;
81 TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppv);
82 if (!ppv)
83 return E_POINTER;
84 *ppv = NULL;
85 if (IsEqualIID(riid, &IID_IUnknown) ||
86 IsEqualIID(riid, &IID_IAudioEndpointVolume) ||
87 IsEqualIID(riid, &IID_IAudioEndpointVolumeEx)) {
88 *ppv = This;
90 else
91 return E_NOINTERFACE;
92 IUnknown_AddRef((IUnknown *)*ppv);
93 return S_OK;
96 static ULONG WINAPI AEV_AddRef(IAudioEndpointVolumeEx *iface)
98 AEVImpl *This = (AEVImpl*)iface;
99 ULONG ref = InterlockedIncrement(&This->ref);
100 TRACE("(%p) new ref %u\n", This, ref);
101 return ref;
104 static ULONG WINAPI AEV_Release(IAudioEndpointVolumeEx *iface)
106 AEVImpl *This = (AEVImpl*)iface;
107 ULONG ref = InterlockedDecrement(&This->ref);
108 TRACE("(%p) new ref %u\n", This, ref);
109 if (!ref)
110 AudioEndpointVolume_Destroy(This);
111 return ref;
114 static HRESULT WINAPI AEV_RegisterControlChangeNotify(IAudioEndpointVolumeEx *iface, IAudioEndpointVolumeCallback *notify)
116 TRACE("(%p)->(%p)\n", iface, notify);
117 if (!notify)
118 return E_POINTER;
119 FIXME("stub\n");
120 return S_OK;
123 static HRESULT WINAPI AEV_UnregisterControlChangeNotify(IAudioEndpointVolumeEx *iface, IAudioEndpointVolumeCallback *notify)
125 TRACE("(%p)->(%p)\n", iface, notify);
126 if (!notify)
127 return E_POINTER;
128 FIXME("stub\n");
129 return S_OK;
132 static HRESULT WINAPI AEV_GetChannelCount(IAudioEndpointVolumeEx *iface, UINT *count)
134 TRACE("(%p)->(%p)\n", iface, count);
135 if (!count)
136 return E_POINTER;
137 FIXME("stub\n");
138 return E_NOTIMPL;
141 static HRESULT WINAPI AEV_SetMasterVolumeLevel(IAudioEndpointVolumeEx *iface, float leveldb, const GUID *ctx)
143 TRACE("(%p)->(%f,%s)\n", iface, leveldb, debugstr_guid(ctx));
144 FIXME("stub\n");
145 return E_NOTIMPL;
148 static HRESULT WINAPI AEV_SetMasterVolumeLevelScalar(IAudioEndpointVolumeEx *iface, float level, const GUID *ctx)
150 TRACE("(%p)->(%f,%s)\n", iface, level, debugstr_guid(ctx));
151 FIXME("stub\n");
152 return E_NOTIMPL;
155 static HRESULT WINAPI AEV_GetMasterVolumeLevel(IAudioEndpointVolumeEx *iface, float *leveldb)
157 TRACE("(%p)->(%p)\n", iface, leveldb);
158 if (!leveldb)
159 return E_POINTER;
160 FIXME("stub\n");
161 return E_NOTIMPL;
164 static HRESULT WINAPI AEV_GetMasterVolumeLevelScalar(IAudioEndpointVolumeEx *iface, float *level)
166 TRACE("(%p)->(%p)\n", iface, level);
167 if (!level)
168 return E_POINTER;
169 FIXME("stub\n");
170 return E_NOTIMPL;
173 static HRESULT WINAPI AEV_SetChannelVolumeLevel(IAudioEndpointVolumeEx *iface, UINT chan, float leveldb, const GUID *ctx)
175 TRACE("(%p)->(%f,%s)\n", iface, leveldb, debugstr_guid(ctx));
176 FIXME("stub\n");
177 return E_NOTIMPL;
180 static HRESULT WINAPI AEV_SetChannelVolumeLevelScalar(IAudioEndpointVolumeEx *iface, UINT chan, float level, const GUID *ctx)
182 TRACE("(%p)->(%u,%f,%s)\n", iface, chan, level, debugstr_guid(ctx));
183 FIXME("stub\n");
184 return E_NOTIMPL;
187 static HRESULT WINAPI AEV_GetChannelVolumeLevel(IAudioEndpointVolumeEx *iface, UINT chan, float *leveldb)
189 TRACE("(%p)->(%u,%p)\n", iface, chan, leveldb);
190 if (!leveldb)
191 return E_POINTER;
192 FIXME("stub\n");
193 return E_NOTIMPL;
196 static HRESULT WINAPI AEV_GetChannelVolumeLevelScalar(IAudioEndpointVolumeEx *iface, UINT chan, float *level)
198 TRACE("(%p)->(%u,%p)\n", iface, chan, level);
199 if (!level)
200 return E_POINTER;
201 FIXME("stub\n");
202 return E_NOTIMPL;
205 static HRESULT WINAPI AEV_SetMute(IAudioEndpointVolumeEx *iface, BOOL mute, const GUID *ctx)
207 TRACE("(%p)->(%u,%s)\n", iface, mute, debugstr_guid(ctx));
208 FIXME("stub\n");
209 return E_NOTIMPL;
212 static HRESULT WINAPI AEV_GetMute(IAudioEndpointVolumeEx *iface, BOOL *mute)
214 TRACE("(%p)->(%p)\n", iface, mute);
215 if (!mute)
216 return E_POINTER;
217 FIXME("stub\n");
218 return E_NOTIMPL;
221 static HRESULT WINAPI AEV_GetVolumeStepInfo(IAudioEndpointVolumeEx *iface, UINT *stepsize, UINT *stepcount)
223 TRACE("(%p)->(%p,%p)\n", iface, stepsize, stepcount);
224 if (!stepsize && !stepcount)
225 return E_POINTER;
226 FIXME("stub\n");
227 return E_NOTIMPL;
230 static HRESULT WINAPI AEV_VolumeStepUp(IAudioEndpointVolumeEx *iface, const GUID *ctx)
232 TRACE("(%p)->(%s)\n", iface, debugstr_guid(ctx));
233 FIXME("stub\n");
234 return E_NOTIMPL;
237 static HRESULT WINAPI AEV_VolumeStepDown(IAudioEndpointVolumeEx *iface, const GUID *ctx)
239 TRACE("(%p)->(%s)\n", iface, debugstr_guid(ctx));
240 FIXME("stub\n");
241 return E_NOTIMPL;
244 static HRESULT WINAPI AEV_QueryHardwareSupport(IAudioEndpointVolumeEx *iface, DWORD *mask)
246 TRACE("(%p)->(%p)\n", iface, mask);
247 if (!mask)
248 return E_POINTER;
249 FIXME("stub\n");
250 return E_NOTIMPL;
253 static HRESULT WINAPI AEV_GetVolumeRange(IAudioEndpointVolumeEx *iface, float *mindb, float *maxdb, float *inc)
255 TRACE("(%p)->(%p,%p,%p)\n", iface, mindb, maxdb, inc);
256 if (!mindb || !maxdb || !inc)
257 return E_POINTER;
258 FIXME("stub\n");
259 return E_NOTIMPL;
262 static HRESULT WINAPI AEV_GetVolumeRangeChannel(IAudioEndpointVolumeEx *iface, UINT chan, float *mindb, float *maxdb, float *inc)
264 TRACE("(%p)->(%p,%p,%p)\n", iface, mindb, maxdb, inc);
265 if (!mindb || !maxdb || !inc)
266 return E_POINTER;
267 FIXME("stub\n");
268 return E_NOTIMPL;
271 static const IAudioEndpointVolumeExVtbl AEVImpl_Vtbl = {
272 AEV_QueryInterface,
273 AEV_AddRef,
274 AEV_Release,
275 AEV_RegisterControlChangeNotify,
276 AEV_UnregisterControlChangeNotify,
277 AEV_GetChannelCount,
278 AEV_SetMasterVolumeLevel,
279 AEV_SetMasterVolumeLevelScalar,
280 AEV_GetMasterVolumeLevel,
281 AEV_GetMasterVolumeLevelScalar,
282 AEV_SetChannelVolumeLevel,
283 AEV_SetChannelVolumeLevelScalar,
284 AEV_GetChannelVolumeLevel,
285 AEV_GetChannelVolumeLevelScalar,
286 AEV_SetMute,
287 AEV_GetMute,
288 AEV_GetVolumeStepInfo,
289 AEV_VolumeStepUp,
290 AEV_VolumeStepDown,
291 AEV_QueryHardwareSupport,
292 AEV_GetVolumeRange,
293 AEV_GetVolumeRangeChannel
296 #endif