+2006-07-14 Jan Dj\e,Ad\e(Brv <jan.h.d@swipnet.se>
+
+ * sound.c (alsa_init): Call snd_pcm_close after successful snd_pcm_open.
+
2006-07-14 Kim F. Storm <storm@cua.dk>
* w32.c: Fix high cpu load for server sockets.
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;
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);
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);
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;