po: Update French translation.
[wine.git] / dlls / mmdevapi / audiovolume.c
blob194cfa37f105a8485392f9fb909391155ba03f9b
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
19 #define COBJMACROS
20 #include "config.h"
22 #include <stdarg.h>
24 #include "windef.h"
25 #include "winbase.h"
26 #include "winnls.h"
27 #include "winreg.h"
28 #include "wine/debug.h"
29 #include "wine/unicode.h"
31 #include "ole2.h"
32 #include "mmdeviceapi.h"
33 #include "mmsystem.h"
34 #include "dsound.h"
35 #include "audioclient.h"
36 #include "endpointvolume.h"
37 #include "audiopolicy.h"
39 #include "mmdevapi.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(mmdevapi);
43 static const IAudioEndpointVolumeExVtbl AEVImpl_Vtbl;
45 typedef struct AEVImpl {
46 IAudioEndpointVolumeEx IAudioEndpointVolumeEx_iface;
47 LONG ref;
48 } AEVImpl;
50 static inline AEVImpl *impl_from_IAudioEndpointVolumeEx(IAudioEndpointVolumeEx *iface)
52 return CONTAINING_RECORD(iface, AEVImpl, IAudioEndpointVolumeEx_iface);
55 HRESULT AudioEndpointVolume_Create(MMDevice *parent, IAudioEndpointVolume **ppv)
57 AEVImpl *This;
58 This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*This));
59 *ppv = (IAudioEndpointVolume*)This;
60 if (!This)
61 return E_OUTOFMEMORY;
62 This->IAudioEndpointVolumeEx_iface.lpVtbl = &AEVImpl_Vtbl;
63 This->ref = 1;
64 return S_OK;
67 static void AudioEndpointVolume_Destroy(AEVImpl *This)
69 HeapFree(GetProcessHeap(), 0, This);
72 static HRESULT WINAPI AEV_QueryInterface(IAudioEndpointVolumeEx *iface, REFIID riid, void **ppv)
74 AEVImpl *This = impl_from_IAudioEndpointVolumeEx(iface);
75 TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppv);
76 if (!ppv)
77 return E_POINTER;
78 *ppv = NULL;
79 if (IsEqualIID(riid, &IID_IUnknown) ||
80 IsEqualIID(riid, &IID_IAudioEndpointVolume) ||
81 IsEqualIID(riid, &IID_IAudioEndpointVolumeEx)) {
82 *ppv = This;
84 else
85 return E_NOINTERFACE;
86 IUnknown_AddRef((IUnknown *)*ppv);
87 return S_OK;
90 static ULONG WINAPI AEV_AddRef(IAudioEndpointVolumeEx *iface)
92 AEVImpl *This = impl_from_IAudioEndpointVolumeEx(iface);
93 ULONG ref = InterlockedIncrement(&This->ref);
94 TRACE("(%p) new ref %u\n", This, ref);
95 return ref;
98 static ULONG WINAPI AEV_Release(IAudioEndpointVolumeEx *iface)
100 AEVImpl *This = impl_from_IAudioEndpointVolumeEx(iface);
101 ULONG ref = InterlockedDecrement(&This->ref);
102 TRACE("(%p) new ref %u\n", This, ref);
103 if (!ref)
104 AudioEndpointVolume_Destroy(This);
105 return ref;
108 static HRESULT WINAPI AEV_RegisterControlChangeNotify(IAudioEndpointVolumeEx *iface, IAudioEndpointVolumeCallback *notify)
110 TRACE("(%p)->(%p)\n", iface, notify);
111 if (!notify)
112 return E_POINTER;
113 FIXME("stub\n");
114 return S_OK;
117 static HRESULT WINAPI AEV_UnregisterControlChangeNotify(IAudioEndpointVolumeEx *iface, IAudioEndpointVolumeCallback *notify)
119 TRACE("(%p)->(%p)\n", iface, notify);
120 if (!notify)
121 return E_POINTER;
122 FIXME("stub\n");
123 return S_OK;
126 static HRESULT WINAPI AEV_GetChannelCount(IAudioEndpointVolumeEx *iface, UINT *count)
128 TRACE("(%p)->(%p)\n", iface, count);
129 if (!count)
130 return E_POINTER;
131 FIXME("stub\n");
132 return E_NOTIMPL;
135 static HRESULT WINAPI AEV_SetMasterVolumeLevel(IAudioEndpointVolumeEx *iface, float leveldb, const GUID *ctx)
137 TRACE("(%p)->(%f,%s)\n", iface, leveldb, debugstr_guid(ctx));
138 FIXME("stub\n");
139 return E_NOTIMPL;
142 static HRESULT WINAPI AEV_SetMasterVolumeLevelScalar(IAudioEndpointVolumeEx *iface, float level, const GUID *ctx)
144 TRACE("(%p)->(%f,%s)\n", iface, level, debugstr_guid(ctx));
145 FIXME("stub\n");
146 return E_NOTIMPL;
149 static HRESULT WINAPI AEV_GetMasterVolumeLevel(IAudioEndpointVolumeEx *iface, float *leveldb)
151 TRACE("(%p)->(%p)\n", iface, leveldb);
152 if (!leveldb)
153 return E_POINTER;
154 FIXME("stub\n");
155 return E_NOTIMPL;
158 static HRESULT WINAPI AEV_GetMasterVolumeLevelScalar(IAudioEndpointVolumeEx *iface, float *level)
160 TRACE("(%p)->(%p)\n", iface, level);
161 if (!level)
162 return E_POINTER;
163 FIXME("stub\n");
164 return E_NOTIMPL;
167 static HRESULT WINAPI AEV_SetChannelVolumeLevel(IAudioEndpointVolumeEx *iface, UINT chan, float leveldb, const GUID *ctx)
169 TRACE("(%p)->(%f,%s)\n", iface, leveldb, debugstr_guid(ctx));
170 FIXME("stub\n");
171 return E_NOTIMPL;
174 static HRESULT WINAPI AEV_SetChannelVolumeLevelScalar(IAudioEndpointVolumeEx *iface, UINT chan, float level, const GUID *ctx)
176 TRACE("(%p)->(%u,%f,%s)\n", iface, chan, level, debugstr_guid(ctx));
177 FIXME("stub\n");
178 return E_NOTIMPL;
181 static HRESULT WINAPI AEV_GetChannelVolumeLevel(IAudioEndpointVolumeEx *iface, UINT chan, float *leveldb)
183 TRACE("(%p)->(%u,%p)\n", iface, chan, leveldb);
184 if (!leveldb)
185 return E_POINTER;
186 FIXME("stub\n");
187 return E_NOTIMPL;
190 static HRESULT WINAPI AEV_GetChannelVolumeLevelScalar(IAudioEndpointVolumeEx *iface, UINT chan, float *level)
192 TRACE("(%p)->(%u,%p)\n", iface, chan, level);
193 if (!level)
194 return E_POINTER;
195 FIXME("stub\n");
196 return E_NOTIMPL;
199 static HRESULT WINAPI AEV_SetMute(IAudioEndpointVolumeEx *iface, BOOL mute, const GUID *ctx)
201 TRACE("(%p)->(%u,%s)\n", iface, mute, debugstr_guid(ctx));
202 FIXME("stub\n");
203 return E_NOTIMPL;
206 static HRESULT WINAPI AEV_GetMute(IAudioEndpointVolumeEx *iface, BOOL *mute)
208 TRACE("(%p)->(%p)\n", iface, mute);
209 if (!mute)
210 return E_POINTER;
211 FIXME("stub\n");
212 return E_NOTIMPL;
215 static HRESULT WINAPI AEV_GetVolumeStepInfo(IAudioEndpointVolumeEx *iface, UINT *stepsize, UINT *stepcount)
217 TRACE("(%p)->(%p,%p)\n", iface, stepsize, stepcount);
218 if (!stepsize && !stepcount)
219 return E_POINTER;
220 FIXME("stub\n");
221 return E_NOTIMPL;
224 static HRESULT WINAPI AEV_VolumeStepUp(IAudioEndpointVolumeEx *iface, const GUID *ctx)
226 TRACE("(%p)->(%s)\n", iface, debugstr_guid(ctx));
227 FIXME("stub\n");
228 return E_NOTIMPL;
231 static HRESULT WINAPI AEV_VolumeStepDown(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_QueryHardwareSupport(IAudioEndpointVolumeEx *iface, DWORD *mask)
240 TRACE("(%p)->(%p)\n", iface, mask);
241 if (!mask)
242 return E_POINTER;
243 FIXME("stub\n");
244 return E_NOTIMPL;
247 static HRESULT WINAPI AEV_GetVolumeRange(IAudioEndpointVolumeEx *iface, float *mindb, float *maxdb, float *inc)
249 TRACE("(%p)->(%p,%p,%p)\n", iface, mindb, maxdb, inc);
250 if (!mindb || !maxdb || !inc)
251 return E_POINTER;
252 FIXME("stub\n");
253 return E_NOTIMPL;
256 static HRESULT WINAPI AEV_GetVolumeRangeChannel(IAudioEndpointVolumeEx *iface, UINT chan, float *mindb, float *maxdb, float *inc)
258 TRACE("(%p)->(%p,%p,%p)\n", iface, mindb, maxdb, inc);
259 if (!mindb || !maxdb || !inc)
260 return E_POINTER;
261 FIXME("stub\n");
262 return E_NOTIMPL;
265 static const IAudioEndpointVolumeExVtbl AEVImpl_Vtbl = {
266 AEV_QueryInterface,
267 AEV_AddRef,
268 AEV_Release,
269 AEV_RegisterControlChangeNotify,
270 AEV_UnregisterControlChangeNotify,
271 AEV_GetChannelCount,
272 AEV_SetMasterVolumeLevel,
273 AEV_SetMasterVolumeLevelScalar,
274 AEV_GetMasterVolumeLevel,
275 AEV_GetMasterVolumeLevelScalar,
276 AEV_SetChannelVolumeLevel,
277 AEV_SetChannelVolumeLevelScalar,
278 AEV_GetChannelVolumeLevel,
279 AEV_GetChannelVolumeLevelScalar,
280 AEV_SetMute,
281 AEV_GetMute,
282 AEV_GetVolumeStepInfo,
283 AEV_VolumeStepUp,
284 AEV_VolumeStepDown,
285 AEV_QueryHardwareSupport,
286 AEV_GetVolumeRange,
287 AEV_GetVolumeRangeChannel