summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2009-05-26 10:08:27 -0700
committerChris Robinson <[email protected]>2009-05-26 10:08:27 -0700
commita946af4463f439d9082380ef73a184e02c5d9053 (patch)
tree60c11e41ce05fb917bad3a4a5713f7525fc35ce9
parente01cd92d561ab9a11238d296ff8aaf852dff1ec6 (diff)
Simplify ALSA PCM parameter retrieval
-rw-r--r--Alc/alsa.c22
1 files changed, 4 insertions, 18 deletions
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;