# HG changeset patch # User William Pitcock # Date 1242360890 18000 # Node ID 087abc78516e3c19b30cd1363eb0f1e9de875cad # Parent adec82db531cbc493d30b0b5dfc27eb3bc2615a5 alsa-ng: implement pause stuff. not perfect yet. diff -r adec82db531c -r 087abc78516e src/alsa-ng/alsa-core.c --- 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 };