Mercurial > audlegacy-plugins
changeset 3165:087abc78516e
alsa-ng: implement pause stuff. not perfect yet.
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Thu, 14 May 2009 23:14:50 -0500 |
parents | adec82db531c |
children | 8cbf077ba5d0 |
files | src/alsa-ng/alsa-core.c |
diffstat | 1 files changed, 17 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/alsa-ng/alsa-core.c Thu May 14 22:24:34 2009 -0500 +++ b/src/alsa-ng/alsa-core.c Thu May 14 23:14:50 2009 -0500 @@ -29,7 +29,8 @@ static gsize wr_total = 0; static gsize wr_hwframes = 0; -static gint flush_request; +static gint flush_request, pause_request, paused; +static gboolean can_pause; /******************************************************************************** * ALSA Mixer setting functions. * @@ -81,6 +82,13 @@ flush_request = -1; } + if (pause_request != paused) + { + snd_pcm_pause(pcm_handle, pause_request); + paused = pause_request; + continue; + } + if (alsaplug_ringbuffer_read(&pcm_ringbuf, buf, 2048) == -1) { /* less than 2048 bytes to go...? */ @@ -149,6 +157,7 @@ return -1; } + can_pause = snd_pcm_hw_params_can_pause(hwparams); bitwidth = snd_pcm_format_physical_width(afmt); bps = (rate * bitwidth * nch) >> 3; ringbuf_size = aud_cfg->output_buffer_size * bps / 1000; @@ -233,6 +242,12 @@ return alsaplug_ringbuffer_used(&pcm_ringbuf) != 0; } +static void +alsaplug_pause(short p) +{ + pause_request = p; +} + /******************************************************************************** * Plugin glue. * ********************************************************************************/ @@ -249,6 +264,7 @@ .buffer_free = alsaplug_buffer_free, .buffer_playing = alsaplug_buffer_playing, .flush = alsaplug_flush, + .pause = alsaplug_pause, }; OutputPlugin *alsa_oplist[] = { &alsa_op, NULL };