-- v13: winepulse: Use mmdevapi's AudioSessionControl. wineoss: Use mmdevapi's AudioSessionControl. winecoreaudio: Use mmdevapi's AudioSessionControl. winealsa: Move AudioSessionControl into mmdevapi.
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/mmdevapi/Makefile.in | 1 + dlls/mmdevapi/audiosessionmanager.c | 19 +++ dlls/mmdevapi/session.c | 249 +++++++++++++++++++++++++++ dlls/winealsa.drv/Makefile.in | 4 +- dlls/winealsa.drv/mmdevdrv.c | 254 +--------------------------- 5 files changed, 275 insertions(+), 252 deletions(-) create mode 100644 dlls/mmdevapi/session.c
diff --git a/dlls/mmdevapi/Makefile.in b/dlls/mmdevapi/Makefile.in index 85a52d87184..120f9d81fa4 100644 --- a/dlls/mmdevapi/Makefile.in +++ b/dlls/mmdevapi/Makefile.in @@ -6,6 +6,7 @@ C_SRCS = \ audiovolume.c \ devenum.c \ main.c \ + session.c \ spatialaudio.c
IDL_SRCS = mmdevapi_classes.idl diff --git a/dlls/mmdevapi/audiosessionmanager.c b/dlls/mmdevapi/audiosessionmanager.c index 039b1c264df..71799590e5e 100644 --- a/dlls/mmdevapi/audiosessionmanager.c +++ b/dlls/mmdevapi/audiosessionmanager.c @@ -28,6 +28,25 @@ WINE_DEFAULT_DEBUG_CHANNEL(mmdevapi);
static struct list g_sessions = LIST_INIT(g_sessions);
+static CRITICAL_SECTION g_sessions_lock; +static CRITICAL_SECTION_DEBUG g_sessions_lock_debug = +{ + 0, 0, &g_sessions_lock, + { &g_sessions_lock_debug.ProcessLocksList, &g_sessions_lock_debug.ProcessLocksList }, + 0, 0, { (DWORD_PTR)(__FILE__ ": g_sessions_lock") } +}; +static CRITICAL_SECTION g_sessions_lock = { &g_sessions_lock_debug, -1, 0, 0, 0, 0 }; + +void sessions_lock(void) +{ + EnterCriticalSection(&g_sessions_lock); +} + +void sessions_unlock(void) +{ + LeaveCriticalSection(&g_sessions_lock); +} + static inline struct session_mgr *impl_from_IAudioSessionManager2(IAudioSessionManager2 *iface) { return CONTAINING_RECORD(iface, struct session_mgr, IAudioSessionManager2_iface); diff --git a/dlls/mmdevapi/session.c b/dlls/mmdevapi/session.c new file mode 100644 index 00000000000..8ba8bed5fc4 --- /dev/null +++ b/dlls/mmdevapi/session.c @@ -0,0 +1,249 @@ +/* + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ +#define COBJMACROS + +#include <audiopolicy.h> +#include <mmdeviceapi.h> +#include <winternl.h> + +#include <wine/debug.h> +#include <wine/unixlib.h> + +#include "mmdevdrv.h" +#include "unixlib.h" + +#define NULL_PTR_ERR MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, RPC_X_NULL_REF_POINTER) + +WINE_DEFAULT_DEBUG_CHANNEL(mmdevapi); + +extern void sessions_lock(void) DECLSPEC_HIDDEN; +extern void sessions_unlock(void) DECLSPEC_HIDDEN; + +extern const IAudioClient3Vtbl AudioClient3_Vtbl; + +static inline struct audio_session_wrapper *impl_from_IAudioSessionControl2(IAudioSessionControl2 *iface) +{ + return CONTAINING_RECORD(iface, struct audio_session_wrapper, IAudioSessionControl2_iface); +} + +static HRESULT WINAPI control_QueryInterface(IAudioSessionControl2 *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_IAudioSessionControl) || + IsEqualIID(riid, &IID_IAudioSessionControl2)) + *ppv = iface; + else { + *ppv = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown *)*ppv); + + return S_OK; +} + +static ULONG WINAPI control_AddRef(IAudioSessionControl2 *iface) +{ + struct audio_session_wrapper *This = impl_from_IAudioSessionControl2(iface); + ULONG ref = InterlockedIncrement(&This->ref); + TRACE("(%p) Refcount now %lu\n", This, ref); + return ref; +} + +static ULONG WINAPI control_Release(IAudioSessionControl2 *iface) +{ + struct audio_session_wrapper *This = impl_from_IAudioSessionControl2(iface); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p) Refcount now %lu\n", This, ref); + + if (!ref) { + if (This->client) { + sessions_lock(); + This->client->session_wrapper = NULL; + sessions_unlock(); + IAudioClient3_Release(&This->client->IAudioClient3_iface); + } + + HeapFree(GetProcessHeap(), 0, This); + } + + return ref; +} + +static HRESULT WINAPI control_GetState(IAudioSessionControl2 *iface, AudioSessionState *state) +{ + struct audio_session_wrapper *This = impl_from_IAudioSessionControl2(iface); + struct is_started_params params; + struct audio_client *client; + + TRACE("(%p)->(%p)\n", This, state); + + if (!state) + return NULL_PTR_ERR; + + sessions_lock(); + + if (list_empty(&This->session->clients)) { + *state = AudioSessionStateExpired; + sessions_unlock(); + return S_OK; + } + + LIST_FOR_EACH_ENTRY(client, &This->session->clients, struct audio_client, entry) { + params.stream = client->stream; + WINE_UNIX_CALL(is_started, ¶ms); + if (params.result == S_OK) { + *state = AudioSessionStateActive; + sessions_unlock(); + return S_OK; + } + } + + sessions_unlock(); + + *state = AudioSessionStateInactive; + + return S_OK; +} + +static HRESULT WINAPI control_GetDisplayName(IAudioSessionControl2 *iface, WCHAR **name) +{ + struct audio_session_wrapper *This = impl_from_IAudioSessionControl2(iface); + FIXME("(%p)->(%p) - stub\n", This, name); + return E_NOTIMPL; +} + +static HRESULT WINAPI control_SetDisplayName(IAudioSessionControl2 *iface, const WCHAR *name, + const GUID *session) +{ + struct audio_session_wrapper *This = impl_from_IAudioSessionControl2(iface); + FIXME("(%p)->(%p, %s) - stub\n", This, name, debugstr_guid(session)); + return E_NOTIMPL; +} + +static HRESULT WINAPI control_GetIconPath(IAudioSessionControl2 *iface, WCHAR **path) +{ + struct audio_session_wrapper *This = impl_from_IAudioSessionControl2(iface); + FIXME("(%p)->(%p) - stub\n", This, path); + return E_NOTIMPL; +} + +static HRESULT WINAPI control_SetIconPath(IAudioSessionControl2 *iface, const WCHAR *path, + const GUID *session) +{ + struct audio_session_wrapper *This = impl_from_IAudioSessionControl2(iface); + FIXME("(%p)->(%s, %s) - stub\n", This, debugstr_w(path), debugstr_guid(session)); + return E_NOTIMPL; +} + +static HRESULT WINAPI control_GetGroupingParam(IAudioSessionControl2 *iface, GUID *group) +{ + struct audio_session_wrapper *This = impl_from_IAudioSessionControl2(iface); + FIXME("(%p)->(%p) - stub\n", This, group); + return E_NOTIMPL; +} + +static HRESULT WINAPI control_SetGroupingParam(IAudioSessionControl2 *iface, const GUID *group, + const GUID *session) +{ + struct audio_session_wrapper *This = impl_from_IAudioSessionControl2(iface); + FIXME("(%p)->(%s, %s) - stub\n", This, debugstr_guid(group), debugstr_guid(session)); + return E_NOTIMPL; +} + +static HRESULT WINAPI control_RegisterAudioSessionNotification(IAudioSessionControl2 *iface, + IAudioSessionEvents *events) +{ + struct audio_session_wrapper *This = impl_from_IAudioSessionControl2(iface); + FIXME("(%p)->(%p) - stub\n", This, events); + return S_OK; +} + +static HRESULT WINAPI control_UnregisterAudioSessionNotification(IAudioSessionControl2 *iface, + IAudioSessionEvents *events) +{ + struct audio_session_wrapper *This = impl_from_IAudioSessionControl2(iface); + FIXME("(%p)->(%p) - stub\n", This, events); + return S_OK; +} + +static HRESULT WINAPI control_GetSessionIdentifier(IAudioSessionControl2 *iface, WCHAR **id) +{ + struct audio_session_wrapper *This = impl_from_IAudioSessionControl2(iface); + FIXME("(%p)->(%p) - stub\n", This, id); + return E_NOTIMPL; +} + +static HRESULT WINAPI control_GetSessionInstanceIdentifier(IAudioSessionControl2 *iface, WCHAR **id) +{ + struct audio_session_wrapper *This = impl_from_IAudioSessionControl2(iface); + FIXME("(%p)->(%p) - stub\n", This, id); + return E_NOTIMPL; +} + +static HRESULT WINAPI control_GetProcessId(IAudioSessionControl2 *iface, DWORD *pid) +{ + struct audio_session_wrapper *This = impl_from_IAudioSessionControl2(iface); + + TRACE("(%p)->(%p)\n", This, pid); + + if (!pid) + return E_POINTER; + + *pid = GetCurrentProcessId(); + + return S_OK; +} + +static HRESULT WINAPI control_IsSystemSoundsSession(IAudioSessionControl2 *iface) +{ + struct audio_session_wrapper *This = impl_from_IAudioSessionControl2(iface); + TRACE("(%p)\n", This); + return S_FALSE; +} + +static HRESULT WINAPI control_SetDuckingPreference(IAudioSessionControl2 *iface, BOOL optout) +{ + struct audio_session_wrapper *This = impl_from_IAudioSessionControl2(iface); + TRACE("(%p)->(%d)\n", This, optout); + return S_OK; +} + +const IAudioSessionControl2Vtbl AudioSessionControl2_Vtbl = +{ + control_QueryInterface, + control_AddRef, + control_Release, + control_GetState, + control_GetDisplayName, + control_SetDisplayName, + control_GetIconPath, + control_SetIconPath, + control_GetGroupingParam, + control_SetGroupingParam, + control_RegisterAudioSessionNotification, + control_UnregisterAudioSessionNotification, + control_GetSessionIdentifier, + control_GetSessionInstanceIdentifier, + control_GetProcessId, + control_IsSystemSoundsSession, + control_SetDuckingPreference +}; diff --git a/dlls/winealsa.drv/Makefile.in b/dlls/winealsa.drv/Makefile.in index 94884bc3c2b..39e378cb7df 100644 --- a/dlls/winealsa.drv/Makefile.in +++ b/dlls/winealsa.drv/Makefile.in @@ -1,6 +1,7 @@ MODULE = winealsa.drv UNIXLIB = winealsa.so IMPORTS = uuid ole32 advapi32 +PARENTSRC = ../mmdevapi DELAYIMPORTS = winmm UNIX_LIBS = $(ALSA_LIBS) $(PTHREAD_LIBS)
@@ -8,4 +9,5 @@ C_SRCS = \ alsa.c \ alsamidi.c \ midi.c \ - mmdevdrv.c + mmdevdrv.c \ + session.c diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c index cab960cd838..3af83d94eae 100644 --- a/dlls/winealsa.drv/mmdevdrv.c +++ b/dlls/winealsa.drv/mmdevdrv.c @@ -72,7 +72,7 @@ static const WCHAR guidW[] = {'g','u','i','d',0}; static const IAudioClient3Vtbl AudioClient3_Vtbl; static const IAudioRenderClientVtbl AudioRenderClient_Vtbl; static const IAudioCaptureClientVtbl AudioCaptureClient_Vtbl; -static const IAudioSessionControl2Vtbl AudioSessionControl2_Vtbl; +extern const IAudioSessionControl2Vtbl AudioSessionControl2_Vtbl; static const ISimpleAudioVolumeVtbl SimpleAudioVolume_Vtbl; static const IAudioClockVtbl AudioClock_Vtbl; static const IAudioClock2Vtbl AudioClock2_Vtbl; @@ -81,12 +81,12 @@ static const IChannelAudioVolumeVtbl ChannelAudioVolume_Vtbl;
static AudioSessionWrapper *AudioSessionWrapper_Create(ACImpl *client);
-static void sessions_lock(void) +void DECLSPEC_HIDDEN sessions_lock(void) { EnterCriticalSection(&g_sessions_lock); }
-static void sessions_unlock(void) +void DECLSPEC_HIDDEN sessions_unlock(void) { LeaveCriticalSection(&g_sessions_lock); } @@ -106,11 +106,6 @@ static inline ACImpl *impl_from_IAudioCaptureClient(IAudioCaptureClient *iface) return CONTAINING_RECORD(iface, ACImpl, IAudioCaptureClient_iface); }
-static inline AudioSessionWrapper *impl_from_IAudioSessionControl2(IAudioSessionControl2 *iface) -{ - return CONTAINING_RECORD(iface, AudioSessionWrapper, IAudioSessionControl2_iface); -} - static inline AudioSessionWrapper *impl_from_ISimpleAudioVolume(ISimpleAudioVolume *iface) { return CONTAINING_RECORD(iface, AudioSessionWrapper, ISimpleAudioVolume_iface); @@ -1516,249 +1511,6 @@ static AudioSessionWrapper *AudioSessionWrapper_Create(ACImpl *client) return ret; }
-static HRESULT WINAPI AudioSessionControl_QueryInterface( - IAudioSessionControl2 *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_IAudioSessionControl) || - IsEqualIID(riid, &IID_IAudioSessionControl2)) - *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 AudioSessionControl_AddRef(IAudioSessionControl2 *iface) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - ULONG ref; - ref = InterlockedIncrement(&This->ref); - TRACE("(%p) Refcount now %lu\n", This, ref); - return ref; -} - -static ULONG WINAPI AudioSessionControl_Release(IAudioSessionControl2 *iface) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - ULONG ref; - ref = InterlockedDecrement(&This->ref); - TRACE("(%p) Refcount now %lu\n", This, ref); - if(!ref){ - if(This->client){ - sessions_lock(); - This->client->session_wrapper = NULL; - sessions_unlock(); - IAudioClient3_Release(&This->client->IAudioClient3_iface); - } - HeapFree(GetProcessHeap(), 0, This); - } - return ref; -} - -static HRESULT WINAPI AudioSessionControl_GetState(IAudioSessionControl2 *iface, - AudioSessionState *state) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - struct is_started_params params; - ACImpl *client; - - TRACE("(%p)->(%p)\n", This, state); - - if(!state) - return NULL_PTR_ERR; - - sessions_lock(); - - if(list_empty(&This->session->clients)){ - *state = AudioSessionStateExpired; - sessions_unlock(); - return S_OK; - } - - LIST_FOR_EACH_ENTRY(client, &This->session->clients, ACImpl, entry){ - params.stream = client->stream; - ALSA_CALL(is_started, ¶ms); - if(params.result == S_OK){ - *state = AudioSessionStateActive; - sessions_unlock(); - return S_OK; - } - } - - sessions_unlock(); - - *state = AudioSessionStateInactive; - - return S_OK; -} - -static HRESULT WINAPI AudioSessionControl_GetDisplayName( - IAudioSessionControl2 *iface, WCHAR **name) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%p) - stub\n", This, name); - - return E_NOTIMPL; -} - -static HRESULT WINAPI AudioSessionControl_SetDisplayName( - IAudioSessionControl2 *iface, const WCHAR *name, const GUID *session) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%p, %s) - stub\n", This, name, debugstr_guid(session)); - - return E_NOTIMPL; -} - -static HRESULT WINAPI AudioSessionControl_GetIconPath( - IAudioSessionControl2 *iface, WCHAR **path) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%p) - stub\n", This, path); - - return E_NOTIMPL; -} - -static HRESULT WINAPI AudioSessionControl_SetIconPath( - IAudioSessionControl2 *iface, const WCHAR *path, const GUID *session) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%p, %s) - stub\n", This, path, debugstr_guid(session)); - - return E_NOTIMPL; -} - -static HRESULT WINAPI AudioSessionControl_GetGroupingParam( - IAudioSessionControl2 *iface, GUID *group) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%p) - stub\n", This, group); - - return E_NOTIMPL; -} - -static HRESULT WINAPI AudioSessionControl_SetGroupingParam( - IAudioSessionControl2 *iface, const GUID *group, const GUID *session) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%s, %s) - stub\n", This, debugstr_guid(group), - debugstr_guid(session)); - - return E_NOTIMPL; -} - -static HRESULT WINAPI AudioSessionControl_RegisterAudioSessionNotification( - IAudioSessionControl2 *iface, IAudioSessionEvents *events) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%p) - stub\n", This, events); - - return S_OK; -} - -static HRESULT WINAPI AudioSessionControl_UnregisterAudioSessionNotification( - IAudioSessionControl2 *iface, IAudioSessionEvents *events) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%p) - stub\n", This, events); - - return S_OK; -} - -static HRESULT WINAPI AudioSessionControl_GetSessionIdentifier( - IAudioSessionControl2 *iface, WCHAR **id) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%p) - stub\n", This, id); - - return E_NOTIMPL; -} - -static HRESULT WINAPI AudioSessionControl_GetSessionInstanceIdentifier( - IAudioSessionControl2 *iface, WCHAR **id) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%p) - stub\n", This, id); - - return E_NOTIMPL; -} - -static HRESULT WINAPI AudioSessionControl_GetProcessId( - IAudioSessionControl2 *iface, DWORD *pid) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - TRACE("(%p)->(%p)\n", This, pid); - - if(!pid) - return E_POINTER; - - *pid = GetCurrentProcessId(); - - return S_OK; -} - -static HRESULT WINAPI AudioSessionControl_IsSystemSoundsSession( - IAudioSessionControl2 *iface) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - TRACE("(%p)\n", This); - - return S_FALSE; -} - -static HRESULT WINAPI AudioSessionControl_SetDuckingPreference( - IAudioSessionControl2 *iface, BOOL optout) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - TRACE("(%p)->(%d)\n", This, optout); - - return S_OK; -} - -static const IAudioSessionControl2Vtbl AudioSessionControl2_Vtbl = -{ - AudioSessionControl_QueryInterface, - AudioSessionControl_AddRef, - AudioSessionControl_Release, - AudioSessionControl_GetState, - AudioSessionControl_GetDisplayName, - AudioSessionControl_SetDisplayName, - AudioSessionControl_GetIconPath, - AudioSessionControl_SetIconPath, - AudioSessionControl_GetGroupingParam, - AudioSessionControl_SetGroupingParam, - AudioSessionControl_RegisterAudioSessionNotification, - AudioSessionControl_UnregisterAudioSessionNotification, - AudioSessionControl_GetSessionIdentifier, - AudioSessionControl_GetSessionInstanceIdentifier, - AudioSessionControl_GetProcessId, - AudioSessionControl_IsSystemSoundsSession, - AudioSessionControl_SetDuckingPreference -}; - static HRESULT WINAPI SimpleAudioVolume_QueryInterface( ISimpleAudioVolume *iface, REFIID riid, void **ppv) {
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/winecoreaudio.drv/Makefile.in | 4 +- dlls/winecoreaudio.drv/mmdevdrv.c | 257 +---------------------------- 2 files changed, 6 insertions(+), 255 deletions(-)
diff --git a/dlls/winecoreaudio.drv/Makefile.in b/dlls/winecoreaudio.drv/Makefile.in index 28998a4bbf8..8b40ab19afe 100644 --- a/dlls/winecoreaudio.drv/Makefile.in +++ b/dlls/winecoreaudio.drv/Makefile.in @@ -1,6 +1,7 @@ MODULE = winecoreaudio.drv UNIXLIB = winecoreaudio.so IMPORTS = uuid ole32 user32 advapi32 +PARENTSRC = ../mmdevapi DELAYIMPORTS = winmm UNIX_LIBS = $(COREAUDIO_LIBS)
@@ -8,4 +9,5 @@ C_SRCS = \ coreaudio.c \ coremidi.c \ midi.c \ - mmdevdrv.c + mmdevdrv.c \ + session.c diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c index dc492d4affe..abcca09039a 100644 --- a/dlls/winecoreaudio.drv/mmdevdrv.c +++ b/dlls/winecoreaudio.drv/mmdevdrv.c @@ -54,7 +54,7 @@ static const REFERENCE_TIME MinimumPeriod = 50000; static const IAudioClient3Vtbl AudioClient3_Vtbl; static const IAudioRenderClientVtbl AudioRenderClient_Vtbl; static const IAudioCaptureClientVtbl AudioCaptureClient_Vtbl; -static const IAudioSessionControl2Vtbl AudioSessionControl2_Vtbl; +extern const IAudioSessionControl2Vtbl AudioSessionControl2_Vtbl; static const ISimpleAudioVolumeVtbl SimpleAudioVolume_Vtbl; static const IAudioClockVtbl AudioClock_Vtbl; static const IAudioClock2Vtbl AudioClock2_Vtbl; @@ -75,12 +75,12 @@ static struct list g_sessions = LIST_INIT(g_sessions);
static AudioSessionWrapper *AudioSessionWrapper_Create(ACImpl *client);
-static void sessions_lock(void) +void DECLSPEC_HIDDEN sessions_lock(void) { EnterCriticalSection(&g_sessions_lock); }
-static void sessions_unlock(void) +void DECLSPEC_HIDDEN sessions_unlock(void) { LeaveCriticalSection(&g_sessions_lock); } @@ -100,11 +100,6 @@ static inline ACImpl *impl_from_IAudioCaptureClient(IAudioCaptureClient *iface) return CONTAINING_RECORD(iface, ACImpl, IAudioCaptureClient_iface); }
-static inline AudioSessionWrapper *impl_from_IAudioSessionControl2(IAudioSessionControl2 *iface) -{ - return CONTAINING_RECORD(iface, AudioSessionWrapper, IAudioSessionControl2_iface); -} - static inline AudioSessionWrapper *impl_from_ISimpleAudioVolume(ISimpleAudioVolume *iface) { return CONTAINING_RECORD(iface, AudioSessionWrapper, ISimpleAudioVolume_iface); @@ -1466,252 +1461,6 @@ static AudioSessionWrapper *AudioSessionWrapper_Create(ACImpl *client) return ret; }
-static HRESULT WINAPI AudioSessionControl_QueryInterface( - IAudioSessionControl2 *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_IAudioSessionControl) || - IsEqualIID(riid, &IID_IAudioSessionControl2)) - *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 AudioSessionControl_AddRef(IAudioSessionControl2 *iface) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - ULONG ref; - ref = InterlockedIncrement(&This->ref); - TRACE("(%p) Refcount now %lu\n", This, ref); - return ref; -} - -static ULONG WINAPI AudioSessionControl_Release(IAudioSessionControl2 *iface) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - ULONG ref; - - sessions_lock(); - - ref = InterlockedDecrement(&This->ref); - TRACE("(%p) Refcount now %lu\n", This, ref); - if(!ref){ - if(This->client){ - This->client->session_wrapper = NULL; - IAudioClient3_Release(&This->client->IAudioClient3_iface); - } - HeapFree(GetProcessHeap(), 0, This); - } - - sessions_unlock(); - return ref; -} - -static HRESULT WINAPI AudioSessionControl_GetState(IAudioSessionControl2 *iface, - AudioSessionState *state) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - struct is_started_params params; - ACImpl *client; - - TRACE("(%p)->(%p)\n", This, state); - - if(!state) - return NULL_PTR_ERR; - - sessions_lock(); - - if(list_empty(&This->session->clients)){ - *state = AudioSessionStateExpired; - sessions_unlock(); - return S_OK; - } - - LIST_FOR_EACH_ENTRY(client, &This->session->clients, ACImpl, entry){ - params.stream = client->stream; - UNIX_CALL(is_started, ¶ms); - if(params.result == S_OK){ - *state = AudioSessionStateActive; - sessions_unlock(); - return S_OK; - } - } - - sessions_unlock(); - - *state = AudioSessionStateInactive; - - return S_OK; -} - -static HRESULT WINAPI AudioSessionControl_GetDisplayName( - IAudioSessionControl2 *iface, WCHAR **name) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%p) - stub\n", This, name); - - return E_NOTIMPL; -} - -static HRESULT WINAPI AudioSessionControl_SetDisplayName( - IAudioSessionControl2 *iface, const WCHAR *name, const GUID *session) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%p, %s) - stub\n", This, name, debugstr_guid(session)); - - return E_NOTIMPL; -} - -static HRESULT WINAPI AudioSessionControl_GetIconPath( - IAudioSessionControl2 *iface, WCHAR **path) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%p) - stub\n", This, path); - - return E_NOTIMPL; -} - -static HRESULT WINAPI AudioSessionControl_SetIconPath( - IAudioSessionControl2 *iface, const WCHAR *path, const GUID *session) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%p, %s) - stub\n", This, path, debugstr_guid(session)); - - return E_NOTIMPL; -} - -static HRESULT WINAPI AudioSessionControl_GetGroupingParam( - IAudioSessionControl2 *iface, GUID *group) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%p) - stub\n", This, group); - - return E_NOTIMPL; -} - -static HRESULT WINAPI AudioSessionControl_SetGroupingParam( - IAudioSessionControl2 *iface, const GUID *group, const GUID *session) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%s, %s) - stub\n", This, debugstr_guid(group), - debugstr_guid(session)); - - return E_NOTIMPL; -} - -static HRESULT WINAPI AudioSessionControl_RegisterAudioSessionNotification( - IAudioSessionControl2 *iface, IAudioSessionEvents *events) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%p) - stub\n", This, events); - - return S_OK; -} - -static HRESULT WINAPI AudioSessionControl_UnregisterAudioSessionNotification( - IAudioSessionControl2 *iface, IAudioSessionEvents *events) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%p) - stub\n", This, events); - - return S_OK; -} - -static HRESULT WINAPI AudioSessionControl_GetSessionIdentifier( - IAudioSessionControl2 *iface, WCHAR **id) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%p) - stub\n", This, id); - - return E_NOTIMPL; -} - -static HRESULT WINAPI AudioSessionControl_GetSessionInstanceIdentifier( - IAudioSessionControl2 *iface, WCHAR **id) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%p) - stub\n", This, id); - - return E_NOTIMPL; -} - -static HRESULT WINAPI AudioSessionControl_GetProcessId( - IAudioSessionControl2 *iface, DWORD *pid) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - TRACE("(%p)->(%p)\n", This, pid); - - if(!pid) - return E_POINTER; - - *pid = GetCurrentProcessId(); - - return S_OK; -} - -static HRESULT WINAPI AudioSessionControl_IsSystemSoundsSession( - IAudioSessionControl2 *iface) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - TRACE("(%p)\n", This); - - return S_FALSE; -} - -static HRESULT WINAPI AudioSessionControl_SetDuckingPreference( - IAudioSessionControl2 *iface, BOOL optout) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - TRACE("(%p)->(%d)\n", This, optout); - - return S_OK; -} - -static const IAudioSessionControl2Vtbl AudioSessionControl2_Vtbl = -{ - AudioSessionControl_QueryInterface, - AudioSessionControl_AddRef, - AudioSessionControl_Release, - AudioSessionControl_GetState, - AudioSessionControl_GetDisplayName, - AudioSessionControl_SetDisplayName, - AudioSessionControl_GetIconPath, - AudioSessionControl_SetIconPath, - AudioSessionControl_GetGroupingParam, - AudioSessionControl_SetGroupingParam, - AudioSessionControl_RegisterAudioSessionNotification, - AudioSessionControl_UnregisterAudioSessionNotification, - AudioSessionControl_GetSessionIdentifier, - AudioSessionControl_GetSessionInstanceIdentifier, - AudioSessionControl_GetProcessId, - AudioSessionControl_IsSystemSoundsSession, - AudioSessionControl_SetDuckingPreference -}; - static HRESULT WINAPI SimpleAudioVolume_QueryInterface( ISimpleAudioVolume *iface, REFIID riid, void **ppv) {
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/wineoss.drv/Makefile.in | 4 +- dlls/wineoss.drv/mmdevdrv.c | 254 +---------------------------------- 2 files changed, 6 insertions(+), 252 deletions(-)
diff --git a/dlls/wineoss.drv/Makefile.in b/dlls/wineoss.drv/Makefile.in index a1771e14e2a..a6e56f3065c 100644 --- a/dlls/wineoss.drv/Makefile.in +++ b/dlls/wineoss.drv/Makefile.in @@ -1,6 +1,7 @@ MODULE = wineoss.drv UNIXLIB = wineoss.so IMPORTS = uuid ole32 user32 advapi32 +PARENTSRC = ../mmdevapi DELAYIMPORTS = winmm UNIX_LIBS = $(OSS4_LIBS) $(PTHREAD_LIBS) UNIX_CFLAGS = $(OSS4_CFLAGS) @@ -11,4 +12,5 @@ C_SRCS = \ mmaux.c \ mmdevdrv.c \ oss.c \ - ossmidi.c + ossmidi.c \ + session.c diff --git a/dlls/wineoss.drv/mmdevdrv.c b/dlls/wineoss.drv/mmdevdrv.c index 5a27f9e09bf..e30787dc7c1 100644 --- a/dlls/wineoss.drv/mmdevdrv.c +++ b/dlls/wineoss.drv/mmdevdrv.c @@ -80,19 +80,19 @@ static AudioSessionWrapper *AudioSessionWrapper_Create(ACImpl *client); static const IAudioClient3Vtbl AudioClient3_Vtbl; static const IAudioRenderClientVtbl AudioRenderClient_Vtbl; static const IAudioCaptureClientVtbl AudioCaptureClient_Vtbl; -static const IAudioSessionControl2Vtbl AudioSessionControl2_Vtbl; +extern const IAudioSessionControl2Vtbl AudioSessionControl2_Vtbl; static const ISimpleAudioVolumeVtbl SimpleAudioVolume_Vtbl; static const IAudioClockVtbl AudioClock_Vtbl; static const IAudioClock2Vtbl AudioClock2_Vtbl; static const IAudioStreamVolumeVtbl AudioStreamVolume_Vtbl; static const IChannelAudioVolumeVtbl ChannelAudioVolume_Vtbl;
-static void sessions_lock(void) +void DECLSPEC_HIDDEN sessions_lock(void) { EnterCriticalSection(&g_sessions_lock); }
-static void sessions_unlock(void) +void DECLSPEC_HIDDEN sessions_unlock(void) { LeaveCriticalSection(&g_sessions_lock); } @@ -112,11 +112,6 @@ static inline ACImpl *impl_from_IAudioCaptureClient(IAudioCaptureClient *iface) return CONTAINING_RECORD(iface, ACImpl, IAudioCaptureClient_iface); }
-static inline AudioSessionWrapper *impl_from_IAudioSessionControl2(IAudioSessionControl2 *iface) -{ - return CONTAINING_RECORD(iface, AudioSessionWrapper, IAudioSessionControl2_iface); -} - static inline AudioSessionWrapper *impl_from_ISimpleAudioVolume(ISimpleAudioVolume *iface) { return CONTAINING_RECORD(iface, AudioSessionWrapper, ISimpleAudioVolume_iface); @@ -1465,249 +1460,6 @@ static AudioSessionWrapper *AudioSessionWrapper_Create(ACImpl *client) return ret; }
-static HRESULT WINAPI AudioSessionControl_QueryInterface( - IAudioSessionControl2 *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_IAudioSessionControl) || - IsEqualIID(riid, &IID_IAudioSessionControl2)) - *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 AudioSessionControl_AddRef(IAudioSessionControl2 *iface) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - ULONG ref; - ref = InterlockedIncrement(&This->ref); - TRACE("(%p) Refcount now %lu\n", This, ref); - return ref; -} - -static ULONG WINAPI AudioSessionControl_Release(IAudioSessionControl2 *iface) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - ULONG ref; - ref = InterlockedDecrement(&This->ref); - TRACE("(%p) Refcount now %lu\n", This, ref); - if(!ref){ - if(This->client){ - sessions_lock(); - This->client->session_wrapper = NULL; - sessions_unlock(); - IAudioClient3_Release(&This->client->IAudioClient3_iface); - } - HeapFree(GetProcessHeap(), 0, This); - } - return ref; -} - -static HRESULT WINAPI AudioSessionControl_GetState(IAudioSessionControl2 *iface, - AudioSessionState *state) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - struct is_started_params params; - ACImpl *client; - - TRACE("(%p)->(%p)\n", This, state); - - if(!state) - return NULL_PTR_ERR; - - sessions_lock(); - - if(list_empty(&This->session->clients)){ - *state = AudioSessionStateExpired; - sessions_unlock(); - return S_OK; - } - - LIST_FOR_EACH_ENTRY(client, &This->session->clients, ACImpl, entry){ - params.stream = client->stream; - OSS_CALL(is_started, ¶ms); - if(params.result == S_OK){ - *state = AudioSessionStateActive; - sessions_unlock(); - return S_OK; - } - } - - sessions_unlock(); - - *state = AudioSessionStateInactive; - - return S_OK; -} - -static HRESULT WINAPI AudioSessionControl_GetDisplayName( - IAudioSessionControl2 *iface, WCHAR **name) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%p) - stub\n", This, name); - - return E_NOTIMPL; -} - -static HRESULT WINAPI AudioSessionControl_SetDisplayName( - IAudioSessionControl2 *iface, const WCHAR *name, const GUID *session) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%p, %s) - stub\n", This, name, debugstr_guid(session)); - - return E_NOTIMPL; -} - -static HRESULT WINAPI AudioSessionControl_GetIconPath( - IAudioSessionControl2 *iface, WCHAR **path) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%p) - stub\n", This, path); - - return E_NOTIMPL; -} - -static HRESULT WINAPI AudioSessionControl_SetIconPath( - IAudioSessionControl2 *iface, const WCHAR *path, const GUID *session) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%p, %s) - stub\n", This, path, debugstr_guid(session)); - - return E_NOTIMPL; -} - -static HRESULT WINAPI AudioSessionControl_GetGroupingParam( - IAudioSessionControl2 *iface, GUID *group) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%p) - stub\n", This, group); - - return E_NOTIMPL; -} - -static HRESULT WINAPI AudioSessionControl_SetGroupingParam( - IAudioSessionControl2 *iface, const GUID *group, const GUID *session) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%s, %s) - stub\n", This, debugstr_guid(group), - debugstr_guid(session)); - - return E_NOTIMPL; -} - -static HRESULT WINAPI AudioSessionControl_RegisterAudioSessionNotification( - IAudioSessionControl2 *iface, IAudioSessionEvents *events) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%p) - stub\n", This, events); - - return S_OK; -} - -static HRESULT WINAPI AudioSessionControl_UnregisterAudioSessionNotification( - IAudioSessionControl2 *iface, IAudioSessionEvents *events) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%p) - stub\n", This, events); - - return S_OK; -} - -static HRESULT WINAPI AudioSessionControl_GetSessionIdentifier( - IAudioSessionControl2 *iface, WCHAR **id) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%p) - stub\n", This, id); - - return E_NOTIMPL; -} - -static HRESULT WINAPI AudioSessionControl_GetSessionInstanceIdentifier( - IAudioSessionControl2 *iface, WCHAR **id) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%p) - stub\n", This, id); - - return E_NOTIMPL; -} - -static HRESULT WINAPI AudioSessionControl_GetProcessId( - IAudioSessionControl2 *iface, DWORD *pid) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - TRACE("(%p)->(%p)\n", This, pid); - - if(!pid) - return E_POINTER; - - *pid = GetCurrentProcessId(); - - return S_OK; -} - -static HRESULT WINAPI AudioSessionControl_IsSystemSoundsSession( - IAudioSessionControl2 *iface) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - TRACE("(%p)\n", This); - - return S_FALSE; -} - -static HRESULT WINAPI AudioSessionControl_SetDuckingPreference( - IAudioSessionControl2 *iface, BOOL optout) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - TRACE("(%p)->(%d)\n", This, optout); - - return S_OK; -} - -static const IAudioSessionControl2Vtbl AudioSessionControl2_Vtbl = -{ - AudioSessionControl_QueryInterface, - AudioSessionControl_AddRef, - AudioSessionControl_Release, - AudioSessionControl_GetState, - AudioSessionControl_GetDisplayName, - AudioSessionControl_SetDisplayName, - AudioSessionControl_GetIconPath, - AudioSessionControl_SetIconPath, - AudioSessionControl_GetGroupingParam, - AudioSessionControl_SetGroupingParam, - AudioSessionControl_RegisterAudioSessionNotification, - AudioSessionControl_UnregisterAudioSessionNotification, - AudioSessionControl_GetSessionIdentifier, - AudioSessionControl_GetSessionInstanceIdentifier, - AudioSessionControl_GetProcessId, - AudioSessionControl_IsSystemSoundsSession, - AudioSessionControl_SetDuckingPreference -}; - static HRESULT WINAPI SimpleAudioVolume_QueryInterface( ISimpleAudioVolume *iface, REFIID riid, void **ppv) {
From: Davide Beatrici git@davidebeatrici.dev
--- dlls/winepulse.drv/Makefile.in | 4 +- dlls/winepulse.drv/mmdevdrv.c | 251 +-------------------------------- 2 files changed, 6 insertions(+), 249 deletions(-)
diff --git a/dlls/winepulse.drv/Makefile.in b/dlls/winepulse.drv/Makefile.in index 7a78f4e854e..8a6d6f1ae91 100644 --- a/dlls/winepulse.drv/Makefile.in +++ b/dlls/winepulse.drv/Makefile.in @@ -1,9 +1,11 @@ MODULE = winepulse.drv UNIXLIB = winepulse.so IMPORTS = dxguid uuid winmm user32 advapi32 ole32 version +PARENTSRC = ../mmdevapi UNIX_LIBS = $(PULSE_LIBS) $(PTHREAD_LIBS) -lm UNIX_CFLAGS = $(PULSE_CFLAGS)
C_SRCS = \ mmdevdrv.c \ - pulse.c + pulse.c \ + session.c diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c index 920d7a964eb..5f2a8b8609d 100644 --- a/dlls/winepulse.drv/mmdevdrv.c +++ b/dlls/winepulse.drv/mmdevdrv.c @@ -83,12 +83,12 @@ static CRITICAL_SECTION_DEBUG session_cs_debug = { }; static CRITICAL_SECTION session_cs = { &session_cs_debug, -1, 0, 0, 0, 0 };
-static void sessions_lock(void) +void DECLSPEC_HIDDEN sessions_lock(void) { EnterCriticalSection(&session_cs); }
-static void sessions_unlock(void) +void DECLSPEC_HIDDEN sessions_unlock(void) { LeaveCriticalSection(&session_cs); } @@ -127,7 +127,7 @@ BOOL WINAPI DllMain(HINSTANCE dll, DWORD reason, void *reserved) static const IAudioClient3Vtbl AudioClient3_Vtbl; static const IAudioRenderClientVtbl AudioRenderClient_Vtbl; static const IAudioCaptureClientVtbl AudioCaptureClient_Vtbl; -static const IAudioSessionControl2Vtbl AudioSessionControl2_Vtbl; +extern const IAudioSessionControl2Vtbl AudioSessionControl2_Vtbl; static const ISimpleAudioVolumeVtbl SimpleAudioVolume_Vtbl; static const IChannelAudioVolumeVtbl ChannelAudioVolume_Vtbl; static const IAudioClockVtbl AudioClock_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_IAudioSessionControl2(IAudioSessionControl2 *iface) -{ - return CONTAINING_RECORD(iface, AudioSessionWrapper, IAudioSessionControl2_iface); -} - static inline AudioSessionWrapper *impl_from_ISimpleAudioVolume(ISimpleAudioVolume *iface) { return CONTAINING_RECORD(iface, AudioSessionWrapper, ISimpleAudioVolume_iface); @@ -1892,246 +1887,6 @@ static AudioSessionWrapper *AudioSessionWrapper_Create(ACImpl *client) return ret; }
-static HRESULT WINAPI AudioSessionControl_QueryInterface( - IAudioSessionControl2 *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_IAudioSessionControl) || - IsEqualIID(riid, &IID_IAudioSessionControl2)) - *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 AudioSessionControl_AddRef(IAudioSessionControl2 *iface) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - ULONG ref; - ref = InterlockedIncrement(&This->ref); - TRACE("(%p) Refcount now %lu\n", This, ref); - return ref; -} - -static ULONG WINAPI AudioSessionControl_Release(IAudioSessionControl2 *iface) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - ULONG ref; - ref = InterlockedDecrement(&This->ref); - TRACE("(%p) Refcount now %lu\n", This, ref); - if (!ref) { - if (This->client) { - This->client->session_wrapper = NULL; - IAudioClient3_Release(&This->client->IAudioClient3_iface); - } - HeapFree(GetProcessHeap(), 0, This); - } - return ref; -} - -static HRESULT WINAPI AudioSessionControl_GetState(IAudioSessionControl2 *iface, - AudioSessionState *state) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - ACImpl *client; - - TRACE("(%p)->(%p)\n", This, state); - - if (!state) - return NULL_PTR_ERR; - - sessions_lock(); - if (list_empty(&This->session->clients)) { - *state = AudioSessionStateExpired; - goto out; - } - LIST_FOR_EACH_ENTRY(client, &This->session->clients, ACImpl, entry) { - struct is_started_params params; - - if (!client->stream) - continue; - - params.stream = client->stream; - pulse_call(is_started, ¶ms); - if (params.result == S_OK) { - *state = AudioSessionStateActive; - goto out; - } - } - *state = AudioSessionStateInactive; - -out: - sessions_unlock(); - return S_OK; -} - -static HRESULT WINAPI AudioSessionControl_GetDisplayName( - IAudioSessionControl2 *iface, WCHAR **name) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%p) - stub\n", This, name); - - return E_NOTIMPL; -} - -static HRESULT WINAPI AudioSessionControl_SetDisplayName( - IAudioSessionControl2 *iface, const WCHAR *name, const GUID *session) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%p, %s) - stub\n", This, name, debugstr_guid(session)); - - return E_NOTIMPL; -} - -static HRESULT WINAPI AudioSessionControl_GetIconPath( - IAudioSessionControl2 *iface, WCHAR **path) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%p) - stub\n", This, path); - - return E_NOTIMPL; -} - -static HRESULT WINAPI AudioSessionControl_SetIconPath( - IAudioSessionControl2 *iface, const WCHAR *path, const GUID *session) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%p, %s) - stub\n", This, path, debugstr_guid(session)); - - return E_NOTIMPL; -} - -static HRESULT WINAPI AudioSessionControl_GetGroupingParam( - IAudioSessionControl2 *iface, GUID *group) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%p) - stub\n", This, group); - - return E_NOTIMPL; -} - -static HRESULT WINAPI AudioSessionControl_SetGroupingParam( - IAudioSessionControl2 *iface, const GUID *group, const GUID *session) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%s, %s) - stub\n", This, debugstr_guid(group), - debugstr_guid(session)); - - return E_NOTIMPL; -} - -static HRESULT WINAPI AudioSessionControl_RegisterAudioSessionNotification( - IAudioSessionControl2 *iface, IAudioSessionEvents *events) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%p) - stub\n", This, events); - - return S_OK; -} - -static HRESULT WINAPI AudioSessionControl_UnregisterAudioSessionNotification( - IAudioSessionControl2 *iface, IAudioSessionEvents *events) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%p) - stub\n", This, events); - - return S_OK; -} - -static HRESULT WINAPI AudioSessionControl_GetSessionIdentifier( - IAudioSessionControl2 *iface, WCHAR **id) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%p) - stub\n", This, id); - - return E_NOTIMPL; -} - -static HRESULT WINAPI AudioSessionControl_GetSessionInstanceIdentifier( - IAudioSessionControl2 *iface, WCHAR **id) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - FIXME("(%p)->(%p) - stub\n", This, id); - - return E_NOTIMPL; -} - -static HRESULT WINAPI AudioSessionControl_GetProcessId( - IAudioSessionControl2 *iface, DWORD *pid) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - TRACE("(%p)->(%p)\n", This, pid); - - if (!pid) - return E_POINTER; - - *pid = GetCurrentProcessId(); - - return S_OK; -} - -static HRESULT WINAPI AudioSessionControl_IsSystemSoundsSession( - IAudioSessionControl2 *iface) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - TRACE("(%p)\n", This); - - return S_FALSE; -} - -static HRESULT WINAPI AudioSessionControl_SetDuckingPreference( - IAudioSessionControl2 *iface, BOOL optout) -{ - AudioSessionWrapper *This = impl_from_IAudioSessionControl2(iface); - - TRACE("(%p)->(%d)\n", This, optout); - - return S_OK; -} - -static const IAudioSessionControl2Vtbl AudioSessionControl2_Vtbl = -{ - AudioSessionControl_QueryInterface, - AudioSessionControl_AddRef, - AudioSessionControl_Release, - AudioSessionControl_GetState, - AudioSessionControl_GetDisplayName, - AudioSessionControl_SetDisplayName, - AudioSessionControl_GetIconPath, - AudioSessionControl_SetIconPath, - AudioSessionControl_GetGroupingParam, - AudioSessionControl_SetGroupingParam, - AudioSessionControl_RegisterAudioSessionNotification, - AudioSessionControl_UnregisterAudioSessionNotification, - AudioSessionControl_GetSessionIdentifier, - AudioSessionControl_GetSessionInstanceIdentifier, - AudioSessionControl_GetProcessId, - AudioSessionControl_IsSystemSoundsSession, - AudioSessionControl_SetDuckingPreference -}; - static HRESULT WINAPI SimpleAudioVolume_QueryInterface( ISimpleAudioVolume *iface, REFIID riid, void **ppv) {
On Thu Apr 27 22:46:50 2023 +0000, **** wrote:
Marvin replied on the mailing list:
Hi, It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated. The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=132260 Your paranoid android. === debian11 (build log) === makedep: error: open audiosession.c : No such file or directory config.status: error: could not create Makefile Task: The win32 Wine build failed === debian11b (build log) === makedep: error: open audiosession.c : No such file or directory config.status: error: could not create Makefile Task: The wow64 Wine build failed
I finally appended `--delete` to my `rsync` command. For context, I'm currently using a slightly modified version of https://github.com/Kron4ek/Wine-Builds in order to test the WoW64 functionality on a mostly pure 64 bit system.
@huw Can a WoW64 build be achieved with only 64 bit dependencies right now?
On Thu Apr 27 23:45:49 2023 +0000, Davide Beatrici wrote:
I finally appended `--delete` to my `rsync` command. For context, I'm currently using a slightly modified version of https://github.com/Kron4ek/Wine-Builds in order to test the WoW64 functionality on a mostly pure 64 bit system. @huw Can a WoW64 build be achieved with only 64 bit dependencies right now?
You won't get graphics, but yes configuring with `--enable-archs=i386,x86_64` will get you the new wow64 build that should be able to run the sound tests for example.
On Fri Apr 28 06:18:58 2023 +0000, Huw Davies wrote:
You won't get graphics, but yes configuring with `--enable-archs=i386,x86_64` will get you the new wow64 build that should be able to run the sound tests for example.
Good enough!
This merge request was approved by Huw Davies.
Alright, in that case what about creating a separate merge request to drop the prefix from `audiovolume.c` as well? The name should probably be `endpoint.c`, considering it strictly manages the device itself and not the clients/streams' volume (which is handled in their own interfaces).
Gratuitous patches changing names of files are generally discouraged; besides let's concentrate on the main aim here.
On Fri Apr 28 06:28:36 2023 +0000, Huw Davies wrote:
Alright, in that case what about creating a separate merge request to
drop the prefix from `audiovolume.c` as well? The name should probably be `endpoint.c`, considering it strictly manages the device itself and not the clients/streams' volume (which is handled in their own interfaces). Gratuitous patches changing names of files are generally discouraged; besides let's concentrate on the main aim here.
Right.