comparison src/sound.c @ 20:859a2309aef8 r19-15b93

Import from CVS: tag r19-15b93
author cvs
date Mon, 13 Aug 2007 08:50:05 +0200
parents 376386a54a3c
children 8d2a9b52c682
comparison
equal deleted inserted replaced
19:ac1f612d5250 20:859a2309aef8
64 extern char *nas_init_play (Display *); 64 extern char *nas_init_play (Display *);
65 65
66 Lisp_Object Qnas; 66 Lisp_Object Qnas;
67 #endif 67 #endif
68 68
69 DEFUN ("play-sound-file", Fplay_sound_file, Splay_sound_file, 69 DEFUN ("play-sound-file", Fplay_sound_file, 1, 3, "fSound file name: ", /*
70 1, 3, "fSound file name: " /*
71 Play the named sound file on DEVICE's speaker at the specified volume 70 Play the named sound file on DEVICE's speaker at the specified volume
72 (0-100, default specified by the `bell-volume' variable). 71 (0-100, default specified by the `bell-volume' variable).
73 The sound file must be in the Sun/NeXT U-LAW format except under Linux 72 The sound file must be in the Sun/NeXT U-LAW format except under Linux
74 where WAV files are also supported. 73 where WAV files are also supported.
75 DEVICE defaults to the selected device. 74 DEVICE defaults to the selected device.
76 */ ) 75 */
77 (file, volume, device) 76 (file, volume, device))
78 Lisp_Object file, volume, device;
79 { 77 {
80 /* This function can GC */ 78 /* This function can GC */
81 int vol; 79 int vol;
82 #if defined (HAVE_NATIVE_SOUND) || defined (HAVE_NAS_SOUND) 80 #if defined (HAVE_NATIVE_SOUND) || defined (HAVE_NAS_SOUND)
83 struct device *d = decode_device (device); 81 struct device *d = decode_device (device);
225 } 223 }
226 } 224 }
227 } 225 }
228 } 226 }
229 227
230 DEFUN ("play-sound", Fplay_sound, Splay_sound, 1, 3, 0 /* 228 DEFUN ("play-sound", Fplay_sound, 1, 3, 0, /*
231 Play a sound of the provided type. 229 Play a sound of the provided type.
232 See the variable `sound-alist'. 230 See the variable `sound-alist'.
233 */ ) 231 */
234 (sound, volume, device) 232 (sound, volume, device))
235 Lisp_Object sound, volume, device;
236 { 233 {
237 int looking_for_default = 0; 234 int looking_for_default = 0;
238 /* variable `sound' is anything that can be a cdr in sound-alist */ 235 /* variable `sound' is anything that can be a cdr in sound-alist */
239 Lisp_Object new_volume, pitch, duration, data; 236 Lisp_Object new_volume, pitch, duration, data;
240 int loop_count = 0; 237 int loop_count = 0;
306 303
307 DEVMETH (d, ring_bell, (d, vol, pit, dur)); 304 DEVMETH (d, ring_bell, (d, vol, pit, dur));
308 return Qnil; 305 return Qnil;
309 } 306 }
310 307
311 DEFUN ("device-sound-enabled-p", Fdevice_sound_enabled_p, Sdevice_sound_enabled_p, 0, 1, 0 /* 308 DEFUN ("device-sound-enabled-p", Fdevice_sound_enabled_p, 0, 1, 0, /*
312 Return T iff DEVICE is able to play sound. Defaults to selected device. 309 Return T iff DEVICE is able to play sound. Defaults to selected device.
313 */ ) 310 */
314 (device) 311 (device))
315 Lisp_Object device;
316 { 312 {
317 struct device *d = decode_device(device); 313 struct device *d = decode_device(device);
318 314
319 #ifdef HAVE_NAS_SOUND 315 #ifdef HAVE_NAS_SOUND
320 if ( DEVICE_CONNECTED_TO_NAS_P (d) ) 316 if ( DEVICE_CONNECTED_TO_NAS_P (d) )
325 return (Qt); 321 return (Qt);
326 #endif 322 #endif
327 return Qnil; 323 return Qnil;
328 } 324 }
329 325
330 DEFUN ("ding", Fding, Sding, 0, 3, 0 /* 326 DEFUN ("ding", Fding, 0, 3, 0, /*
331 Beep, or flash the frame. 327 Beep, or flash the frame.
332 Also, unless an argument is given, 328 Also, unless an argument is given,
333 terminate any keyboard macro currently executing. 329 terminate any keyboard macro currently executing.
334 When called from lisp, the second argument is what sound to make, and 330 When called from lisp, the second argument is what sound to make, and
335 the third argument is the device to make it in (defaults to the selected 331 the third argument is the device to make it in (defaults to the selected
336 device). 332 device).
337 */ ) 333 */
338 (arg, sound, device) 334 (arg, sound, device))
339 Lisp_Object arg, sound, device;
340 { 335 {
341 struct device *d = decode_device (device); 336 struct device *d = decode_device (device);
342 337
343 XSETDEVICE (device, d); 338 XSETDEVICE (device, d);
344 if (NILP (arg) && !NILP (Vexecuting_macro)) 339 if (NILP (arg) && !NILP (Vexecuting_macro))
350 Fplay_sound (sound, Qnil, device); 345 Fplay_sound (sound, Qnil, device);
351 346
352 return Qnil; 347 return Qnil;
353 } 348 }
354 349
355 DEFUN ("wait-for-sounds", Fwait_for_sounds, Swait_for_sounds, 350 DEFUN ("wait-for-sounds", Fwait_for_sounds, 0, 1, 0, /*
356 0, 1, 0 /*
357 Wait for all sounds to finish playing on DEVICE. 351 Wait for all sounds to finish playing on DEVICE.
358 */ ) 352 */
359 (device) 353 (device))
360 Lisp_Object device;
361
362 { 354 {
363 #ifdef HAVE_NAS_SOUND 355 #ifdef HAVE_NAS_SOUND
364 struct device *d = decode_device (device); 356 struct device *d = decode_device (device);
365 if (DEVICE_CONNECTED_TO_NAS_P (d)) 357 if (DEVICE_CONNECTED_TO_NAS_P (d))
366 { 358 {
369 } 361 }
370 #endif 362 #endif
371 return Qnil; 363 return Qnil;
372 } 364 }
373 365
374 DEFUN ("connected-to-nas-p", Fconnected_to_nas_p, Sconnected_to_nas_p, 366 DEFUN ("connected-to-nas-p", Fconnected_to_nas_p, 0, 1, 0, /*
375 0, 1, 0 /*
376 t if connected to NAS server for sounds on DEVICE. 367 t if connected to NAS server for sounds on DEVICE.
377 */ ) 368 */
378 (device) 369 (device))
379 Lisp_Object device;
380 { 370 {
381 #ifdef HAVE_NAS_SOUND 371 #ifdef HAVE_NAS_SOUND
382 struct device *d = decode_device (device); 372 struct device *d = decode_device (device);
383 if (DEVICE_CONNECTED_TO_NAS_P (d)) 373 if (DEVICE_CONNECTED_TO_NAS_P (d))
384 return Qt; 374 return Qt;
499 489
500 #ifdef HAVE_NAS_SOUND 490 #ifdef HAVE_NAS_SOUND
501 defsymbol (&Qnas, "nas"); 491 defsymbol (&Qnas, "nas");
502 #endif 492 #endif
503 493
504 defsubr (&Splay_sound_file); 494 DEFSUBR (Fplay_sound_file);
505 defsubr (&Splay_sound); 495 DEFSUBR (Fplay_sound);
506 defsubr (&Sding); 496 DEFSUBR (Fding);
507 defsubr (&Swait_for_sounds); 497 DEFSUBR (Fwait_for_sounds);
508 defsubr (&Sconnected_to_nas_p); 498 DEFSUBR (Fconnected_to_nas_p);
509 defsubr (&Sdevice_sound_enabled_p); 499 DEFSUBR (Fdevice_sound_enabled_p);
510 } 500 }
511 501
512 502
513 void 503 void
514 vars_of_sound (void) 504 vars_of_sound (void)