From a946af4463f439d9082380ef73a184e02c5d9053 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 26 May 2009 10:08:27 -0700 Subject: Simplify ALSA PCM parameter retrieval --- Alc/alsa.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) (limited to 'Alc') diff --git a/Alc/alsa.c b/Alc/alsa.c index 582e8da1..5ca35fa3 100644 --- a/Alc/alsa.c +++ b/Alc/alsa.c @@ -439,6 +439,10 @@ open_alsa: /* install and prepare hardware configuration */ if(err == NULL && (i=psnd_pcm_hw_params(data->pcmHandle, p)) < 0) err = "set params"; + if(err == NULL && (i=psnd_pcm_hw_params_get_access(p, &access)) < 0) + err = "get access"; + if(err == NULL && (i=psnd_pcm_hw_params_get_period_size(p, &bufferSizeInFrames, NULL)) < 0) + err = "get period size"; if(err != NULL) { AL_PRINT("%s failed: %s\n", err, psnd_strerror(i)); @@ -448,24 +452,6 @@ open_alsa: return ALC_FALSE; } - if((i=psnd_pcm_hw_params_get_access(p, &access)) < 0) - { - AL_PRINT("get_access failed: %s\n", psnd_strerror(i)); - psnd_pcm_hw_params_free(p); - psnd_pcm_close(data->pcmHandle); - free(data); - return ALC_FALSE; - } - - if((i=psnd_pcm_hw_params_get_period_size(p, &bufferSizeInFrames, NULL)) < 0) - { - AL_PRINT("get_period_size failed: %s\n", psnd_strerror(i)); - psnd_pcm_hw_params_free(p); - psnd_pcm_close(data->pcmHandle); - free(data); - return ALC_FALSE; - } - psnd_pcm_hw_params_free(p); err = NULL; -- cgit v1.2.3