Commit 066ac0a8 authored by Davide Beatrici's avatar Davide Beatrici Committed by Alexandre Julliard

winealsa: Move create_session into mmdevapi.

parent 75276f01
...@@ -61,7 +61,7 @@ static CRITICAL_SECTION_DEBUG g_sessions_lock_debug = ...@@ -61,7 +61,7 @@ static CRITICAL_SECTION_DEBUG g_sessions_lock_debug =
0, 0, { (DWORD_PTR)(__FILE__ ": g_sessions_lock") } 0, 0, { (DWORD_PTR)(__FILE__ ": g_sessions_lock") }
}; };
static CRITICAL_SECTION g_sessions_lock = { &g_sessions_lock_debug, -1, 0, 0, 0, 0 }; static CRITICAL_SECTION g_sessions_lock = { &g_sessions_lock_debug, -1, 0, 0, 0, 0 };
static struct list g_sessions = LIST_INIT(g_sessions); extern struct list sessions;
static WCHAR drv_key_devicesW[256]; static WCHAR drv_key_devicesW[256];
static const WCHAR guidW[] = {'g','u','i','d',0}; static const WCHAR guidW[] = {'g','u','i','d',0};
...@@ -377,29 +377,8 @@ HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, IAudioClient ...@@ -377,29 +377,8 @@ HRESULT WINAPI AUDDRV_GetAudioEndpoint(GUID *guid, IMMDevice *dev, IAudioClient
extern void session_init_vols(AudioSession *session, UINT channels); extern void session_init_vols(AudioSession *session, UINT channels);
static AudioSession *create_session(const GUID *guid, IMMDevice *device, extern AudioSession *session_create(const GUID *guid, IMMDevice *device,
UINT num_channels) UINT num_channels);
{
AudioSession *ret;
ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(AudioSession));
if(!ret)
return NULL;
memcpy(&ret->guid, guid, sizeof(GUID));
ret->device = device;
list_init(&ret->clients);
list_add_head(&g_sessions, &ret->entry);
session_init_vols(ret, num_channels);
ret->master_vol = 1.f;
return ret;
}
/* if channels == 0, then this will return or create a session with /* if channels == 0, then this will return or create a session with
* matching dataflow and GUID. otherwise, channels must also match */ * matching dataflow and GUID. otherwise, channels must also match */
...@@ -409,7 +388,7 @@ HRESULT get_audio_session(const GUID *sessionguid, ...@@ -409,7 +388,7 @@ HRESULT get_audio_session(const GUID *sessionguid,
AudioSession *session; AudioSession *session;
if(!sessionguid || IsEqualGUID(sessionguid, &GUID_NULL)){ if(!sessionguid || IsEqualGUID(sessionguid, &GUID_NULL)){
*out = create_session(&GUID_NULL, device, channels); *out = session_create(&GUID_NULL, device, channels);
if(!*out) if(!*out)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -417,7 +396,7 @@ HRESULT get_audio_session(const GUID *sessionguid, ...@@ -417,7 +396,7 @@ HRESULT get_audio_session(const GUID *sessionguid,
} }
*out = NULL; *out = NULL;
LIST_FOR_EACH_ENTRY(session, &g_sessions, AudioSession, entry){ LIST_FOR_EACH_ENTRY(session, &sessions, AudioSession, entry){
if(session->device == device && if(session->device == device &&
IsEqualGUID(sessionguid, &session->guid)){ IsEqualGUID(sessionguid, &session->guid)){
session_init_vols(session, channels); session_init_vols(session, channels);
...@@ -427,7 +406,7 @@ HRESULT get_audio_session(const GUID *sessionguid, ...@@ -427,7 +406,7 @@ HRESULT get_audio_session(const GUID *sessionguid,
} }
if(!*out){ if(!*out){
*out = create_session(sessionguid, device, channels); *out = session_create(sessionguid, device, channels);
if(!*out) if(!*out)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
......
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