Andrew Eikum : mmdevapi: Implement IAudioEndpointVolume::GetVolumeRange.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Mar 11 07:55:45 CST 2016
Module: wine
Branch: master
Commit: 89de040e4f2567df48af1cfcad33c34e2a54d9cb
URL: http://source.winehq.org/git/wine.git/?a=commit;h=89de040e4f2567df48af1cfcad33c34e2a54d9cb
Author: Andrew Eikum <aeikum at codeweavers.com>
Date: Wed Mar 9 12:41:22 2016 -0600
mmdevapi: Implement IAudioEndpointVolume::GetVolumeRange.
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/mmdevapi/audiovolume.c | 15 ++++++++++-----
dlls/mmdevapi/devenum.c | 5 +++--
dlls/mmdevapi/mmdevapi.h | 2 +-
dlls/mmdevapi/tests/mmdevenum.c | 1 +
dlls/mmdevapi/tests/render.c | 24 ++++++++++++++++++++++++
5 files changed, 39 insertions(+), 8 deletions(-)
diff --git a/dlls/mmdevapi/audiovolume.c b/dlls/mmdevapi/audiovolume.c
index 7dddbdf..a49d2e9 100644
--- a/dlls/mmdevapi/audiovolume.c
+++ b/dlls/mmdevapi/audiovolume.c
@@ -233,10 +233,15 @@ static HRESULT WINAPI AEV_QueryHardwareSupport(IAudioEndpointVolumeEx *iface, DW
static HRESULT WINAPI AEV_GetVolumeRange(IAudioEndpointVolumeEx *iface, float *mindb, float *maxdb, float *inc)
{
TRACE("(%p)->(%p,%p,%p)\n", iface, mindb, maxdb, inc);
+
if (!mindb || !maxdb || !inc)
return E_POINTER;
- FIXME("stub\n");
- return E_NOTIMPL;
+
+ *mindb = -100.f;
+ *maxdb = 0.f;
+ *inc = 1.f;
+
+ return S_OK;
}
static HRESULT WINAPI AEV_GetVolumeRangeChannel(IAudioEndpointVolumeEx *iface, UINT chan, float *mindb, float *maxdb, float *inc)
@@ -273,17 +278,17 @@ static const IAudioEndpointVolumeExVtbl AEVImpl_Vtbl = {
AEV_GetVolumeRangeChannel
};
-HRESULT AudioEndpointVolume_Create(MMDevice *parent, IAudioEndpointVolume **ppv)
+HRESULT AudioEndpointVolume_Create(MMDevice *parent, IAudioEndpointVolumeEx **ppv)
{
AEVImpl *This;
*ppv = NULL;
- This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
+ This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*This));
if (!This)
return E_OUTOFMEMORY;
This->IAudioEndpointVolumeEx_iface.lpVtbl = &AEVImpl_Vtbl;
This->ref = 1;
- *ppv = (IAudioEndpointVolume*)&This->IAudioEndpointVolumeEx_iface;
+ *ppv = &This->IAudioEndpointVolumeEx_iface;
return S_OK;
}
diff --git a/dlls/mmdevapi/devenum.c b/dlls/mmdevapi/devenum.c
index e63a199..1694bee 100644
--- a/dlls/mmdevapi/devenum.c
+++ b/dlls/mmdevapi/devenum.c
@@ -595,8 +595,9 @@ static HRESULT WINAPI MMDevice_Activate(IMMDevice *iface, REFIID riid, DWORD cls
if (IsEqualIID(riid, &IID_IAudioClient)){
hr = drvs.pGetAudioEndpoint(&This->devguid, iface, (IAudioClient**)ppv);
- }else if (IsEqualIID(riid, &IID_IAudioEndpointVolume))
- hr = AudioEndpointVolume_Create(This, (IAudioEndpointVolume**)ppv);
+ }else if (IsEqualIID(riid, &IID_IAudioEndpointVolume) ||
+ IsEqualIID(riid, &IID_IAudioEndpointVolumeEx))
+ hr = AudioEndpointVolume_Create(This, (IAudioEndpointVolumeEx**)ppv);
else if (IsEqualIID(riid, &IID_IAudioSessionManager)
|| IsEqualIID(riid, &IID_IAudioSessionManager2))
{
diff --git a/dlls/mmdevapi/mmdevapi.h b/dlls/mmdevapi/mmdevapi.h
index 2b40a05..b85c757 100644
--- a/dlls/mmdevapi/mmdevapi.h
+++ b/dlls/mmdevapi/mmdevapi.h
@@ -74,6 +74,6 @@ typedef struct MMDevice {
} MMDevice;
extern HRESULT AudioClient_Create(MMDevice *parent, IAudioClient **ppv) DECLSPEC_HIDDEN;
-extern HRESULT AudioEndpointVolume_Create(MMDevice *parent, IAudioEndpointVolume **ppv) DECLSPEC_HIDDEN;
+extern HRESULT AudioEndpointVolume_Create(MMDevice *parent, IAudioEndpointVolumeEx **ppv) DECLSPEC_HIDDEN;
extern const WCHAR drv_keyW[] DECLSPEC_HIDDEN;
diff --git a/dlls/mmdevapi/tests/mmdevenum.c b/dlls/mmdevapi/tests/mmdevenum.c
index 12e2156..4f8c848 100644
--- a/dlls/mmdevapi/tests/mmdevenum.c
+++ b/dlls/mmdevapi/tests/mmdevenum.c
@@ -21,6 +21,7 @@
#define COBJMACROS
#include "initguid.h"
+#include "endpointvolume.h"
#include "mmdeviceapi.h"
#include "audioclient.h"
#include "audiopolicy.h"
diff --git a/dlls/mmdevapi/tests/render.c b/dlls/mmdevapi/tests/render.c
index 298c886..1476adc 100644
--- a/dlls/mmdevapi/tests/render.c
+++ b/dlls/mmdevapi/tests/render.c
@@ -39,6 +39,7 @@
#include "mmsystem.h"
#include "audioclient.h"
#include "audiopolicy.h"
+#include "endpointvolume.h"
static const unsigned int win_formats[][4] = {
{ 8000, 8, 1}, { 8000, 8, 2}, { 8000, 16, 1}, { 8000, 16, 2},
@@ -2242,6 +2243,28 @@ static void test_marshal(void)
}
+static void test_endpointvolume(void)
+{
+ HRESULT hr;
+ IAudioEndpointVolume *aev;
+ float mindb, maxdb, increment;
+
+ hr = IMMDevice_Activate(dev, &IID_IAudioEndpointVolume,
+ CLSCTX_INPROC_SERVER, NULL, (void**)&aev);
+ ok(hr == S_OK, "Activation failed with %08x\n", hr);
+ if(hr != S_OK)
+ return;
+
+ hr = IAudioEndpointVolume_GetVolumeRange(aev, &mindb, NULL, NULL);
+ ok(hr == E_POINTER, "GetVolumeRange should have failed with E_POINTER: 0x%08x\n", hr);
+
+ hr = IAudioEndpointVolume_GetVolumeRange(aev, &mindb, &maxdb, &increment);
+ ok(hr == S_OK, "GetVolumeRange failed: 0x%08x\n", hr);
+ trace("got range: [%f,%f]/%f\n", mindb, maxdb, increment);
+
+ IAudioEndpointVolume_Release(aev);
+}
+
START_TEST(render)
{
HRESULT hr;
@@ -2283,6 +2306,7 @@ START_TEST(render)
test_volume_dependence();
test_session_creation();
test_worst_case();
+ test_endpointvolume();
IMMDevice_Release(dev);
More information about the wine-cvs
mailing list