diff options
author | Chris Robinson <[email protected]> | 2009-05-26 10:08:27 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2009-05-26 10:08:27 -0700 |
commit | a946af4463f439d9082380ef73a184e02c5d9053 (patch) | |
tree | 60c11e41ce05fb917bad3a4a5713f7525fc35ce9 /Alc | |
parent | e01cd92d561ab9a11238d296ff8aaf852dff1ec6 (diff) |
Simplify ALSA PCM parameter retrieval
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/alsa.c | 22 |
1 files changed, 4 insertions, 18 deletions
@@ -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; |