PulseAudio: implement pausing input streams

This commit is contained in:
Andrew Kelley 2015-07-21 17:43:41 -07:00
parent 29dd765aa0
commit f6684a0585
2 changed files with 16 additions and 2 deletions

View file

@ -238,9 +238,9 @@ view `coverage/index.html` in a browser.
## Roadmap ## Roadmap
0. ALSA: poll instead of callback
0. ALSA: support devices that don't support mmap access (test with pulseaudio alsa default) 0. ALSA: support devices that don't support mmap access (test with pulseaudio alsa default)
0. implement ALSA (Linux) backend, get examples working 0. implement ALSA (Linux) backend, get examples working
0. ALSA: poll instead of callback
0. pipe record to playback example working with dummy linux, osx, windows 0. pipe record to playback example working with dummy linux, osx, windows
0. pipe record to playback example working with pulseaudio linux 0. pipe record to playback example working with pulseaudio linux
0. implement CoreAudio (OSX) backend, get examples working 0. implement CoreAudio (OSX) backend, get examples working

View file

@ -969,7 +969,21 @@ static void instream_clear_buffer_pa(SoundIoPrivate *si, SoundIoInStreamPrivate
} }
static int instream_pause_pa(SoundIoPrivate *si, SoundIoInStreamPrivate *is, bool pause) { static int instream_pause_pa(SoundIoPrivate *si, SoundIoInStreamPrivate *is, bool pause) {
soundio_panic("TODO"); SoundIoInStreamPulseAudio *ispa = (SoundIoInStreamPulseAudio *)is->backend_data;
SoundIoPulseAudio *sipa = (SoundIoPulseAudio *)si->backend_data;
pa_threaded_mainloop_lock(sipa->main_loop);
if (pause != !pa_stream_is_corked(ispa->stream)) {
pa_operation *op = pa_stream_cork(ispa->stream, pause, NULL, NULL);
if (!op)
return SoundIoErrorStreaming;
pa_operation_unref(op);
}
pa_threaded_mainloop_unlock(sipa->main_loop);
return 0;
} }
int soundio_pulseaudio_init(SoundIoPrivate *si) { int soundio_pulseaudio_init(SoundIoPrivate *si) {