From 707e7947b75192e5ad313cd8d91483ec1c8ecfbc Mon Sep 17 00:00:00 2001 From: larsimmisch Date: Wed, 27 May 2009 18:43:42 +0000 Subject: [PATCH] Revert changes from r30; they was one report of failure and they were not necessary in hindsight anyway. git-svn-id: svn://svn.code.sf.net/p/pyalsaaudio/code/trunk@35 ec2f30ec-7544-0410-870e-f70ca00c83f0 --- alsaaudio.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/alsaaudio.c b/alsaaudio.c index 111cb20..655fb49 100644 --- a/alsaaudio.c +++ b/alsaaudio.c @@ -88,7 +88,7 @@ char *translate_cardname(char *name) full = malloc(strlen("default:CARD=") + strlen(name) + 1); sprintf(full, "default:CARD=%s", name); - return full; + return full; } /* Translate a card index to a ALSA cardname @@ -172,31 +172,29 @@ static int alsapcm_setup(alsapcm_t *self) snd_pcm_hw_params_t *hwparams; /* Allocate a hwparam structure on the stack, - and fill it in with configuration space */ + and fill it with configuration space */ snd_pcm_hw_params_alloca(&hwparams); res = snd_pcm_hw_params_any(self->handle, hwparams); if (res < 0) return res; - /* Fill it in with default values. */ + /* Fill it with default values. + + We don't care if any of this fails - we'll read the actual values + back out. + */ snd_pcm_hw_params_any(self->handle, hwparams); snd_pcm_hw_params_set_access(self->handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED); snd_pcm_hw_params_set_format(self->handle, hwparams, self->format); - res = snd_pcm_hw_params_set_channels(self->handle, hwparams, - self->channels); - if (res < 0) return res; + snd_pcm_hw_params_set_channels(self->handle, hwparams, + self->channels); dir = 0; - res = snd_pcm_hw_params_set_rate(self->handle, hwparams, self->rate, dir); - if (res < 0) return res; - - res = snd_pcm_hw_params_set_period_size(self->handle, hwparams, + snd_pcm_hw_params_set_rate(self->handle, hwparams, self->rate, dir); + snd_pcm_hw_params_set_period_size(self->handle, hwparams, self->periodsize, dir); - if (res < 0) return res; - - res = snd_pcm_hw_params_set_periods(self->handle, hwparams, 4, 0); - if (res < 0) return res; + snd_pcm_hw_params_set_periods(self->handle, hwparams, 4, 0); /* Write it to the device */ res = snd_pcm_hw_params(self->handle, hwparams);