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

winealsa: Move reset to the unixlib.

parent 66724175
......@@ -1514,6 +1514,41 @@ static NTSTATUS stop(void *args)
return alsa_unlock_result(stream, &params->result, S_OK);
}
static NTSTATUS reset(void *args)
{
struct reset_params *params = args;
struct alsa_stream *stream = params->stream;
alsa_lock(stream);
if(stream->started)
return alsa_unlock_result(stream, &params->result, AUDCLNT_E_NOT_STOPPED);
if(stream->getbuf_last)
return alsa_unlock_result(stream, &params->result, AUDCLNT_E_BUFFER_OPERATION_PENDING);
if(snd_pcm_drop(stream->pcm_handle) < 0)
WARN("snd_pcm_drop failed\n");
if(snd_pcm_reset(stream->pcm_handle) < 0)
WARN("snd_pcm_reset failed\n");
if(snd_pcm_prepare(stream->pcm_handle) < 0)
WARN("snd_pcm_prepare failed\n");
if(stream->flow == eRender){
stream->written_frames = 0;
stream->last_pos_frames = 0;
}else{
stream->written_frames += stream->held_frames;
}
stream->held_frames = 0;
stream->lcl_offs_frames = 0;
stream->wri_offs_frames = 0;
return alsa_unlock_result(stream, &params->result, S_OK);
}
static NTSTATUS timer_loop(void *args)
{
struct timer_loop_params *params = args;
......@@ -1861,6 +1896,7 @@ unixlib_entry_t __wine_unix_call_funcs[] =
release_stream,
start,
stop,
reset,
timer_loop,
is_format_supported,
get_mix_format,
......
......@@ -1020,47 +1020,18 @@ static HRESULT WINAPI AudioClient_Stop(IAudioClient3 *iface)
static HRESULT WINAPI AudioClient_Reset(IAudioClient3 *iface)
{
ACImpl *This = impl_from_IAudioClient3(iface);
struct alsa_stream *stream = This->stream;
struct reset_params params;
TRACE("(%p)\n", This);
if(!This->stream)
return AUDCLNT_E_NOT_INITIALIZED;
alsa_lock(stream);
if(stream->started){
alsa_unlock(stream);
return AUDCLNT_E_NOT_STOPPED;
}
if(stream->getbuf_last){
alsa_unlock(stream);
return AUDCLNT_E_BUFFER_OPERATION_PENDING;
}
if(snd_pcm_drop(stream->pcm_handle) < 0)
WARN("snd_pcm_drop failed\n");
if(snd_pcm_reset(stream->pcm_handle) < 0)
WARN("snd_pcm_reset failed\n");
if(snd_pcm_prepare(stream->pcm_handle) < 0)
WARN("snd_pcm_prepare failed\n");
if(stream->flow == eRender){
stream->written_frames = 0;
stream->last_pos_frames = 0;
}else{
stream->written_frames += stream->held_frames;
}
stream->held_frames = 0;
stream->lcl_offs_frames = 0;
stream->wri_offs_frames = 0;
params.stream = This->stream;
alsa_unlock(stream);
ALSA_CALL(reset, &params);
return S_OK;
return params.result;
}
static HRESULT WINAPI AudioClient_SetEventHandle(IAudioClient3 *iface,
......
......@@ -103,6 +103,12 @@ struct stop_params
HRESULT result;
};
struct reset_params
{
struct alsa_stream *stream;
HRESULT result;
};
struct timer_loop_params
{
struct alsa_stream *stream;
......@@ -154,6 +160,7 @@ enum alsa_funcs
alsa_release_stream,
alsa_start,
alsa_stop,
alsa_reset,
alsa_timer_loop,
alsa_is_format_supported,
alsa_get_mix_format,
......
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