winealsa: Move reset to the unixlib.
Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Andrew Eikum <aeikum@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
667241753e
commit
f3bd61add4
|
@ -1514,6 +1514,41 @@ static NTSTATUS stop(void *args)
|
|||
return alsa_unlock_result(stream, ¶ms->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, ¶ms->result, AUDCLNT_E_NOT_STOPPED);
|
||||
|
||||
if(stream->getbuf_last)
|
||||
return alsa_unlock_result(stream, ¶ms->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, ¶ms->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);
|
||||
params.stream = This->stream;
|
||||
|
||||
if(stream->started){
|
||||
alsa_unlock(stream);
|
||||
return AUDCLNT_E_NOT_STOPPED;
|
||||
}
|
||||
ALSA_CALL(reset, ¶ms);
|
||||
|
||||
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;
|
||||
|
||||
alsa_unlock(stream);
|
||||
|
||||
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,
|
||||
|
|
Loading…
Reference in New Issue