From d455ed2e9e9a2a2614e38946840a736dbff4bf0c Mon Sep 17 00:00:00 2001 From: Philipp Hahn Date: Mon, 1 Jul 2002 11:33:18 +0000 Subject: Add/improve error reporting CVS patchset: 2180 CVS date: 2002/07/01 11:33:18 --- src/audio_out/audio_alsa_out.c | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c index b375184ea..e9a0ebaa1 100644 --- a/src/audio_out/audio_alsa_out.c +++ b/src/audio_out/audio_alsa_out.c @@ -26,7 +26,7 @@ * (c) 2001 James Courtier-Dutton * * - * $Id: audio_alsa_out.c,v 1.61 2002/07/01 11:28:29 pmhahn Exp $ + * $Id: audio_alsa_out.c,v 1.62 2002/07/01 11:33:18 pmhahn Exp $ */ #ifdef HAVE_CONFIG_H @@ -309,7 +309,8 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int } this->has_pause_resume = ( snd_pcm_hw_params_can_pause (params) && snd_pcm_hw_params_can_resume (params) ); - if ((err = snd_pcm_hw_params(this->audio_fd, params)) < 0) { + err = snd_pcm_hw_params(this->audio_fd, params); + if (err < 0) { printf ("audio_alsa_out: pcm hw_params failed: %s\n", snd_strerror(err)); goto __close; } @@ -318,14 +319,32 @@ static int ao_alsa_open(ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int /* * audio buffer size handling */ - /* Copy current parameters into swparams */ - snd_pcm_sw_params_current(this->audio_fd, swparams); - tmp=snd_pcm_sw_params_set_xfer_align(this->audio_fd, swparams, period_size); - tmp=snd_pcm_sw_params_set_avail_min(this->audio_fd, swparams, 1); - tmp=snd_pcm_sw_params_set_start_threshold(this->audio_fd, swparams, period_size); - - /* Install swparams into current parameters */ - snd_pcm_sw_params(this->audio_fd, swparams); + err = snd_pcm_sw_params_current(this->audio_fd, swparams); + if (err < 0) { + printf ("audio_alsa_out: Unable to determine current swparams: %s\n", snd_strerror(err)); + goto __close; + } + err = snd_pcm_sw_params_set_xfer_align(this->audio_fd, swparams, 1); + if (err < 0) { + printf ("audio_alsa_out: Unable to set transfer alignment: %s\n", snd_strerror(err)); + goto __close; + } + err = snd_pcm_sw_params_set_avail_min(this->audio_fd, swparams, period_size); + if (err < 0) { + printf ("audio_alsa_out: Unable to set available min: %s\n", snd_strerror(err)); + goto __close; + } + err = snd_pcm_sw_params_set_start_threshold(this->audio_fd, swparams, period_size); + if (err < 0) { + printf ("audio_alsa_out: Unable to set start threshold: %s\n", snd_strerror(err)); + goto __close; + } + + err = snd_pcm_sw_params(this->audio_fd, swparams); + if (err < 0) { + printf ("audio_alsa_out: Unable to set swparams: %s\n", snd_strerror(err)); + goto __close; + } snd_pcm_dump_setup(this->audio_fd, jcd_out); snd_pcm_sw_params_dump(swparams, jcd_out); return this->output_sample_rate; -- cgit v1.2.3