]> code.delx.au - gnu-emacs/blobdiff - src/sound.c
(Fget_char_property): Update call to overlays_at.
[gnu-emacs] / src / sound.c
index 6f0e6fb997ef2484093e0cedec45a24d9994ab06..a3a44ccefcac9e6b47f7a9ae36e06b147437ab82 100644 (file)
@@ -41,6 +41,14 @@ Boston, MA 02111-1307, USA.  */
 #ifdef HAVE_SYS_SOUNDCARD_H
 #include <sys/soundcard.h>
 #endif
+#ifdef HAVE_SOUNDCARD_H
+#include <sys/ioctl.h>
+#include <soundcard.h>
+#endif
+
+#ifndef DEFAULT_SOUND_DEVICE
+#define DEFAULT_SOUND_DEVICE "/dev/dsp"
+#endif
 
 #define max(X, Y) ((X) > (Y) ? (X) : (Y))
 #define min(X, Y) ((X) < (Y) ? (X) : (Y))
@@ -347,7 +355,8 @@ sound_cleanup (arg)
 {
   if (current_sound_device)
     {
-      current_sound_device->close (current_sound_device);
+      if (current_sound_device->close)
+       current_sound_device->close (current_sound_device);
       if (current_sound->fd > 0)
        emacs_close (current_sound->fd);
     }
@@ -355,7 +364,23 @@ sound_cleanup (arg)
 
 
 DEFUN ("play-sound", Fplay_sound, Splay_sound, 1, 1, 0,
-  "Play sound SOUND.")
+  "Play sound SOUND.\n\
+SOUND is a list of the form `(sound KEYWORD VALUE...)'.\n\
+The following keywords are recognized:\n\
+\n\
+  :file FILE.- read sound data from FILE.  If FILE Isn't an\n\
+absolute file name, it is searched in `data-directory'.\n\
+\n\
+  :data DATA - read sound data from string DATA.\n\
+\n\
+Exactly one of :file or :data must be present.\n\
+\n\
+  :volume VOL - set volume to VOL.  VOL must an integer in the\n\
+range 0..100 or a float in the range 0..1.0.  If not specified,\n\
+don't change the volume setting of the sound device.\n\
+\n\
+  :device DEVICE - play sound on DEVICE.  If not specified,\n\
+a system-dependent default device name is used.")
   (sound)
      Lisp_Object sound;
 {
@@ -418,7 +443,7 @@ DEFUN ("play-sound", Fplay_sound, Splay_sound, 1, 1, 0,
 
   args[0] = Qplay_sound_functions;
   args[1] = sound;
-  Frun_hook_with_args (make_number (2), args);
+  Frun_hook_with_args (2, args);
 
   /* There is only one type of device we currently support, the VOX
      sound driver.  Set up the device interface functions for that
@@ -719,7 +744,7 @@ vox_open (sd)
   if (sd->file)
     file = sd->file;
   else
-    file = "/dev/dsp";
+    file = DEFAULT_SOUND_DEVICE;
   
   sd->fd = emacs_open (file, O_WRONLY, 0);
   if (sd->fd < 0)