mmdevapi: Implement IAudioEndpointVolume::GetVolumeRange.

Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Andrew Eikum 2016-03-09 12:41:22 -06:00 committed by Alexandre Julliard
parent beb8986e48
commit 89de040e4f
5 changed files with 39 additions and 8 deletions

View file

@ -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;
}

View file

@ -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))
{

View file

@ -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;

View file

@ -21,6 +21,7 @@
#define COBJMACROS
#include "initguid.h"
#include "endpointvolume.h"
#include "mmdeviceapi.h"
#include "audioclient.h"
#include "audiopolicy.h"

View file

@ -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);