]> git.eshelyaron.com Git - emacs.git/commitdiff
* sound.c (alsa_init): Call snd_pcm_close after successful snd_pcm_open.
authorJan Djärv <jan.h.d@swipnet.se>
Fri, 14 Jul 2006 09:47:45 +0000 (09:47 +0000)
committerJan Djärv <jan.h.d@swipnet.se>
Fri, 14 Jul 2006 09:47:45 +0000 (09:47 +0000)
src/ChangeLog
src/sound.c

index aaa464cfd68650285af32bb1d81b5cdeda6b7c8c..591bb2fefe932a3abd02bb2f67ab63f82c9284fa 100644 (file)
@@ -1,3 +1,7 @@
+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.
index af2369040cc1b972c92b5948e60f5166200c614d..6f955a7d69141cfe875b1440959caac0b1fb5aae 100644 (file)
@@ -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;