[PATCH 2/3] mmdevapi: Implement Set/GetMasterVolumeLevel
Andrew Eikum
aeikum at codeweavers.com
Wed Mar 9 12:41:25 CST 2016
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
---
dlls/mmdevapi/audiovolume.c | 21 +++++++++++++++++----
dlls/mmdevapi/tests/render.c | 11 ++++++++++-
2 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/dlls/mmdevapi/audiovolume.c b/dlls/mmdevapi/audiovolume.c
index a49d2e9..742823c 100644
--- a/dlls/mmdevapi/audiovolume.c
+++ b/dlls/mmdevapi/audiovolume.c
@@ -43,6 +43,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(mmdevapi);
typedef struct AEVImpl {
IAudioEndpointVolumeEx IAudioEndpointVolumeEx_iface;
LONG ref;
+ float master_vol;
} AEVImpl;
static inline AEVImpl *impl_from_IAudioEndpointVolumeEx(IAudioEndpointVolumeEx *iface)
@@ -120,9 +121,16 @@ static HRESULT WINAPI AEV_GetChannelCount(IAudioEndpointVolumeEx *iface, UINT *c
static HRESULT WINAPI AEV_SetMasterVolumeLevel(IAudioEndpointVolumeEx *iface, float leveldb, const GUID *ctx)
{
+ AEVImpl *This = impl_from_IAudioEndpointVolumeEx(iface);
+
TRACE("(%p)->(%f,%s)\n", iface, leveldb, debugstr_guid(ctx));
- FIXME("stub\n");
- return E_NOTIMPL;
+
+ if(leveldb < -100.f || leveldb > 0.f)
+ return E_INVALIDARG;
+
+ This->master_vol = leveldb;
+
+ return S_OK;
}
static HRESULT WINAPI AEV_SetMasterVolumeLevelScalar(IAudioEndpointVolumeEx *iface, float level, const GUID *ctx)
@@ -134,11 +142,16 @@ static HRESULT WINAPI AEV_SetMasterVolumeLevelScalar(IAudioEndpointVolumeEx *ifa
static HRESULT WINAPI AEV_GetMasterVolumeLevel(IAudioEndpointVolumeEx *iface, float *leveldb)
{
+ AEVImpl *This = impl_from_IAudioEndpointVolumeEx(iface);
+
TRACE("(%p)->(%p)\n", iface, leveldb);
+
if (!leveldb)
return E_POINTER;
- FIXME("stub\n");
- return E_NOTIMPL;
+
+ *leveldb = This->master_vol;
+
+ return S_OK;
}
static HRESULT WINAPI AEV_GetMasterVolumeLevelScalar(IAudioEndpointVolumeEx *iface, float *level)
diff --git a/dlls/mmdevapi/tests/render.c b/dlls/mmdevapi/tests/render.c
index 1476adc..1e8a5f1 100644
--- a/dlls/mmdevapi/tests/render.c
+++ b/dlls/mmdevapi/tests/render.c
@@ -2247,7 +2247,7 @@ static void test_endpointvolume(void)
{
HRESULT hr;
IAudioEndpointVolume *aev;
- float mindb, maxdb, increment;
+ float mindb, maxdb, increment, volume;
hr = IMMDevice_Activate(dev, &IID_IAudioEndpointVolume,
CLSCTX_INPROC_SERVER, NULL, (void**)&aev);
@@ -2262,6 +2262,15 @@ static void test_endpointvolume(void)
ok(hr == S_OK, "GetVolumeRange failed: 0x%08x\n", hr);
trace("got range: [%f,%f]/%f\n", mindb, maxdb, increment);
+ hr = IAudioEndpointVolume_SetMasterVolumeLevel(aev, mindb - increment, NULL);
+ ok(hr == E_INVALIDARG, "SetMasterVolumeLevel failed: 0x%08x\n", hr);
+
+ hr = IAudioEndpointVolume_GetMasterVolumeLevel(aev, &volume);
+ ok(hr == S_OK, "GetMasterVolumeLevel failed: 0x%08x\n", hr);
+
+ hr = IAudioEndpointVolume_SetMasterVolumeLevel(aev, volume, NULL);
+ ok(hr == S_OK, "SetMasterVolumeLevel failed: 0x%08x\n", hr);
+
IAudioEndpointVolume_Release(aev);
}
--
2.7.2
More information about the wine-patches
mailing list