Commit 77428d02 authored by Davide Beatrici's avatar Davide Beatrici Committed by Alexandre Julliard

winepulse: Use mmdevapi's SimpleAudioVolume.

parent 04c909ea
......@@ -128,7 +128,7 @@ static const IAudioClient3Vtbl AudioClient3_Vtbl;
static const IAudioRenderClientVtbl AudioRenderClient_Vtbl;
static const IAudioCaptureClientVtbl AudioCaptureClient_Vtbl;
extern const IAudioSessionControl2Vtbl AudioSessionControl2_Vtbl;
static const ISimpleAudioVolumeVtbl SimpleAudioVolume_Vtbl;
extern const ISimpleAudioVolumeVtbl SimpleAudioVolume_Vtbl;
static const IChannelAudioVolumeVtbl ChannelAudioVolume_Vtbl;
static const IAudioClockVtbl AudioClock_Vtbl;
static const IAudioClock2Vtbl AudioClock2_Vtbl;
......@@ -151,11 +151,6 @@ static inline ACImpl *impl_from_IAudioCaptureClient(IAudioCaptureClient *iface)
return CONTAINING_RECORD(iface, ACImpl, IAudioCaptureClient_iface);
}
static inline AudioSessionWrapper *impl_from_ISimpleAudioVolume(ISimpleAudioVolume *iface)
{
return CONTAINING_RECORD(iface, AudioSessionWrapper, ISimpleAudioVolume_iface);
}
static inline AudioSessionWrapper *impl_from_IChannelAudioVolume(IChannelAudioVolume *iface)
{
return CONTAINING_RECORD(iface, AudioSessionWrapper, IChannelAudioVolume_iface);
......@@ -1887,129 +1882,6 @@ static AudioSessionWrapper *AudioSessionWrapper_Create(ACImpl *client)
return ret;
}
static HRESULT WINAPI SimpleAudioVolume_QueryInterface(
ISimpleAudioVolume *iface, REFIID riid, void **ppv)
{
TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv);
if (!ppv)
return E_POINTER;
*ppv = NULL;
if (IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_ISimpleAudioVolume))
*ppv = iface;
if (*ppv) {
IUnknown_AddRef((IUnknown*)*ppv);
return S_OK;
}
WARN("Unknown interface %s\n", debugstr_guid(riid));
return E_NOINTERFACE;
}
static ULONG WINAPI SimpleAudioVolume_AddRef(ISimpleAudioVolume *iface)
{
AudioSessionWrapper *This = impl_from_ISimpleAudioVolume(iface);
return IAudioSessionControl2_AddRef(&This->IAudioSessionControl2_iface);
}
static ULONG WINAPI SimpleAudioVolume_Release(ISimpleAudioVolume *iface)
{
AudioSessionWrapper *This = impl_from_ISimpleAudioVolume(iface);
return IAudioSessionControl2_Release(&This->IAudioSessionControl2_iface);
}
static HRESULT WINAPI SimpleAudioVolume_SetMasterVolume(
ISimpleAudioVolume *iface, float level, const GUID *context)
{
AudioSessionWrapper *This = impl_from_ISimpleAudioVolume(iface);
AudioSession *session = This->session;
ACImpl *client;
TRACE("(%p)->(%f, %s)\n", session, level, wine_dbgstr_guid(context));
if (level < 0.f || level > 1.f)
return E_INVALIDARG;
if (context)
FIXME("Notifications not supported yet\n");
TRACE("PulseAudio does not support session volume control\n");
sessions_lock();
session->master_vol = level;
LIST_FOR_EACH_ENTRY(client, &This->session->clients, ACImpl, entry)
set_stream_volumes(client);
sessions_unlock();
return S_OK;
}
static HRESULT WINAPI SimpleAudioVolume_GetMasterVolume(
ISimpleAudioVolume *iface, float *level)
{
AudioSessionWrapper *This = impl_from_ISimpleAudioVolume(iface);
AudioSession *session = This->session;
TRACE("(%p)->(%p)\n", session, level);
if (!level)
return NULL_PTR_ERR;
*level = session->master_vol;
return S_OK;
}
static HRESULT WINAPI SimpleAudioVolume_SetMute(ISimpleAudioVolume *iface,
BOOL mute, const GUID *context)
{
AudioSessionWrapper *This = impl_from_ISimpleAudioVolume(iface);
AudioSession *session = This->session;
ACImpl *client;
TRACE("(%p)->(%u, %s)\n", session, mute, debugstr_guid(context));
if (context)
FIXME("Notifications not supported yet\n");
sessions_lock();
session->mute = mute;
LIST_FOR_EACH_ENTRY(client, &This->session->clients, ACImpl, entry)
set_stream_volumes(client);
sessions_unlock();
return S_OK;
}
static HRESULT WINAPI SimpleAudioVolume_GetMute(ISimpleAudioVolume *iface,
BOOL *mute)
{
AudioSessionWrapper *This = impl_from_ISimpleAudioVolume(iface);
AudioSession *session = This->session;
TRACE("(%p)->(%p)\n", session, mute);
if (!mute)
return NULL_PTR_ERR;
*mute = session->mute;
return S_OK;
}
static const ISimpleAudioVolumeVtbl SimpleAudioVolume_Vtbl =
{
SimpleAudioVolume_QueryInterface,
SimpleAudioVolume_AddRef,
SimpleAudioVolume_Release,
SimpleAudioVolume_SetMasterVolume,
SimpleAudioVolume_GetMasterVolume,
SimpleAudioVolume_SetMute,
SimpleAudioVolume_GetMute
};
static HRESULT WINAPI ChannelAudioVolume_QueryInterface(
IChannelAudioVolume *iface, REFIID riid, void **ppv)
{
......
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