From a9950d4ab28a07dcb96d47b4cd44c57be5c825f7 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 16 Feb 2006 01:15:31 +0000 Subject: [PATCH] print ALSA error messages on failure git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@483 fefdeb5f-60dc-0310-8127-8f9354f1896f --- polyp/module-alsa-sink.c | 9 +++++---- polyp/module-alsa-source.c | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/polyp/module-alsa-sink.c b/polyp/module-alsa-sink.c index ea6ca42..9aa220b 100644 --- a/polyp/module-alsa-sink.c +++ b/polyp/module-alsa-sink.c @@ -182,6 +182,7 @@ int pa__init(pa_core *c, pa_module*m) { uint32_t periods, fragsize; snd_pcm_uframes_t period_size; size_t frame_size; + int err; if (!(ma = pa_modargs_new(m->argument, valid_modargs))) { pa_log(__FILE__": failed to parse module arguments\n"); @@ -208,13 +209,13 @@ int pa__init(pa_core *c, pa_module*m) { u->module = m; snd_config_update_free_global(); - if (snd_pcm_open(&u->pcm_handle, dev = pa_modargs_get_value(ma, "device", DEFAULT_DEVICE), SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK) < 0) { - pa_log(__FILE__": Error opening PCM device %s\n", dev); + if ((err = snd_pcm_open(&u->pcm_handle, dev = pa_modargs_get_value(ma, "device", DEFAULT_DEVICE), SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK)) < 0) { + pa_log(__FILE__": Error opening PCM device %s: %s\n", dev, snd_strerror(err)); goto fail; } - if (pa_alsa_set_hw_params(u->pcm_handle, &ss, &periods, &period_size) < 0) { - pa_log(__FILE__": Failed to set hardware parameters\n"); + if ((err = pa_alsa_set_hw_params(u->pcm_handle, &ss, &periods, &period_size)) < 0) { + pa_log(__FILE__": Failed to set hardware parameters: %s\n", snd_strerror(err)); goto fail; } diff --git a/polyp/module-alsa-source.c b/polyp/module-alsa-source.c index 2aa47aa..efc84ef 100644 --- a/polyp/module-alsa-source.c +++ b/polyp/module-alsa-source.c @@ -173,6 +173,7 @@ int pa__init(pa_core *c, pa_module*m) { unsigned periods, fragsize; snd_pcm_uframes_t period_size; size_t frame_size; + int err; if (!(ma = pa_modargs_new(m->argument, valid_modargs))) { pa_log(__FILE__": failed to parse module arguments\n"); @@ -199,13 +200,13 @@ int pa__init(pa_core *c, pa_module*m) { u->module = m; snd_config_update_free_global(); - if (snd_pcm_open(&u->pcm_handle, dev = pa_modargs_get_value(ma, "device", DEFAULT_DEVICE), SND_PCM_STREAM_CAPTURE, SND_PCM_NONBLOCK) < 0) { - pa_log(__FILE__": Error opening PCM device %s\n", dev); + if ((err = snd_pcm_open(&u->pcm_handle, dev = pa_modargs_get_value(ma, "device", DEFAULT_DEVICE), SND_PCM_STREAM_CAPTURE, SND_PCM_NONBLOCK)) < 0) { + pa_log(__FILE__": Error opening PCM device %s: %s\n", dev, snd_strerror(err)); goto fail; } - if (pa_alsa_set_hw_params(u->pcm_handle, &ss, &periods, &period_size) < 0) { - pa_log(__FILE__": Failed to set hardware parameters\n"); + if ((err = pa_alsa_set_hw_params(u->pcm_handle, &ss, &periods, &period_size)) < 0) { + pa_log(__FILE__": Failed to set hardware parameters: %s\n", snd_strerror(err)); goto fail; } -- 2.7.4