gameux: Add declaration of IGameStatisticsMgr interface.
[wine/hacks.git] / dlls / mmdevapi / audiovolume.c
blob61cbed488cac7e0f1f0d974450b2c3e60edfc527
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 CINTERFACE
22 #define COBJMACROS
23 #include "config.h"
25 #include <stdarg.h>
26 #ifdef HAVE_AL_AL_H
27 #include <AL/al.h>
28 #include <AL/alc.h>
29 #elif defined(HAVE_OPENAL_AL_H)
30 #include <OpenAL/al.h>
31 #include <OpenAL/alc.h>
32 #endif
34 #include "windef.h"
35 #include "winbase.h"
36 #include "winnls.h"
37 #include "winreg.h"
38 #include "wine/debug.h"
39 #include "wine/unicode.h"
41 #include "ole2.h"
42 #include "mmdeviceapi.h"
43 #include "dshow.h"
44 #include "dsound.h"
45 #include "audioclient.h"
46 #include "endpointvolume.h"
47 #include "audiopolicy.h"
49 #include "mmdevapi.h"
51 WINE_DEFAULT_DEBUG_CHANNEL(mmdevapi);
53 #ifdef HAVE_OPENAL
55 static const IAudioEndpointVolumeExVtbl AEVImpl_Vtbl;
57 typedef struct AEVImpl {
58 const IAudioEndpointVolumeExVtbl *lpVtbl;
59 LONG ref;
60 } AEVImpl;
62 HRESULT AudioEndpointVolume_Create(MMDevice *parent, IAudioEndpointVolume **ppv)
64 AEVImpl *This;
65 This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*This));
66 *ppv = (IAudioEndpointVolume*)This;
67 if (!This)
68 return E_OUTOFMEMORY;
69 This->lpVtbl = &AEVImpl_Vtbl;
70 This->ref = 1;
71 return S_OK;
74 static void AudioEndpointVolume_Destroy(AEVImpl *This)
76 HeapFree(GetProcessHeap(), 0, This);
79 static HRESULT WINAPI AEV_QueryInterface(IAudioEndpointVolumeEx *iface, REFIID riid, void **ppv)
81 AEVImpl *This = (AEVImpl*)iface;
82 TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppv);
83 if (!ppv)
84 return E_POINTER;
85 *ppv = NULL;
86 if (IsEqualIID(riid, &IID_IUnknown) ||
87 IsEqualIID(riid, &IID_IAudioEndpointVolume) ||
88 IsEqualIID(riid, &IID_IAudioEndpointVolumeEx)) {
89 *ppv = This;
91 else
92 return E_NOINTERFACE;
93 IUnknown_AddRef((IUnknown *)*ppv);
94 return S_OK;
97 static ULONG WINAPI AEV_AddRef(IAudioEndpointVolumeEx *iface)
99 AEVImpl *This = (AEVImpl*)iface;
100 ULONG ref = InterlockedIncrement(&This->ref);
101 TRACE("(%p) new ref %u\n", This, ref);
102 return ref;
105 static ULONG WINAPI AEV_Release(IAudioEndpointVolumeEx *iface)
107 AEVImpl *This = (AEVImpl*)iface;
108 ULONG ref = InterlockedDecrement(&This->ref);
109 TRACE("(%p) new ref %u\n", This, ref);
110 if (!ref)
111 AudioEndpointVolume_Destroy(This);
112 return ref;
115 static HRESULT WINAPI AEV_RegisterControlChangeNotify(IAudioEndpointVolumeEx *iface, IAudioEndpointVolumeCallback *notify)
117 TRACE("(%p)->(%p)\n", iface, notify);
118 if (!notify)
119 return E_POINTER;
120 FIXME("stub\n");
121 return S_OK;
124 static HRESULT WINAPI AEV_UnregisterControlChangeNotify(IAudioEndpointVolumeEx *iface, IAudioEndpointVolumeCallback *notify)
126 TRACE("(%p)->(%p)\n", iface, notify);
127 if (!notify)
128 return E_POINTER;
129 FIXME("stub\n");
130 return S_OK;
133 static HRESULT WINAPI AEV_GetChannelCount(IAudioEndpointVolumeEx *iface, UINT *count)
135 TRACE("(%p)->(%p)\n", iface, count);
136 if (!count)
137 return E_POINTER;
138 FIXME("stub\n");
139 return E_NOTIMPL;
142 static HRESULT WINAPI AEV_SetMasterVolumeLevel(IAudioEndpointVolumeEx *iface, float leveldb, const GUID *ctx)
144 TRACE("(%p)->(%f,%s)\n", iface, leveldb, debugstr_guid(ctx));
145 FIXME("stub\n");
146 return E_NOTIMPL;
149 static HRESULT WINAPI AEV_SetMasterVolumeLevelScalar(IAudioEndpointVolumeEx *iface, float level, const GUID *ctx)
151 TRACE("(%p)->(%f,%s)\n", iface, level, debugstr_guid(ctx));
152 FIXME("stub\n");
153 return E_NOTIMPL;
156 static HRESULT WINAPI AEV_GetMasterVolumeLevel(IAudioEndpointVolumeEx *iface, float *leveldb)
158 TRACE("(%p)->(%p)\n", iface, leveldb);
159 if (!leveldb)
160 return E_POINTER;
161 FIXME("stub\n");
162 return E_NOTIMPL;
165 static HRESULT WINAPI AEV_GetMasterVolumeLevelScalar(IAudioEndpointVolumeEx *iface, float *level)
167 TRACE("(%p)->(%p)\n", iface, level);
168 if (!level)
169 return E_POINTER;
170 FIXME("stub\n");
171 return E_NOTIMPL;
174 static HRESULT WINAPI AEV_SetChannelVolumeLevel(IAudioEndpointVolumeEx *iface, UINT chan, float leveldb, const GUID *ctx)
176 TRACE("(%p)->(%f,%s)\n", iface, leveldb, debugstr_guid(ctx));
177 FIXME("stub\n");
178 return E_NOTIMPL;
181 static HRESULT WINAPI AEV_SetChannelVolumeLevelScalar(IAudioEndpointVolumeEx *iface, UINT chan, float level, const GUID *ctx)
183 TRACE("(%p)->(%u,%f,%s)\n", iface, chan, level, debugstr_guid(ctx));
184 FIXME("stub\n");
185 return E_NOTIMPL;
188 static HRESULT WINAPI AEV_GetChannelVolumeLevel(IAudioEndpointVolumeEx *iface, UINT chan, float *leveldb)
190 TRACE("(%p)->(%u,%p)\n", iface, chan, leveldb);
191 if (!leveldb)
192 return E_POINTER;
193 FIXME("stub\n");
194 return E_NOTIMPL;
197 static HRESULT WINAPI AEV_GetChannelVolumeLevelScalar(IAudioEndpointVolumeEx *iface, UINT chan, float *level)
199 TRACE("(%p)->(%u,%p)\n", iface, chan, level);
200 if (!level)
201 return E_POINTER;
202 FIXME("stub\n");
203 return E_NOTIMPL;
206 static HRESULT WINAPI AEV_SetMute(IAudioEndpointVolumeEx *iface, BOOL mute, const GUID *ctx)
208 TRACE("(%p)->(%u,%s)\n", iface, mute, debugstr_guid(ctx));
209 FIXME("stub\n");
210 return E_NOTIMPL;
213 static HRESULT WINAPI AEV_GetMute(IAudioEndpointVolumeEx *iface, BOOL *mute)
215 TRACE("(%p)->(%p)\n", iface, mute);
216 if (!mute)
217 return E_POINTER;
218 FIXME("stub\n");
219 return E_NOTIMPL;
222 static HRESULT WINAPI AEV_GetVolumeStepInfo(IAudioEndpointVolumeEx *iface, UINT *stepsize, UINT *stepcount)
224 TRACE("(%p)->(%p,%p)\n", iface, stepsize, stepcount);
225 if (!stepsize && !stepcount)
226 return E_POINTER;
227 FIXME("stub\n");
228 return E_NOTIMPL;
231 static HRESULT WINAPI AEV_VolumeStepUp(IAudioEndpointVolumeEx *iface, const GUID *ctx)
233 TRACE("(%p)->(%s)\n", iface, debugstr_guid(ctx));
234 FIXME("stub\n");
235 return E_NOTIMPL;
238 static HRESULT WINAPI AEV_VolumeStepDown(IAudioEndpointVolumeEx *iface, const GUID *ctx)
240 TRACE("(%p)->(%s)\n", iface, debugstr_guid(ctx));
241 FIXME("stub\n");
242 return E_NOTIMPL;
245 static HRESULT WINAPI AEV_QueryHardwareSupport(IAudioEndpointVolumeEx *iface, DWORD *mask)
247 TRACE("(%p)->(%p)\n", iface, mask);
248 if (!mask)
249 return E_POINTER;
250 FIXME("stub\n");
251 return E_NOTIMPL;
254 static HRESULT WINAPI AEV_GetVolumeRange(IAudioEndpointVolumeEx *iface, float *mindb, float *maxdb, float *inc)
256 TRACE("(%p)->(%p,%p,%p)\n", iface, mindb, maxdb, inc);
257 if (!mindb || !maxdb || !inc)
258 return E_POINTER;
259 FIXME("stub\n");
260 return E_NOTIMPL;
263 static HRESULT WINAPI AEV_GetVolumeRangeChannel(IAudioEndpointVolumeEx *iface, UINT chan, float *mindb, float *maxdb, float *inc)
265 TRACE("(%p)->(%p,%p,%p)\n", iface, mindb, maxdb, inc);
266 if (!mindb || !maxdb || !inc)
267 return E_POINTER;
268 FIXME("stub\n");
269 return E_NOTIMPL;
272 static const IAudioEndpointVolumeExVtbl AEVImpl_Vtbl = {
273 AEV_QueryInterface,
274 AEV_AddRef,
275 AEV_Release,
276 AEV_RegisterControlChangeNotify,
277 AEV_UnregisterControlChangeNotify,
278 AEV_GetChannelCount,
279 AEV_SetMasterVolumeLevel,
280 AEV_SetMasterVolumeLevelScalar,
281 AEV_GetMasterVolumeLevel,
282 AEV_GetMasterVolumeLevelScalar,
283 AEV_SetChannelVolumeLevel,
284 AEV_SetChannelVolumeLevelScalar,
285 AEV_GetChannelVolumeLevel,
286 AEV_GetChannelVolumeLevelScalar,
287 AEV_SetMute,
288 AEV_GetMute,
289 AEV_GetVolumeStepInfo,
290 AEV_VolumeStepUp,
291 AEV_VolumeStepDown,
292 AEV_QueryHardwareSupport,
293 AEV_GetVolumeRange,
294 AEV_GetVolumeRangeChannel
297 #endif