-- v2: winepulse: Use mmdevapi's ChannelAudioVolume. wineoss: Use mmdevapi's ChannelAudioVolume. winecoreaudio: Use mmdevapi's ChannelAudioVolume. winealsa: Move ChannelAudioVolume into mmdevapi.
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/mmdevapi/session.c | 167 ++++++++++++++++++++++++++++++++ dlls/winealsa.drv/mmdevdrv.c | 178 +---------------------------------- 2 files changed, 168 insertions(+), 177 deletions(-)
diff --git a/dlls/mmdevapi/session.c b/dlls/mmdevapi/session.c index 1f980282417..6a675a7656c 100644 --- a/dlls/mmdevapi/session.c +++ b/dlls/mmdevapi/session.c @@ -39,6 +39,11 @@ static inline struct audio_session_wrapper *impl_from_IAudioSessionControl2(IAud return CONTAINING_RECORD(iface, struct audio_session_wrapper, IAudioSessionControl2_iface); }
+static inline struct audio_session_wrapper *impl_from_IChannelAudioVolume(IChannelAudioVolume *iface) +{ + return CONTAINING_RECORD(iface, struct audio_session_wrapper, IChannelAudioVolume_iface); +} + static inline struct audio_session_wrapper *impl_from_ISimpleAudioVolume(ISimpleAudioVolume *iface) { return CONTAINING_RECORD(iface, struct audio_session_wrapper, ISimpleAudioVolume_iface); @@ -265,6 +270,168 @@ const IAudioSessionControl2Vtbl AudioSessionControl2_Vtbl = control_SetDuckingPreference };
+static HRESULT WINAPI channelvolume_QueryInterface(IChannelAudioVolume *iface, REFIID riid, + void **ppv) +{ + TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv); + + if (!ppv) + return E_POINTER; + + if (IsEqualIID(riid, &IID_IUnknown) || + IsEqualIID(riid, &IID_IChannelAudioVolume)) + *ppv = iface; + else { + *ppv = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown *)*ppv); + + return S_OK; +} + +static ULONG WINAPI channelvolume_AddRef(IChannelAudioVolume *iface) +{ + struct audio_session_wrapper *This = impl_from_IChannelAudioVolume(iface); + return IAudioSessionControl2_AddRef(&This->IAudioSessionControl2_iface); +} + +static ULONG WINAPI channelvolume_Release(IChannelAudioVolume *iface) +{ + struct audio_session_wrapper *This = impl_from_IChannelAudioVolume(iface); + return IAudioSessionControl2_Release(&This->IAudioSessionControl2_iface); +} + +static HRESULT WINAPI channelvolume_GetChannelCount(IChannelAudioVolume *iface, UINT32 *out) +{ + struct audio_session_wrapper *This = impl_from_IChannelAudioVolume(iface); + struct audio_session *session = This->session; + + TRACE("(%p)->(%p)\n", session, out); + + if (!out) + return NULL_PTR_ERR; + + *out = session->channel_count; + + return S_OK; +} + +static HRESULT WINAPI channelvolume_SetChannelVolume(IChannelAudioVolume *iface, UINT32 index, + float level, const GUID *context) +{ + struct audio_session_wrapper *This = impl_from_IChannelAudioVolume(iface); + struct audio_session *session = This->session; + struct audio_client *client; + + TRACE("(%p)->(%d, %f, %s)\n", session, index, level, wine_dbgstr_guid(context)); + + if (level < 0.f || level > 1.f) + return E_INVALIDARG; + + if (index >= session->channel_count) + return E_INVALIDARG; + + if (context) + FIXME("Notifications not supported yet\n"); + + sessions_lock(); + + session->channel_vols[index] = level; + + LIST_FOR_EACH_ENTRY(client, &session->clients, struct audio_client, entry) + set_stream_volumes(client); + + sessions_unlock(); + + return S_OK; +} + +static HRESULT WINAPI channelvolume_GetChannelVolume(IChannelAudioVolume *iface, UINT32 index, + float *level) +{ + struct audio_session_wrapper *This = impl_from_IChannelAudioVolume(iface); + struct audio_session *session = This->session; + + TRACE("(%p)->(%d, %p)\n", session, index, level); + + if (!level) + return NULL_PTR_ERR; + + if (index >= session->channel_count) + return E_INVALIDARG; + + *level = session->channel_vols[index]; + + return S_OK; +} + +static HRESULT WINAPI channelvolume_SetAllVolumes(IChannelAudioVolume *iface, UINT32 count, + const float *levels, const GUID *context) +{ + struct audio_session_wrapper *This = impl_from_IChannelAudioVolume(iface); + struct audio_session *session = This->session; + struct audio_client *client; + unsigned int i; + + TRACE("(%p)->(%d, %p, %s)\n", session, count, levels, wine_dbgstr_guid(context)); + + if (!levels) + return NULL_PTR_ERR; + + if (count != session->channel_count) + return E_INVALIDARG; + + if (context) + FIXME("Notifications not supported yet\n"); + + sessions_lock(); + + for (i = 0; i < count; ++i) + session->channel_vols[i] = levels[i]; + + LIST_FOR_EACH_ENTRY(client, &session->clients, struct audio_client, entry) + set_stream_volumes(client); + + sessions_unlock(); + + return S_OK; +} + +static HRESULT WINAPI channelvolume_GetAllVolumes(IChannelAudioVolume *iface, UINT32 count, + float *levels) +{ + struct audio_session_wrapper *This = impl_from_IChannelAudioVolume(iface); + struct audio_session *session = This->session; + unsigned int i; + + TRACE("(%p)->(%d, %p)\n", session, count, levels); + + if (!levels) + return NULL_PTR_ERR; + + if (count != session->channel_count) + return E_INVALIDARG; + + for (i = 0; i < count; ++i) + levels[i] = session->channel_vols[i]; + + return S_OK; +} + +const IChannelAudioVolumeVtbl ChannelAudioVolume_Vtbl = +{ + channelvolume_QueryInterface, + channelvolume_AddRef, + channelvolume_Release, + channelvolume_GetChannelCount, + channelvolume_SetChannelVolume, + channelvolume_GetChannelVolume, + channelvolume_SetAllVolumes, + channelvolume_GetAllVolumes +}; + static HRESULT WINAPI simplevolume_QueryInterface(ISimpleAudioVolume *iface, REFIID riid, void **ppv) { diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c index 96d71e98272..3952d2e6718 100644 --- a/dlls/winealsa.drv/mmdevdrv.c +++ b/dlls/winealsa.drv/mmdevdrv.c @@ -77,7 +77,7 @@ extern const ISimpleAudioVolumeVtbl SimpleAudioVolume_Vtbl; static const IAudioClockVtbl AudioClock_Vtbl; static const IAudioClock2Vtbl AudioClock2_Vtbl; static const IAudioStreamVolumeVtbl AudioStreamVolume_Vtbl; -static const IChannelAudioVolumeVtbl ChannelAudioVolume_Vtbl; +extern const IChannelAudioVolumeVtbl ChannelAudioVolume_Vtbl;
static AudioSessionWrapper *AudioSessionWrapper_Create(ACImpl *client);
@@ -106,11 +106,6 @@ static inline ACImpl *impl_from_IAudioCaptureClient(IAudioCaptureClient *iface) return CONTAINING_RECORD(iface, ACImpl, IAudioCaptureClient_iface); }
-static inline AudioSessionWrapper *impl_from_IChannelAudioVolume(IChannelAudioVolume *iface) -{ - return CONTAINING_RECORD(iface, AudioSessionWrapper, IChannelAudioVolume_iface); -} - static inline ACImpl *impl_from_IAudioClock(IAudioClock *iface) { return CONTAINING_RECORD(iface, ACImpl, IAudioClock_iface); @@ -1659,177 +1654,6 @@ static const IAudioStreamVolumeVtbl AudioStreamVolume_Vtbl = AudioStreamVolume_GetAllVolumes };
-static HRESULT WINAPI ChannelAudioVolume_QueryInterface( - IChannelAudioVolume *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_IChannelAudioVolume)) - *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 ChannelAudioVolume_AddRef(IChannelAudioVolume *iface) -{ - AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); - return IAudioSessionControl2_AddRef(&This->IAudioSessionControl2_iface); -} - -static ULONG WINAPI ChannelAudioVolume_Release(IChannelAudioVolume *iface) -{ - AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); - return IAudioSessionControl2_Release(&This->IAudioSessionControl2_iface); -} - -static HRESULT WINAPI ChannelAudioVolume_GetChannelCount( - IChannelAudioVolume *iface, UINT32 *out) -{ - AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); - AudioSession *session = This->session; - - TRACE("(%p)->(%p)\n", session, out); - - if(!out) - return NULL_PTR_ERR; - - *out = session->channel_count; - - return S_OK; -} - -static HRESULT WINAPI ChannelAudioVolume_SetChannelVolume( - IChannelAudioVolume *iface, UINT32 index, float level, - const GUID *context) -{ - AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); - AudioSession *session = This->session; - ACImpl *client; - - TRACE("(%p)->(%d, %f, %s)\n", session, index, level, - wine_dbgstr_guid(context)); - - if(level < 0.f || level > 1.f) - return E_INVALIDARG; - - if(index >= session->channel_count) - return E_INVALIDARG; - - if(context) - FIXME("Notifications not supported yet\n"); - - TRACE("ALSA does not support volume control\n"); - - sessions_lock(); - - session->channel_vols[index] = level; - - LIST_FOR_EACH_ENTRY(client, &session->clients, ACImpl, entry) - set_stream_volumes(client); - - sessions_unlock(); - - return S_OK; -} - -static HRESULT WINAPI ChannelAudioVolume_GetChannelVolume( - IChannelAudioVolume *iface, UINT32 index, float *level) -{ - AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); - AudioSession *session = This->session; - - TRACE("(%p)->(%d, %p)\n", session, index, level); - - if(!level) - return NULL_PTR_ERR; - - if(index >= session->channel_count) - return E_INVALIDARG; - - *level = session->channel_vols[index]; - - return S_OK; -} - -static HRESULT WINAPI ChannelAudioVolume_SetAllVolumes( - IChannelAudioVolume *iface, UINT32 count, const float *levels, - const GUID *context) -{ - AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); - AudioSession *session = This->session; - unsigned int i; - ACImpl *client; - - TRACE("(%p)->(%d, %p, %s)\n", session, count, levels, - wine_dbgstr_guid(context)); - - if(!levels) - return NULL_PTR_ERR; - - if(count != session->channel_count) - return E_INVALIDARG; - - if(context) - FIXME("Notifications not supported yet\n"); - - TRACE("ALSA does not support volume control\n"); - - sessions_lock(); - - for(i = 0; i < count; ++i) - session->channel_vols[i] = levels[i]; - - LIST_FOR_EACH_ENTRY(client, &session->clients, ACImpl, entry) - set_stream_volumes(client); - - sessions_unlock(); - - return S_OK; -} - -static HRESULT WINAPI ChannelAudioVolume_GetAllVolumes( - IChannelAudioVolume *iface, UINT32 count, float *levels) -{ - AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); - AudioSession *session = This->session; - unsigned int i; - - TRACE("(%p)->(%d, %p)\n", session, count, levels); - - if(!levels) - return NULL_PTR_ERR; - - if(count != session->channel_count) - return E_INVALIDARG; - - for(i = 0; i < count; ++i) - levels[i] = session->channel_vols[i]; - - return S_OK; -} - -static const IChannelAudioVolumeVtbl ChannelAudioVolume_Vtbl = -{ - ChannelAudioVolume_QueryInterface, - ChannelAudioVolume_AddRef, - ChannelAudioVolume_Release, - ChannelAudioVolume_GetChannelCount, - ChannelAudioVolume_SetChannelVolume, - ChannelAudioVolume_GetChannelVolume, - ChannelAudioVolume_SetAllVolumes, - ChannelAudioVolume_GetAllVolumes -}; - HRESULT WINAPI AUDDRV_GetAudioSessionWrapper(const GUID *guid, IMMDevice *device, AudioSessionWrapper **out) {
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/winecoreaudio.drv/mmdevdrv.c | 174 +----------------------------- 1 file changed, 1 insertion(+), 173 deletions(-)
diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c index f387e9f71ab..835bfc6978e 100644 --- a/dlls/winecoreaudio.drv/mmdevdrv.c +++ b/dlls/winecoreaudio.drv/mmdevdrv.c @@ -59,7 +59,7 @@ extern const ISimpleAudioVolumeVtbl SimpleAudioVolume_Vtbl; static const IAudioClockVtbl AudioClock_Vtbl; static const IAudioClock2Vtbl AudioClock2_Vtbl; static const IAudioStreamVolumeVtbl AudioStreamVolume_Vtbl; -static const IChannelAudioVolumeVtbl ChannelAudioVolume_Vtbl; +extern const IChannelAudioVolumeVtbl ChannelAudioVolume_Vtbl;
static WCHAR drv_key_devicesW[256];
@@ -100,11 +100,6 @@ static inline ACImpl *impl_from_IAudioCaptureClient(IAudioCaptureClient *iface) return CONTAINING_RECORD(iface, ACImpl, IAudioCaptureClient_iface); }
-static inline AudioSessionWrapper *impl_from_IChannelAudioVolume(IChannelAudioVolume *iface) -{ - return CONTAINING_RECORD(iface, AudioSessionWrapper, IChannelAudioVolume_iface); -} - static inline ACImpl *impl_from_IAudioClock(IAudioClock *iface) { return CONTAINING_RECORD(iface, ACImpl, IAudioClock_iface); @@ -1607,173 +1602,6 @@ static const IAudioStreamVolumeVtbl AudioStreamVolume_Vtbl = AudioStreamVolume_GetAllVolumes };
-static HRESULT WINAPI ChannelAudioVolume_QueryInterface( - IChannelAudioVolume *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_IChannelAudioVolume)) - *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 ChannelAudioVolume_AddRef(IChannelAudioVolume *iface) -{ - AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); - return IAudioSessionControl2_AddRef(&This->IAudioSessionControl2_iface); -} - -static ULONG WINAPI ChannelAudioVolume_Release(IChannelAudioVolume *iface) -{ - AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); - return IAudioSessionControl2_Release(&This->IAudioSessionControl2_iface); -} - -static HRESULT WINAPI ChannelAudioVolume_GetChannelCount( - IChannelAudioVolume *iface, UINT32 *out) -{ - AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); - AudioSession *session = This->session; - - TRACE("(%p)->(%p)\n", session, out); - - if(!out) - return NULL_PTR_ERR; - - *out = session->channel_count; - - return S_OK; -} - -static HRESULT WINAPI ChannelAudioVolume_SetChannelVolume( - IChannelAudioVolume *iface, UINT32 index, float level, - const GUID *context) -{ - AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); - AudioSession *session = This->session; - ACImpl *client; - - TRACE("(%p)->(%d, %f, %s)\n", session, index, level, - wine_dbgstr_guid(context)); - - if(level < 0.f || level > 1.f) - return E_INVALIDARG; - - if(index >= session->channel_count) - return E_INVALIDARG; - - if(context) - FIXME("Notifications not supported yet\n"); - - sessions_lock(); - - session->channel_vols[index] = level; - - LIST_FOR_EACH_ENTRY(client, &session->clients, ACImpl, entry) - set_stream_volumes(client); - - sessions_unlock(); - - return S_OK; -} - -static HRESULT WINAPI ChannelAudioVolume_GetChannelVolume( - IChannelAudioVolume *iface, UINT32 index, float *level) -{ - AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); - AudioSession *session = This->session; - - TRACE("(%p)->(%d, %p)\n", session, index, level); - - if(!level) - return NULL_PTR_ERR; - - if(index >= session->channel_count) - return E_INVALIDARG; - - *level = session->channel_vols[index]; - - return S_OK; -} - -static HRESULT WINAPI ChannelAudioVolume_SetAllVolumes( - IChannelAudioVolume *iface, UINT32 count, const float *levels, - const GUID *context) -{ - AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); - AudioSession *session = This->session; - ACImpl *client; - UINT32 i; - - TRACE("(%p)->(%d, %p, %s)\n", session, count, levels, - wine_dbgstr_guid(context)); - - if(!levels) - return NULL_PTR_ERR; - - if(count != session->channel_count) - return E_INVALIDARG; - - if(context) - FIXME("Notifications not supported yet\n"); - - sessions_lock(); - - for(i = 0; i < count; ++i) - session->channel_vols[i] = levels[i]; - - LIST_FOR_EACH_ENTRY(client, &session->clients, ACImpl, entry) - set_stream_volumes(client); - - sessions_unlock(); - - return S_OK; -} - -static HRESULT WINAPI ChannelAudioVolume_GetAllVolumes( - IChannelAudioVolume *iface, UINT32 count, float *levels) -{ - AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); - AudioSession *session = This->session; - int i; - - TRACE("(%p)->(%d, %p)\n", session, count, levels); - - if(!levels) - return NULL_PTR_ERR; - - if(count != session->channel_count) - return E_INVALIDARG; - - for(i = 0; i < count; ++i) - levels[i] = session->channel_vols[i]; - - return S_OK; -} - -static const IChannelAudioVolumeVtbl ChannelAudioVolume_Vtbl = -{ - ChannelAudioVolume_QueryInterface, - ChannelAudioVolume_AddRef, - ChannelAudioVolume_Release, - ChannelAudioVolume_GetChannelCount, - ChannelAudioVolume_SetChannelVolume, - ChannelAudioVolume_GetChannelVolume, - ChannelAudioVolume_SetAllVolumes, - ChannelAudioVolume_GetAllVolumes -}; - HRESULT WINAPI AUDDRV_GetAudioSessionWrapper(const GUID *guid, IMMDevice *device, AudioSessionWrapper **out) {
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/wineoss.drv/mmdevdrv.c | 176 +----------------------------------- 1 file changed, 1 insertion(+), 175 deletions(-)
diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c index d41d0597721..ae9d879cb02 100644 --- a/dlls/wineoss.drv/mmdevdrv.c +++ b/dlls/wineoss.drv/mmdevdrv.c @@ -85,7 +85,7 @@ extern const ISimpleAudioVolumeVtbl SimpleAudioVolume_Vtbl; static const IAudioClockVtbl AudioClock_Vtbl; static const IAudioClock2Vtbl AudioClock2_Vtbl; static const IAudioStreamVolumeVtbl AudioStreamVolume_Vtbl; -static const IChannelAudioVolumeVtbl ChannelAudioVolume_Vtbl; +extern const IChannelAudioVolumeVtbl ChannelAudioVolume_Vtbl;
void DECLSPEC_HIDDEN sessions_lock(void) { @@ -112,11 +112,6 @@ static inline ACImpl *impl_from_IAudioCaptureClient(IAudioCaptureClient *iface) return CONTAINING_RECORD(iface, ACImpl, IAudioCaptureClient_iface); }
-static inline AudioSessionWrapper *impl_from_IChannelAudioVolume(IChannelAudioVolume *iface) -{ - return CONTAINING_RECORD(iface, AudioSessionWrapper, IChannelAudioVolume_iface); -} - static inline ACImpl *impl_from_IAudioClock(IAudioClock *iface) { return CONTAINING_RECORD(iface, ACImpl, IAudioClock_iface); @@ -1608,175 +1603,6 @@ static const IAudioStreamVolumeVtbl AudioStreamVolume_Vtbl = AudioStreamVolume_GetAllVolumes };
-static HRESULT WINAPI ChannelAudioVolume_QueryInterface( - IChannelAudioVolume *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_IChannelAudioVolume)) - *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 ChannelAudioVolume_AddRef(IChannelAudioVolume *iface) -{ - AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); - return IAudioSessionControl2_AddRef(&This->IAudioSessionControl2_iface); -} - -static ULONG WINAPI ChannelAudioVolume_Release(IChannelAudioVolume *iface) -{ - AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); - return IAudioSessionControl2_Release(&This->IAudioSessionControl2_iface); -} - -static HRESULT WINAPI ChannelAudioVolume_GetChannelCount( - IChannelAudioVolume *iface, UINT32 *out) -{ - AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); - AudioSession *session = This->session; - - TRACE("(%p)->(%p)\n", session, out); - - if(!out) - return NULL_PTR_ERR; - - *out = session->channel_count; - - return S_OK; -} - -static HRESULT WINAPI ChannelAudioVolume_SetChannelVolume( - IChannelAudioVolume *iface, UINT32 index, float level, - const GUID *context) -{ - AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); - AudioSession *session = This->session; - ACImpl *client; - - TRACE("(%p)->(%d, %f, %s)\n", session, index, level, - wine_dbgstr_guid(context)); - - if(level < 0.f || level > 1.f) - return E_INVALIDARG; - - if(index >= session->channel_count) - return E_INVALIDARG; - - if(context) - FIXME("Notifications not supported yet\n"); - - sessions_lock(); - - session->channel_vols[index] = level; - - TRACE("OSS doesn't support setting volume\n"); - LIST_FOR_EACH_ENTRY(client, &session->clients, ACImpl, entry) - set_stream_volumes(client); - - sessions_unlock(); - - return S_OK; -} - -static HRESULT WINAPI ChannelAudioVolume_GetChannelVolume( - IChannelAudioVolume *iface, UINT32 index, float *level) -{ - AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); - AudioSession *session = This->session; - - TRACE("(%p)->(%d, %p)\n", session, index, level); - - if(!level) - return NULL_PTR_ERR; - - if(index >= session->channel_count) - return E_INVALIDARG; - - *level = session->channel_vols[index]; - - return S_OK; -} - -static HRESULT WINAPI ChannelAudioVolume_SetAllVolumes( - IChannelAudioVolume *iface, UINT32 count, const float *levels, - const GUID *context) -{ - AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); - AudioSession *session = This->session; - ACImpl *client; - int i; - - TRACE("(%p)->(%d, %p, %s)\n", session, count, levels, - wine_dbgstr_guid(context)); - - if(!levels) - return NULL_PTR_ERR; - - if(count != session->channel_count) - return E_INVALIDARG; - - if(context) - FIXME("Notifications not supported yet\n"); - - sessions_lock(); - - for(i = 0; i < count; ++i) - session->channel_vols[i] = levels[i]; - - TRACE("OSS doesn't support setting volume\n"); - LIST_FOR_EACH_ENTRY(client, &session->clients, ACImpl, entry) - set_stream_volumes(client); - - sessions_unlock(); - - return S_OK; -} - -static HRESULT WINAPI ChannelAudioVolume_GetAllVolumes( - IChannelAudioVolume *iface, UINT32 count, float *levels) -{ - AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); - AudioSession *session = This->session; - int i; - - TRACE("(%p)->(%d, %p)\n", session, count, levels); - - if(!levels) - return NULL_PTR_ERR; - - if(count != session->channel_count) - return E_INVALIDARG; - - for(i = 0; i < count; ++i) - levels[i] = session->channel_vols[i]; - - return S_OK; -} - -static const IChannelAudioVolumeVtbl ChannelAudioVolume_Vtbl = -{ - ChannelAudioVolume_QueryInterface, - ChannelAudioVolume_AddRef, - ChannelAudioVolume_Release, - ChannelAudioVolume_GetChannelCount, - ChannelAudioVolume_SetChannelVolume, - ChannelAudioVolume_GetChannelVolume, - ChannelAudioVolume_SetAllVolumes, - ChannelAudioVolume_GetAllVolumes -}; - HRESULT WINAPI AUDDRV_GetAudioSessionWrapper(const GUID *guid, IMMDevice *device, AudioSessionWrapper **out) {
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/winepulse.drv/mmdevdrv.c | 171 +--------------------------------- 1 file changed, 1 insertion(+), 170 deletions(-)
diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c index 54d81b4b7e8..84ac537701b 100644 --- a/dlls/winepulse.drv/mmdevdrv.c +++ b/dlls/winepulse.drv/mmdevdrv.c @@ -129,7 +129,7 @@ static const IAudioRenderClientVtbl AudioRenderClient_Vtbl; static const IAudioCaptureClientVtbl AudioCaptureClient_Vtbl; extern const IAudioSessionControl2Vtbl AudioSessionControl2_Vtbl; extern const ISimpleAudioVolumeVtbl SimpleAudioVolume_Vtbl; -static const IChannelAudioVolumeVtbl ChannelAudioVolume_Vtbl; +extern const IChannelAudioVolumeVtbl ChannelAudioVolume_Vtbl; static const IAudioClockVtbl AudioClock_Vtbl; static const IAudioClock2Vtbl AudioClock2_Vtbl; static const IAudioStreamVolumeVtbl AudioStreamVolume_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_IChannelAudioVolume(IChannelAudioVolume *iface) -{ - return CONTAINING_RECORD(iface, AudioSessionWrapper, IChannelAudioVolume_iface); -} - static inline ACImpl *impl_from_IAudioClock(IAudioClock *iface) { return CONTAINING_RECORD(iface, ACImpl, IAudioClock_iface); @@ -1886,170 +1881,6 @@ static AudioSessionWrapper *AudioSessionWrapper_Create(ACImpl *client) return ret; }
-static HRESULT WINAPI ChannelAudioVolume_QueryInterface( - IChannelAudioVolume *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_IChannelAudioVolume)) - *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 ChannelAudioVolume_AddRef(IChannelAudioVolume *iface) -{ - AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); - return IAudioSessionControl2_AddRef(&This->IAudioSessionControl2_iface); -} - -static ULONG WINAPI ChannelAudioVolume_Release(IChannelAudioVolume *iface) -{ - AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); - return IAudioSessionControl2_Release(&This->IAudioSessionControl2_iface); -} - -static HRESULT WINAPI ChannelAudioVolume_GetChannelCount( - IChannelAudioVolume *iface, UINT32 *out) -{ - AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); - AudioSession *session = This->session; - - TRACE("(%p)->(%p)\n", session, out); - - if (!out) - return NULL_PTR_ERR; - - *out = session->channel_count; - - return S_OK; -} - -static HRESULT WINAPI ChannelAudioVolume_SetChannelVolume( - IChannelAudioVolume *iface, UINT32 index, float level, - const GUID *context) -{ - AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); - AudioSession *session = This->session; - ACImpl *client; - - TRACE("(%p)->(%d, %f, %s)\n", session, index, level, - wine_dbgstr_guid(context)); - - if (level < 0.f || level > 1.f) - return E_INVALIDARG; - - if (index >= session->channel_count) - return E_INVALIDARG; - - if (context) - FIXME("Notifications not supported yet\n"); - - TRACE("PulseAudio does not support session volume control\n"); - - sessions_lock(); - session->channel_vols[index] = level; - LIST_FOR_EACH_ENTRY(client, &This->session->clients, ACImpl, entry) - set_stream_volumes(client); - sessions_unlock(); - - return S_OK; -} - -static HRESULT WINAPI ChannelAudioVolume_GetChannelVolume( - IChannelAudioVolume *iface, UINT32 index, float *level) -{ - AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); - AudioSession *session = This->session; - - TRACE("(%p)->(%d, %p)\n", session, index, level); - - if (!level) - return NULL_PTR_ERR; - - if (index >= session->channel_count) - return E_INVALIDARG; - - *level = session->channel_vols[index]; - - return S_OK; -} - -static HRESULT WINAPI ChannelAudioVolume_SetAllVolumes( - IChannelAudioVolume *iface, UINT32 count, const float *levels, - const GUID *context) -{ - AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); - AudioSession *session = This->session; - ACImpl *client; - int i; - - TRACE("(%p)->(%d, %p, %s)\n", session, count, levels, - wine_dbgstr_guid(context)); - - if (!levels) - return NULL_PTR_ERR; - - if (count != session->channel_count) - return E_INVALIDARG; - - if (context) - FIXME("Notifications not supported yet\n"); - - TRACE("PulseAudio does not support session volume control\n"); - - sessions_lock(); - for(i = 0; i < count; ++i) - session->channel_vols[i] = levels[i]; - LIST_FOR_EACH_ENTRY(client, &This->session->clients, ACImpl, entry) - set_stream_volumes(client); - sessions_unlock(); - return S_OK; -} - -static HRESULT WINAPI ChannelAudioVolume_GetAllVolumes( - IChannelAudioVolume *iface, UINT32 count, float *levels) -{ - AudioSessionWrapper *This = impl_from_IChannelAudioVolume(iface); - AudioSession *session = This->session; - int i; - - TRACE("(%p)->(%d, %p)\n", session, count, levels); - - if (!levels) - return NULL_PTR_ERR; - - if (count != session->channel_count) - return E_INVALIDARG; - - for(i = 0; i < count; ++i) - levels[i] = session->channel_vols[i]; - - return S_OK; -} - -static const IChannelAudioVolumeVtbl ChannelAudioVolume_Vtbl = -{ - ChannelAudioVolume_QueryInterface, - ChannelAudioVolume_AddRef, - ChannelAudioVolume_Release, - ChannelAudioVolume_GetChannelCount, - ChannelAudioVolume_SetChannelVolume, - ChannelAudioVolume_GetChannelVolume, - ChannelAudioVolume_SetAllVolumes, - ChannelAudioVolume_GetAllVolumes -}; - HRESULT WINAPI AUDDRV_GetAudioSessionWrapper(const GUID *guid, IMMDevice *device, AudioSessionWrapper **out) {
This merge request was approved by Huw Davies.