Commit 982d005d authored by Andrew Eikum's avatar Andrew Eikum Committed by Alexandre Julliard

mmdevapi: Implement Set/GetMasterVolumeLevel.

parent 89de040e
......@@ -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)
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment