[PATCH 3/3] mmdevapi: Implement Set/GetMute

Andrew Eikum aeikum at codeweavers.com
Wed Mar 9 12:41:28 CST 2016


Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
---
 dlls/mmdevapi/audiovolume.c  | 21 +++++++++++++++++----
 dlls/mmdevapi/tests/render.c |  7 +++++++
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/dlls/mmdevapi/audiovolume.c b/dlls/mmdevapi/audiovolume.c
index 742823c..76f9f4e 100644
--- a/dlls/mmdevapi/audiovolume.c
+++ b/dlls/mmdevapi/audiovolume.c
@@ -44,6 +44,7 @@ typedef struct AEVImpl {
     IAudioEndpointVolumeEx IAudioEndpointVolumeEx_iface;
     LONG ref;
     float master_vol;
+    BOOL mute;
 } AEVImpl;
 
 static inline AEVImpl *impl_from_IAudioEndpointVolumeEx(IAudioEndpointVolumeEx *iface)
@@ -197,18 +198,30 @@ static HRESULT WINAPI AEV_GetChannelVolumeLevelScalar(IAudioEndpointVolumeEx *if
 
 static HRESULT WINAPI AEV_SetMute(IAudioEndpointVolumeEx *iface, BOOL mute, const GUID *ctx)
 {
+    AEVImpl *This = impl_from_IAudioEndpointVolumeEx(iface);
+    HRESULT ret;
+
     TRACE("(%p)->(%u,%s)\n", iface, mute, debugstr_guid(ctx));
-    FIXME("stub\n");
-    return E_NOTIMPL;
+
+    ret = This->mute == mute ? S_FALSE : S_OK;
+
+    This->mute = mute;
+
+    return ret;
 }
 
 static HRESULT WINAPI AEV_GetMute(IAudioEndpointVolumeEx *iface, BOOL *mute)
 {
+    AEVImpl *This = impl_from_IAudioEndpointVolumeEx(iface);
+
     TRACE("(%p)->(%p)\n", iface, mute);
+
     if (!mute)
         return E_POINTER;
-    FIXME("stub\n");
-    return E_NOTIMPL;
+
+    *mute = This->mute;
+
+    return S_OK;
 }
 
 static HRESULT WINAPI AEV_GetVolumeStepInfo(IAudioEndpointVolumeEx *iface, UINT *stepsize, UINT *stepcount)
diff --git a/dlls/mmdevapi/tests/render.c b/dlls/mmdevapi/tests/render.c
index 1e8a5f1..9d2853c 100644
--- a/dlls/mmdevapi/tests/render.c
+++ b/dlls/mmdevapi/tests/render.c
@@ -2248,6 +2248,7 @@ static void test_endpointvolume(void)
     HRESULT hr;
     IAudioEndpointVolume *aev;
     float mindb, maxdb, increment, volume;
+    BOOL mute;
 
     hr = IMMDevice_Activate(dev, &IID_IAudioEndpointVolume,
             CLSCTX_INPROC_SERVER, NULL, (void**)&aev);
@@ -2271,6 +2272,12 @@ static void test_endpointvolume(void)
     hr = IAudioEndpointVolume_SetMasterVolumeLevel(aev, volume, NULL);
     ok(hr == S_OK, "SetMasterVolumeLevel failed: 0x%08x\n", hr);
 
+    hr = IAudioEndpointVolume_GetMute(aev, &mute);
+    ok(hr == S_OK, "GetMute failed: %08x\n", hr);
+
+    hr = IAudioEndpointVolume_SetMute(aev, mute, NULL);
+    ok(hr == S_OK || hr == S_FALSE, "SetMute failed: %08x\n", hr);
+
     IAudioEndpointVolume_Release(aev);
 }
 
-- 
2.7.2




More information about the wine-patches mailing list