Commit 10987172 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

winealsa: Use the stream ptr to indicate the init state.

parent 1ad8978f
...@@ -109,8 +109,6 @@ struct ACImpl { ...@@ -109,8 +109,6 @@ struct ACImpl {
UINT32 channel_count; UINT32 channel_count;
struct alsa_stream *stream; struct alsa_stream *stream;
BOOL initted;
HANDLE timer; HANDLE timer;
CRITICAL_SECTION lock; CRITICAL_SECTION lock;
...@@ -578,7 +576,7 @@ static ULONG WINAPI AudioClient_Release(IAudioClient3 *iface) ...@@ -578,7 +576,7 @@ static ULONG WINAPI AudioClient_Release(IAudioClient3 *iface)
IUnknown_Release(This->pUnkFTMarshal); IUnknown_Release(This->pUnkFTMarshal);
This->lock.DebugInfo->Spare[0] = 0; This->lock.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&This->lock); DeleteCriticalSection(&This->lock);
if(This->initted){ if(This->session){
EnterCriticalSection(&g_sessions_lock); EnterCriticalSection(&g_sessions_lock);
list_remove(&This->entry); list_remove(&This->entry);
LeaveCriticalSection(&g_sessions_lock); LeaveCriticalSection(&g_sessions_lock);
...@@ -969,7 +967,7 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface, ...@@ -969,7 +967,7 @@ static HRESULT WINAPI AudioClient_Initialize(IAudioClient3 *iface,
EnterCriticalSection(&g_sessions_lock); EnterCriticalSection(&g_sessions_lock);
EnterCriticalSection(&This->lock); EnterCriticalSection(&This->lock);
if(This->initted){ if(This->stream){
LeaveCriticalSection(&This->lock); LeaveCriticalSection(&This->lock);
LeaveCriticalSection(&g_sessions_lock); LeaveCriticalSection(&g_sessions_lock);
return AUDCLNT_E_ALREADY_INITIALIZED; return AUDCLNT_E_ALREADY_INITIALIZED;
...@@ -1201,7 +1199,6 @@ exit: ...@@ -1201,7 +1199,6 @@ exit:
This->vols = NULL; This->vols = NULL;
}else{ }else{
This->stream = stream; This->stream = stream;
This->initted = TRUE;
} }
LeaveCriticalSection(&This->lock); LeaveCriticalSection(&This->lock);
...@@ -1223,7 +1220,7 @@ static HRESULT WINAPI AudioClient_GetBufferSize(IAudioClient3 *iface, ...@@ -1223,7 +1220,7 @@ static HRESULT WINAPI AudioClient_GetBufferSize(IAudioClient3 *iface,
EnterCriticalSection(&This->lock); EnterCriticalSection(&This->lock);
if(!This->initted){ if(!This->stream){
LeaveCriticalSection(&This->lock); LeaveCriticalSection(&This->lock);
return AUDCLNT_E_NOT_INITIALIZED; return AUDCLNT_E_NOT_INITIALIZED;
} }
...@@ -1248,7 +1245,7 @@ static HRESULT WINAPI AudioClient_GetStreamLatency(IAudioClient3 *iface, ...@@ -1248,7 +1245,7 @@ static HRESULT WINAPI AudioClient_GetStreamLatency(IAudioClient3 *iface,
EnterCriticalSection(&This->lock); EnterCriticalSection(&This->lock);
if(!This->initted){ if(!This->stream){
LeaveCriticalSection(&This->lock); LeaveCriticalSection(&This->lock);
return AUDCLNT_E_NOT_INITIALIZED; return AUDCLNT_E_NOT_INITIALIZED;
} }
...@@ -1282,7 +1279,7 @@ static HRESULT WINAPI AudioClient_GetCurrentPadding(IAudioClient3 *iface, ...@@ -1282,7 +1279,7 @@ static HRESULT WINAPI AudioClient_GetCurrentPadding(IAudioClient3 *iface,
EnterCriticalSection(&This->lock); EnterCriticalSection(&This->lock);
if(!This->initted){ if(!This->stream){
LeaveCriticalSection(&This->lock); LeaveCriticalSection(&This->lock);
return AUDCLNT_E_NOT_INITIALIZED; return AUDCLNT_E_NOT_INITIALIZED;
} }
...@@ -1873,7 +1870,7 @@ static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface) ...@@ -1873,7 +1870,7 @@ static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface)
EnterCriticalSection(&This->lock); EnterCriticalSection(&This->lock);
if(!This->initted){ if(!This->stream){
LeaveCriticalSection(&This->lock); LeaveCriticalSection(&This->lock);
return AUDCLNT_E_NOT_INITIALIZED; return AUDCLNT_E_NOT_INITIALIZED;
} }
...@@ -1942,7 +1939,7 @@ static HRESULT WINAPI AudioClient_Stop(IAudioClient3 *iface) ...@@ -1942,7 +1939,7 @@ static HRESULT WINAPI AudioClient_Stop(IAudioClient3 *iface)
EnterCriticalSection(&This->lock); EnterCriticalSection(&This->lock);
if(!This->initted){ if(!This->stream){
LeaveCriticalSection(&This->lock); LeaveCriticalSection(&This->lock);
return AUDCLNT_E_NOT_INITIALIZED; return AUDCLNT_E_NOT_INITIALIZED;
} }
...@@ -1971,7 +1968,7 @@ static HRESULT WINAPI AudioClient_Reset(IAudioClient3 *iface) ...@@ -1971,7 +1968,7 @@ static HRESULT WINAPI AudioClient_Reset(IAudioClient3 *iface)
EnterCriticalSection(&This->lock); EnterCriticalSection(&This->lock);
if(!This->initted){ if(!This->stream){
LeaveCriticalSection(&This->lock); LeaveCriticalSection(&This->lock);
return AUDCLNT_E_NOT_INITIALIZED; return AUDCLNT_E_NOT_INITIALIZED;
} }
...@@ -2023,7 +2020,7 @@ static HRESULT WINAPI AudioClient_SetEventHandle(IAudioClient3 *iface, ...@@ -2023,7 +2020,7 @@ static HRESULT WINAPI AudioClient_SetEventHandle(IAudioClient3 *iface,
EnterCriticalSection(&This->lock); EnterCriticalSection(&This->lock);
if(!This->initted){ if(!This->stream){
LeaveCriticalSection(&This->lock); LeaveCriticalSection(&This->lock);
return AUDCLNT_E_NOT_INITIALIZED; return AUDCLNT_E_NOT_INITIALIZED;
} }
...@@ -2059,7 +2056,7 @@ static HRESULT WINAPI AudioClient_GetService(IAudioClient3 *iface, REFIID riid, ...@@ -2059,7 +2056,7 @@ static HRESULT WINAPI AudioClient_GetService(IAudioClient3 *iface, REFIID riid,
EnterCriticalSection(&This->lock); EnterCriticalSection(&This->lock);
if(!This->initted){ if(!This->stream){
LeaveCriticalSection(&This->lock); LeaveCriticalSection(&This->lock);
return AUDCLNT_E_NOT_INITIALIZED; return AUDCLNT_E_NOT_INITIALIZED;
} }
......
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