summaryrefslogtreecommitdiff
path: root/src/sound.c
diff options
context:
space:
mode:
authorJan Djärv <jan.h.d@swipnet.se>2006-07-14 09:47:45 +0000
committerJan Djärv <jan.h.d@swipnet.se>2006-07-14 09:47:45 +0000
commitdcc881213c9b7d6b6df11f394ce62f3a747c9ec5 (patch)
treee6432250e8f7dfe8faab5ab2e979b040c7a54100 /src/sound.c
parentceb53a12f007c30185e5cf86ffec6c073883bbee (diff)
downloademacs-dcc881213c9b7d6b6df11f394ce62f3a747c9ec5.tar.gz
* sound.c (alsa_init): Call snd_pcm_close after successful snd_pcm_open.
Diffstat (limited to 'src/sound.c')
-rw-r--r--src/sound.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/sound.c b/src/sound.c
index af2369040cc..6f955a7d691 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -990,6 +990,7 @@ alsa_configure (sd)
struct sound_device *sd;
{
int val, err, dir;
+ unsigned uval;
struct alsa_params *p = (struct alsa_params *) sd->data;
snd_pcm_uframes_t buffer_size;
@@ -1017,8 +1018,8 @@ alsa_configure (sd)
if (err < 0)
alsa_sound_perror ("Could not set sound format", err);
- val = sd->sample_rate;
- err = snd_pcm_hw_params_set_rate_near (p->handle, p->hwparams, &val, 0);
+ uval = sd->sample_rate;
+ err = snd_pcm_hw_params_set_rate_near (p->handle, p->hwparams, &uval, 0);
if (err < 0)
alsa_sound_perror ("Could not set sample rate", err);
@@ -1123,7 +1124,7 @@ alsa_close (sd)
snd_pcm_sw_params_free (p->swparams);
if (p->handle)
{
- snd_pcm_drain(p->handle);
+ snd_pcm_drain (p->handle);
snd_pcm_close (p->handle);
}
free (p);
@@ -1269,7 +1270,8 @@ alsa_init (sd)
err = snd_pcm_open (&handle, file, SND_PCM_STREAM_PLAYBACK, 0);
snd_lib_error_set_handler (NULL);
if (err < 0)
- return 0;
+ return 0;
+ snd_pcm_close (handle);
sd->fd = -1;
sd->open = alsa_open;