0
|
1 /* Sound functions.
|
|
2 Copyright (C) 1992, 1993, 1994 Lucid Inc.
|
|
3 Copyright (C) 1994, 1995 Free Software Foundation, Inc.
|
|
4
|
|
5 This file is part of XEmacs.
|
|
6
|
|
7 XEmacs is free software; you can redistribute it and/or modify it
|
|
8 under the terms of the GNU General Public License as published by the
|
|
9 Free Software Foundation; either version 2, or (at your option) any
|
|
10 later version.
|
|
11
|
|
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
15 for more details.
|
|
16
|
|
17 You should have received a copy of the GNU General Public License
|
|
18 along with XEmacs; see the file COPYING. If not, write to
|
|
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
20 Boston, MA 02111-1307, USA. */
|
|
21
|
|
22 /* Synched up with: Not in FSF. */
|
|
23
|
|
24 /* Originally written by Jamie Zawinski.
|
|
25 Hacked on quite a bit by various others. */
|
|
26
|
|
27 #include <config.h>
|
|
28 #include "lisp.h"
|
|
29
|
|
30 #include "buffer.h"
|
|
31 #ifdef HAVE_X_WINDOWS
|
|
32 #include "console-x.h"
|
|
33 #endif
|
|
34
|
|
35 #include "commands.h"
|
|
36 #include "device.h"
|
|
37 #include "redisplay.h"
|
|
38 #include "sysdep.h"
|
|
39
|
|
40 #ifdef HAVE_NATIVE_SOUND
|
|
41 # include <netdb.h>
|
|
42 #endif
|
|
43
|
|
44 int bell_volume;
|
|
45 Lisp_Object Vsound_alist;
|
|
46 Lisp_Object Vsynchronous_sounds;
|
|
47 Lisp_Object Vnative_sound_only_on_console;
|
|
48 Lisp_Object Q_volume, Q_pitch, Q_duration, Q_sound;
|
|
49
|
|
50 /* These are defined in the appropriate file (sunplay.c, sgiplay.c,
|
|
51 or hpplay.c). */
|
|
52
|
|
53 extern void play_sound_file (char *name, int volume);
|
|
54 extern void play_sound_data (unsigned char *data, int length, int volume);
|
|
55
|
|
56 #ifdef HAVE_NAS_SOUND
|
|
57 extern int nas_play_sound_file (char *name, int volume);
|
|
58 extern int nas_play_sound_data (unsigned char *data, int length, int volume);
|
|
59 extern int nas_wait_for_sounds (void);
|
|
60 extern char *nas_init_play (Display *);
|
|
61
|
|
62 Lisp_Object Qnas;
|
|
63 #endif
|
|
64
|
20
|
65 DEFUN ("play-sound-file", Fplay_sound_file, 1, 3, "fSound file name: ", /*
|
0
|
66 Play the named sound file on DEVICE's speaker at the specified volume
|
|
67 (0-100, default specified by the `bell-volume' variable).
|
|
68 The sound file must be in the Sun/NeXT U-LAW format except under Linux
|
|
69 where WAV files are also supported.
|
|
70 DEVICE defaults to the selected device.
|
20
|
71 */
|
70
|
72 (file, volume, device))
|
0
|
73 {
|
116
|
74 /* This function can call lisp */
|
0
|
75 int vol;
|
|
76 #if defined (HAVE_NATIVE_SOUND) || defined (HAVE_NAS_SOUND)
|
|
77 struct device *d = decode_device (device);
|
|
78 #endif
|
116
|
79 struct gcpro gcpro1;
|
|
80
|
0
|
81 CHECK_STRING (file);
|
|
82 if (NILP (volume))
|
|
83 vol = bell_volume;
|
|
84 else
|
|
85 {
|
|
86 CHECK_INT (volume);
|
|
87 vol = XINT (volume);
|
|
88 }
|
|
89
|
116
|
90 GCPRO1 (file);
|
245
|
91 while (1)
|
233
|
92 {
|
245
|
93 file = Fexpand_file_name (file, Qnil);
|
|
94 if (!NILP(Ffile_readable_p (file)))
|
|
95 break;
|
|
96 else
|
|
97 {
|
|
98 /* #### This is crockish. It might be a better idea to try
|
|
99 to open the file, and use report_file_error() if it
|
|
100 fails. --hniksic */
|
|
101 if (NILP (Ffile_exists_p (file)))
|
|
102 signal_simple_continuable_error ("File does not exist", file);
|
|
103 else
|
|
104 signal_simple_continuable_error ("File is unreadable", file);
|
|
105 }
|
233
|
106 }
|
116
|
107 UNGCPRO;
|
0
|
108
|
|
109 #ifdef HAVE_NAS_SOUND
|
|
110 if (DEVICE_CONNECTED_TO_NAS_P (d))
|
|
111 {
|
|
112 char *fileext;
|
|
113
|
|
114 GET_C_STRING_FILENAME_DATA_ALLOCA (file, fileext);
|
|
115 /* #### NAS code should allow specification of a device. */
|
|
116 if (nas_play_sound_file (fileext, vol))
|
|
117 return Qnil;
|
|
118 }
|
|
119 #endif /* HAVE_NAS_SOUND */
|
|
120
|
|
121 #ifdef HAVE_NATIVE_SOUND
|
|
122 if (NILP (Vnative_sound_only_on_console) || DEVICE_ON_CONSOLE_P (d))
|
|
123 {
|
|
124 CONST char *fileext;
|
|
125
|
|
126 GET_C_STRING_FILENAME_DATA_ALLOCA (file, fileext);
|
|
127 /* The sound code doesn't like getting SIGIO interrupts.
|
|
128 Unix sucks! */
|
|
129 stop_interrupts ();
|
|
130 play_sound_file ((char *) fileext, vol);
|
|
131 start_interrupts ();
|
|
132 QUIT;
|
|
133 }
|
|
134 #endif /* HAVE_NATIVE_SOUND */
|
|
135
|
|
136 return Qnil;
|
|
137 }
|
|
138
|
|
139 static void
|
|
140 parse_sound_alist_elt (Lisp_Object elt,
|
|
141 Lisp_Object *volume,
|
|
142 Lisp_Object *pitch,
|
|
143 Lisp_Object *duration,
|
|
144 Lisp_Object *sound)
|
|
145 {
|
|
146 *volume = Qnil;
|
|
147 *pitch = Qnil;
|
|
148 *duration = Qnil;
|
|
149 *sound = Qnil;
|
|
150 if (! CONSP (elt))
|
|
151 return;
|
|
152
|
|
153 /* The things we do for backward compatibility...
|
|
154 I wish I had just forced this to be a plist to begin with.
|
|
155 */
|
|
156
|
|
157 if (SYMBOLP (elt) || STRINGP (elt)) /* ( name . <sound> ) */
|
|
158 {
|
|
159 *sound = elt;
|
|
160 }
|
|
161 else if (!CONSP (elt))
|
|
162 {
|
|
163 return;
|
|
164 }
|
|
165 else if (NILP (XCDR (elt)) && /* ( name <sound> ) */
|
|
166 (SYMBOLP (XCAR (elt)) ||
|
|
167 STRINGP (XCAR (elt))))
|
|
168 {
|
|
169 *sound = XCAR (elt);
|
|
170 }
|
|
171 else if (INT_OR_FLOATP (XCAR (elt)) && /* ( name <vol> . <sound> ) */
|
|
172 (SYMBOLP (XCDR (elt)) ||
|
|
173 STRINGP (XCDR (elt))))
|
|
174 {
|
|
175 *volume = XCAR (elt);
|
|
176 *sound = XCDR (elt);
|
|
177 }
|
|
178 else if (INT_OR_FLOATP (XCAR (elt)) && /* ( name <vol> <sound> ) */
|
|
179 CONSP (XCDR (elt)) &&
|
|
180 NILP (XCDR (XCDR (elt))) &&
|
|
181 (SYMBOLP (XCAR (XCDR (elt))) ||
|
|
182 STRINGP (XCAR (XCDR (elt)))))
|
|
183 {
|
|
184 *volume = XCAR (elt);
|
|
185 *sound = XCAR (XCDR (elt));
|
|
186 }
|
|
187 else if ((SYMBOLP (XCAR (elt)) || /* ( name <sound> . <vol> ) */
|
|
188 STRINGP (XCAR (elt))) &&
|
|
189 INT_OR_FLOATP (XCDR (elt)))
|
|
190 {
|
|
191 *sound = XCAR (elt);
|
|
192 *volume = XCDR (elt);
|
|
193 }
|
|
194 #if 0 /* this one is ambiguous with the plist form */
|
|
195 else if ((SYMBOLP (XCAR (elt)) || /* ( name <sound> <vol> ) */
|
|
196 STRINGP (XCAR (elt))) &&
|
|
197 CONSP (XCDR (elt)) &&
|
|
198 NILP (XCDR (XCDR (elt))) &&
|
|
199 INT_OR_FLOATP (XCAR (XCDR (elt))))
|
|
200 {
|
|
201 *sound = XCAR (elt);
|
|
202 *volume = XCAR (XCDR (elt));
|
|
203 }
|
|
204 #endif /* 0 */
|
|
205 else /* ( name [ keyword <value> ]* ) */
|
|
206 {
|
|
207 while (CONSP (elt))
|
|
208 {
|
|
209 Lisp_Object key, val;
|
|
210 key = XCAR (elt);
|
|
211 val = XCDR (elt);
|
|
212 if (!CONSP (val))
|
|
213 return;
|
|
214 elt = XCDR (val);
|
|
215 val = XCAR (val);
|
|
216 if (EQ (key, Q_volume))
|
|
217 {
|
|
218 if (INT_OR_FLOATP (val)) *volume = val;
|
|
219 }
|
|
220 else if (EQ (key, Q_pitch))
|
|
221 {
|
|
222 if (INT_OR_FLOATP (val)) *pitch = val;
|
|
223 if (NILP (*sound)) *sound = Qt;
|
|
224 }
|
|
225 else if (EQ (key, Q_duration))
|
|
226 {
|
|
227 if (INT_OR_FLOATP (val)) *duration = val;
|
|
228 if (NILP (*sound)) *sound = Qt;
|
|
229 }
|
|
230 else if (EQ (key, Q_sound))
|
|
231 {
|
|
232 if (SYMBOLP (val) || STRINGP (val)) *sound = val;
|
|
233 }
|
|
234 }
|
|
235 }
|
|
236 }
|
|
237
|
20
|
238 DEFUN ("play-sound", Fplay_sound, 1, 3, 0, /*
|
0
|
239 Play a sound of the provided type.
|
|
240 See the variable `sound-alist'.
|
20
|
241 */
|
|
242 (sound, volume, device))
|
0
|
243 {
|
|
244 int looking_for_default = 0;
|
|
245 /* variable `sound' is anything that can be a cdr in sound-alist */
|
|
246 Lisp_Object new_volume, pitch, duration, data;
|
|
247 int loop_count = 0;
|
|
248 int vol, pit, dur;
|
|
249 struct device *d = decode_device (device);
|
|
250
|
|
251 /* NOTE! You'd better not signal an error in here. */
|
|
252
|
|
253
|
|
254 try_it_again:
|
|
255 while (1)
|
|
256 {
|
|
257 if (SYMBOLP (sound))
|
|
258 sound = Fcdr (Fassq (sound, Vsound_alist));
|
|
259 parse_sound_alist_elt (sound, &new_volume, &pitch, &duration, &data);
|
|
260 sound = data;
|
|
261 if (NILP (volume)) volume = new_volume;
|
|
262 if (EQ (sound, Qt) || EQ (sound, Qnil) || STRINGP (sound))
|
|
263 break;
|
|
264 if (loop_count++ > 500) /* much bogosity has occurred */
|
|
265 break;
|
|
266 }
|
|
267
|
|
268 if (NILP (sound) && !looking_for_default)
|
|
269 {
|
|
270 looking_for_default = 1;
|
|
271 loop_count = 0;
|
|
272 sound = Qdefault;
|
|
273 goto try_it_again;
|
|
274 }
|
|
275
|
|
276
|
|
277 vol = (INT_OR_FLOATP (volume) ? XFLOATINT (volume) : bell_volume);
|
|
278 pit = (INT_OR_FLOATP (pitch) ? XFLOATINT (pitch) : -1);
|
|
279 dur = (INT_OR_FLOATP (duration) ? XFLOATINT (duration) : -1);
|
|
280
|
|
281 /* If the sound is a string, and we're connected to Nas, do that.
|
|
282 Else if the sound is a string, and we're on console, play it natively.
|
|
283 Else just beep.
|
|
284 */
|
|
285 #ifdef HAVE_NAS_SOUND
|
|
286 if (DEVICE_CONNECTED_TO_NAS_P (d) && STRINGP (sound))
|
|
287 {
|
|
288 Extbyte *soundext;
|
|
289 Extcount soundextlen;
|
|
290
|
|
291 GET_STRING_BINARY_DATA_ALLOCA (sound, soundext, soundextlen);
|
|
292 if (nas_play_sound_data (soundext, soundextlen, vol))
|
|
293 return Qnil;
|
|
294 }
|
|
295 #endif /* HAVE_NAS_SOUND */
|
|
296
|
|
297 #ifdef HAVE_NATIVE_SOUND
|
|
298 if ((NILP (Vnative_sound_only_on_console) || DEVICE_ON_CONSOLE_P (d))
|
|
299 && STRINGP (sound))
|
|
300 {
|
|
301 Extbyte *soundext;
|
|
302 Extcount soundextlen;
|
|
303
|
|
304 GET_STRING_BINARY_DATA_ALLOCA (sound, soundext, soundextlen);
|
|
305 /* The sound code doesn't like getting SIGIO interrupts. Unix sucks! */
|
|
306 stop_interrupts ();
|
|
307 play_sound_data (soundext, soundextlen, vol);
|
|
308 start_interrupts ();
|
|
309 QUIT;
|
|
310 return Qnil;
|
|
311 }
|
|
312 #endif /* HAVE_NATIVE_SOUND */
|
|
313
|
|
314 DEVMETH (d, ring_bell, (d, vol, pit, dur));
|
|
315 return Qnil;
|
|
316 }
|
|
317
|
20
|
318 DEFUN ("device-sound-enabled-p", Fdevice_sound_enabled_p, 0, 1, 0, /*
|
0
|
319 Return T iff DEVICE is able to play sound. Defaults to selected device.
|
20
|
320 */
|
|
321 (device))
|
0
|
322 {
|
|
323 struct device *d = decode_device(device);
|
|
324
|
|
325 #ifdef HAVE_NAS_SOUND
|
|
326 if ( DEVICE_CONNECTED_TO_NAS_P (d) )
|
|
327 return (Qt);
|
|
328 #endif
|
|
329 #ifdef HAVE_NATIVE_SOUND
|
|
330 if ( DEVICE_ON_CONSOLE_P (d) )
|
|
331 return (Qt);
|
|
332 #endif
|
|
333 return Qnil;
|
|
334 }
|
|
335
|
20
|
336 DEFUN ("ding", Fding, 0, 3, 0, /*
|
0
|
337 Beep, or flash the frame.
|
|
338 Also, unless an argument is given,
|
|
339 terminate any keyboard macro currently executing.
|
|
340 When called from lisp, the second argument is what sound to make, and
|
|
341 the third argument is the device to make it in (defaults to the selected
|
|
342 device).
|
20
|
343 */
|
|
344 (arg, sound, device))
|
0
|
345 {
|
|
346 struct device *d = decode_device (device);
|
|
347
|
|
348 XSETDEVICE (device, d);
|
245
|
349
|
|
350 /* #### This is utterly disgusting, and is probably a remnant from
|
|
351 legacy code that used `ding'+`message' to signal error instead
|
|
352 calling `error'. As a result, there is no way to beep from Lisp
|
|
353 directly, without also invoking this aspect. Maybe we should
|
|
354 define a `ring-bell' function that simply beeps on the console,
|
|
355 which `ding' should invoke? --hniksic */
|
0
|
356 if (NILP (arg) && !NILP (Vexecuting_macro))
|
|
357 /* Stop executing a keyboard macro. */
|
|
358 error ("Keyboard macro terminated by a command ringing the bell");
|
|
359 else if (visible_bell && DEVMETH (d, flash, (d)))
|
|
360 ;
|
|
361 else
|
|
362 Fplay_sound (sound, Qnil, device);
|
|
363
|
|
364 return Qnil;
|
|
365 }
|
|
366
|
20
|
367 DEFUN ("wait-for-sounds", Fwait_for_sounds, 0, 1, 0, /*
|
0
|
368 Wait for all sounds to finish playing on DEVICE.
|
20
|
369 */
|
|
370 (device))
|
70
|
371
|
0
|
372 {
|
|
373 #ifdef HAVE_NAS_SOUND
|
|
374 struct device *d = decode_device (device);
|
|
375 if (DEVICE_CONNECTED_TO_NAS_P (d))
|
|
376 {
|
|
377 /* #### somebody fix this to be device-dependent. */
|
|
378 nas_wait_for_sounds ();
|
|
379 }
|
|
380 #endif
|
|
381 return Qnil;
|
|
382 }
|
|
383
|
20
|
384 DEFUN ("connected-to-nas-p", Fconnected_to_nas_p, 0, 1, 0, /*
|
0
|
385 t if connected to NAS server for sounds on DEVICE.
|
20
|
386 */
|
|
387 (device))
|
0
|
388 {
|
|
389 #ifdef HAVE_NAS_SOUND
|
|
390 struct device *d = decode_device (device);
|
|
391 if (DEVICE_CONNECTED_TO_NAS_P (d))
|
|
392 return Qt;
|
|
393 else
|
|
394 return Qnil;
|
|
395 #else
|
|
396 return Qnil;
|
|
397 #endif
|
|
398 }
|
|
399 #ifdef HAVE_NAS_SOUND
|
|
400
|
|
401 static void
|
|
402 init_nas_sound (struct device *d)
|
|
403 {
|
|
404 char *error;
|
|
405
|
|
406 #ifdef HAVE_X_WINDOWS
|
|
407 if (DEVICE_X_P (d))
|
|
408 {
|
|
409 error = nas_init_play (DEVICE_X_DISPLAY (d));
|
|
410 DEVICE_CONNECTED_TO_NAS_P (d) = !error;
|
|
411 /* Print out the message? */
|
|
412 }
|
|
413 #endif /* HAVE_X_WINDOWS */
|
|
414 }
|
|
415
|
|
416 #endif /* HAVE_NAS_SOUND */
|
|
417
|
|
418 #ifdef HAVE_NATIVE_SOUND
|
|
419
|
|
420 static void
|
|
421 init_native_sound (struct device *d)
|
|
422 {
|
|
423 if (DEVICE_TTY_P (d) || DEVICE_STREAM_P (d))
|
|
424 DEVICE_ON_CONSOLE_P (d) = 1;
|
|
425 #ifdef HAVE_X_WINDOWS
|
|
426 else
|
|
427 {
|
|
428 /* When running on a machine with native sound support, we cannot use
|
|
429 digitized sounds as beeps unless emacs is running on the same machine
|
|
430 that $DISPLAY points to, and $DISPLAY points to frame 0 of that
|
|
431 machine.
|
|
432 */
|
|
433
|
|
434 Display *display = DEVICE_X_DISPLAY (d);
|
|
435 char *dpy = DisplayString (display);
|
|
436 char *tail = (char *) strchr (dpy, ':');
|
|
437 if (! tail ||
|
|
438 strncmp (tail, ":0", 2))
|
|
439 DEVICE_ON_CONSOLE_P (d) = 0;
|
|
440 else
|
|
441 {
|
|
442 char dpyname[255], localname[255];
|
|
443
|
|
444 /* some systems can't handle SIGIO or SIGALARM in gethostbyname. */
|
|
445 stop_interrupts ();
|
|
446 strncpy (dpyname, dpy, tail-dpy);
|
|
447 dpyname [tail-dpy] = 0;
|
|
448 if (!*dpyname ||
|
|
449 !strcmp (dpyname, "unix") ||
|
|
450 !strcmp (dpyname, "localhost"))
|
|
451 DEVICE_ON_CONSOLE_P (d) = 1;
|
|
452 else if (gethostname (localname, sizeof (localname)))
|
|
453 DEVICE_ON_CONSOLE_P (d) = 0; /* can't find hostname? */
|
|
454 else
|
|
455 {
|
|
456 /* We have to call gethostbyname() on the result of gethostname()
|
|
457 because the two aren't guarenteed to be the same name for the
|
|
458 same host: on some losing systems, one is a FQDN and the other
|
|
459 is not. Here in the wide wonderful world of Unix it's rocket
|
|
460 science to obtain the local hostname in a portable fashion.
|
|
461
|
|
462 And don't forget, gethostbyname() reuses the structure it
|
|
463 returns, so we have to copy the fucker before calling it
|
|
464 again.
|
|
465
|
|
466 Thank you master, may I have another.
|
|
467 */
|
|
468 struct hostent *h = gethostbyname (dpyname);
|
|
469 if (!h)
|
|
470 DEVICE_ON_CONSOLE_P (d) = 0;
|
|
471 else
|
|
472 {
|
|
473 char hn [255];
|
|
474 struct hostent *l;
|
|
475 strcpy (hn, h->h_name);
|
|
476 l = gethostbyname (localname);
|
|
477 DEVICE_ON_CONSOLE_P (d) = (l && !(strcmp (l->h_name, hn)));
|
|
478 }
|
|
479 }
|
|
480 start_interrupts ();
|
|
481 }
|
|
482 }
|
|
483 #endif /* HAVE_X_WINDOWS */
|
|
484 }
|
|
485
|
|
486 #endif /* HAVE_NATIVE_SOUND */
|
|
487
|
|
488 void
|
|
489 init_device_sound (struct device *d)
|
|
490 {
|
|
491 #ifdef HAVE_NAS_SOUND
|
|
492 init_nas_sound (d);
|
|
493 #endif
|
|
494
|
|
495 #ifdef HAVE_NATIVE_SOUND
|
|
496 init_native_sound (d);
|
|
497 #endif
|
|
498 }
|
|
499
|
|
500 void
|
|
501 syms_of_sound (void)
|
|
502 {
|
|
503 defkeyword (&Q_volume, ":volume");
|
|
504 defkeyword (&Q_pitch, ":pitch");
|
|
505 defkeyword (&Q_duration, ":duration");
|
|
506 defkeyword (&Q_sound, ":sound");
|
|
507
|
|
508 #ifdef HAVE_NAS_SOUND
|
|
509 defsymbol (&Qnas, "nas");
|
|
510 #endif
|
|
511
|
20
|
512 DEFSUBR (Fplay_sound_file);
|
|
513 DEFSUBR (Fplay_sound);
|
|
514 DEFSUBR (Fding);
|
|
515 DEFSUBR (Fwait_for_sounds);
|
|
516 DEFSUBR (Fconnected_to_nas_p);
|
|
517 DEFSUBR (Fdevice_sound_enabled_p);
|
0
|
518 }
|
|
519
|
|
520
|
|
521 void
|
|
522 vars_of_sound (void)
|
|
523 {
|
|
524 #ifdef HAVE_NATIVE_SOUND
|
|
525 Fprovide (intern ("native-sound"));
|
|
526 #endif
|
|
527 #ifdef HAVE_NAS_SOUND
|
|
528 Fprovide (intern ("nas-sound"));
|
|
529 #endif
|
|
530
|
|
531 DEFVAR_INT ("bell-volume", &bell_volume /*
|
|
532 *How loud to be, from 0 to 100.
|
|
533 */ );
|
|
534 bell_volume = 50;
|
|
535
|
|
536 DEFVAR_LISP ("sound-alist", &Vsound_alist /*
|
|
537 An alist associating names with sounds.
|
|
538 When `beep' or `ding' is called with one of the name symbols, the associated
|
|
539 sound will be generated instead of the standard beep.
|
|
540
|
|
541 Each element of `sound-alist' is a list describing a sound.
|
|
542 The first element of the list is the name of the sound being defined.
|
|
543 Subsequent elements of the list are alternating keyword/value pairs:
|
|
544
|
|
545 Keyword: Value:
|
|
546 ------- -----
|
|
547 sound A string of raw sound data, or the name of another sound to
|
|
548 play. The symbol `t' here means use the default X beep.
|
|
549 volume An integer from 0-100, defaulting to `bell-volume'
|
|
550 pitch If using the default X beep, the pitch (Hz) to generate.
|
|
551 duration If using the default X beep, the duration (milliseconds).
|
|
552
|
|
553 For compatibility, elements of `sound-alist' may also be:
|
|
554
|
|
555 ( sound-name . <sound> )
|
|
556 ( sound-name <volume> <sound> )
|
|
557
|
|
558 You should probably add things to this list by calling the function
|
|
559 load-sound-file.
|
|
560
|
|
561 Caveats:
|
|
562 - You can only play audio data if running on the console screen of a
|
|
563 Sun SparcStation, SGI, or HP9000s700.
|
|
564
|
|
565 - The pitch, duration, and volume options are available everywhere, but
|
|
566 many X servers ignore the `pitch' option.
|
|
567
|
|
568 The following beep-types are used by emacs itself:
|
|
569
|
|
570 auto-save-error when an auto-save does not succeed
|
|
571 command-error when the emacs command loop catches an error
|
|
572 undefined-key when you type a key that is undefined
|
|
573 undefined-click when you use an undefined mouse-click combination
|
|
574 no-completion during completing-read
|
|
575 y-or-n-p when you type something other than 'y' or 'n'
|
|
576 yes-or-no-p when you type something other than 'yes' or 'no'
|
|
577 default used when nothing else is appropriate.
|
|
578
|
|
579 Other lisp packages may use other beep types, but these are the ones that
|
|
580 the C kernel of Emacs uses.
|
|
581 */ );
|
|
582 Vsound_alist = Qnil;
|
|
583
|
|
584 DEFVAR_LISP ("synchronous-sounds", &Vsynchronous_sounds /*
|
|
585 Play sounds synchronously, if non-nil.
|
|
586 Only applies if NAS is used and supports asynchronous playing
|
|
587 of sounds. Otherwise, sounds are always played synchronously.
|
|
588 */ );
|
|
589 Vsynchronous_sounds = Qnil;
|
|
590
|
|
591 DEFVAR_LISP ("native-sound-only-on-console", &Vnative_sound_only_on_console /*
|
|
592 Non-nil value means play sounds only if XEmacs is running
|
|
593 on the system console.
|
|
594 Nil means always always play sounds, even if running on a non-console tty
|
|
595 or a secondary X display.
|
|
596
|
|
597 This variable only applies to native sound support.
|
|
598 */ );
|
|
599 Vnative_sound_only_on_console = Qt;
|
|
600
|
|
601 #if defined (HAVE_NATIVE_SOUND) && defined (hp9000s800)
|
|
602 vars_of_hpplay ();
|
|
603 #endif
|
|
604 }
|