Mercurial > hg > xemacs-beta
comparison lisp/prim/sound.el @ 134:34a5b81f86ba r20-2b1
Import from CVS: tag r20-2b1
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:30:11 +0200 |
parents | 9b50b4588a93 |
children | b980b6286996 |
comparison
equal
deleted
inserted
replaced
133:b27e67717092 | 134:34a5b81f86ba |
---|---|
19 ;; along with XEmacs; see the file COPYING. If not, write to the | 19 ;; along with XEmacs; see the file COPYING. If not, write to the |
20 ;; Free Software Foundation, 59 Temple Place - Suite 330, | 20 ;; Free Software Foundation, 59 Temple Place - Suite 330, |
21 ;; Boston, MA 02111-1307, USA. | 21 ;; Boston, MA 02111-1307, USA. |
22 | 22 |
23 ;;; Synched up with: Not in FSF. | 23 ;;; Synched up with: Not in FSF. |
24 (defgroup sound nil | |
25 "Configure XEmacs sounds and properties" | |
26 :group 'environment) | |
27 | |
28 (defcustom sound-default-alist | |
29 '((default :sound bass) | |
30 (undefined-key :sound drum) | |
31 (undefined-click :sound drum) | |
32 ;; beginning-of-buffer or end-of-buffer errors. | |
33 (buffer-bound :sound drum) | |
34 ;; buffer-read-only error | |
35 (read-only :sound drum) | |
36 ;; non-interactive function or lambda called | |
37 (command-error :sound bass) | |
38 (y-or-n-p :sound quiet) | |
39 (yes-or-no-p :sound quiet) | |
40 (auto-save-error :sound whip :volume 100) | |
41 (no-completion :sound whip) | |
42 (isearch-failed :sound quiet) | |
43 (isearch-quit :sound bass) | |
44 ;; QUIT: sound generated by ^G and it's variants. | |
45 (quit :sound quiet :volume 75) | |
46 ;; READY: time-consuming task has completed... compile, | |
47 ;; cvs-update, etc. | |
48 (ready :sound cuckoo) | |
49 ;; WARP: XEmacs has changed the selected-window or frame | |
50 ;; asynchronously... Especially when it's done by an | |
51 ;; asynchronous process filter. Perhaps by a debugger breakpoint | |
52 ;; has been hit? | |
53 (warp :sound yeep :volume 75) | |
54 ;; ALARM: used for reminders... | |
55 (alarm :sound cuckoo :volume 100) | |
56 ) | |
57 "The alist of sounds and associated error symbols. | |
58 | |
59 Used to set sound-alist in load-default-sounds." | |
60 :group 'sound | |
61 :type '(repeat | |
62 (group (symbol :tag "Name") | |
63 (checklist :inline t | |
64 :greedy t | |
65 (group :inline t | |
66 (const :format "" :value :sound) | |
67 (symbol :tag "Sound")) | |
68 (group :inline t | |
69 (const :format "" :value :volume) | |
70 (integer :tag "Volume")) | |
71 (group :inline t | |
72 (const :format "" :value :pitch) | |
73 (integer :tag "Pitch")) | |
74 (group :inline t | |
75 (const :format "" :value :duration) | |
76 (integer :tag "Duration")))))) | |
77 | |
78 (defcustom sound-load-alist | |
79 '((load-sound-file "sounds/drum-beep.au" 'drum) | |
80 (load-sound-file "sounds/quiet-beep.au" 'quiet) | |
81 (load-sound-file "sounds/bass-snap.au" 'bass 80) | |
82 (load-sound-file "sounds/whip.au" 'whip 70) | |
83 (load-sound-file "sounds/cuckoo.au" 'cuckoo) | |
84 (load-sound-file "sounds/yeep.au" 'yeep) | |
85 (load-sound-file "sounds/hype.au" 'hype 100) | |
86 ) | |
87 "A list of calls to load-sound-file to be processed by load-default-sounds. | |
88 | |
89 Reference load-sound-file for more information." | |
90 | |
91 :group 'sound | |
92 :type '(repeat (sexp :tag "Sound") | |
93 )) | |
94 | |
95 (defcustom default-sound-directory data-directory | |
96 "Default directory to load a sound file from." | |
97 :group 'sound | |
98 :type 'directory | |
99 ) | |
100 | |
101 (defcustom sound-ext "" | |
102 "Filename extensions to complet sound file name with. If more than one | |
103 extension is used, they should be separated by \":\". " | |
104 :group 'sound | |
105 :type 'string) | |
106 | |
107 (defcustom default-sound-directory-list ( list default-sound-directory ) | |
108 "List of directories which to search for sound files" | |
109 :group 'sound | |
110 :type '(repeat directory ) | |
111 ) | |
24 | 112 |
25 ;;;###autoload | 113 ;;;###autoload |
26 (or sound-alist | 114 (or sound-alist |
27 ;; these should be silent until sounds are loaded | 115 ;; these should be silent until sounds are loaded |
28 (setq sound-alist '((ready nil) (warp nil)))) | 116 (setq sound-alist '((ready nil) (warp nil)))) |
46 (unwind-protect | 134 (unwind-protect |
47 (save-excursion | 135 (save-excursion |
48 (set-buffer (setq buf (get-buffer-create " *sound-tmp*"))) | 136 (set-buffer (setq buf (get-buffer-create " *sound-tmp*"))) |
49 (buffer-disable-undo (current-buffer)) | 137 (buffer-disable-undo (current-buffer)) |
50 (erase-buffer) | 138 (erase-buffer) |
51 (insert-file-contents filename) | 139 (insert-file-contents |
140 (locate-file filename default-sound-directory-list sound-ext )) | |
52 (setq data (buffer-string)) | 141 (setq data (buffer-string)) |
53 (erase-buffer)) | 142 (erase-buffer)) |
54 (and buf (kill-buffer buf))) | 143 (and buf (kill-buffer buf))) |
55 (let ((old (assq sound-name sound-alist))) | 144 (let ((old (assq sound-name sound-alist))) |
56 ;; some conses in sound-alist might have been dumped with emacs. | 145 ;; some conses in sound-alist might have been dumped with emacs. |
72 server and XEmacs has the necessary sound support compiled in." | 161 server and XEmacs has the necessary sound support compiled in." |
73 (interactive) | 162 (interactive) |
74 ;; #### - this should do NOTHING if the sounds can't be played. | 163 ;; #### - this should do NOTHING if the sounds can't be played. |
75 (message "Loading sounds...") | 164 (message "Loading sounds...") |
76 (setq sound-alist nil) | 165 (setq sound-alist nil) |
77 (let ((default-directory data-directory)) | 166 ;; this is where the calls to load-sound-file get done |
78 (load-sound-file "sounds/drum-beep.au" 'drum) | 167 (mapc 'eval sound-load-alist) |
79 (load-sound-file "sounds/quiet-beep.au" 'quiet) | |
80 (load-sound-file "sounds/bass-snap.au" 'bass 80) | |
81 (load-sound-file "sounds/whip.au" 'whip 70) | |
82 (load-sound-file "sounds/cuckoo.au" 'cuckoo) | |
83 (load-sound-file "sounds/yeep.au" 'yeep) | |
84 (load-sound-file "sounds/hype.au" 'hype 100) | |
85 ) | |
86 (setq sound-alist | 168 (setq sound-alist |
87 (append | 169 (append sound-default-alist |
88 '((default :sound bass) | 170 sound-alist)) |
89 (undefined-key :sound drum) | |
90 (undefined-click :sound drum) | |
91 ;; beginning-of-buffer or end-of-buffer errors. | |
92 (buffer-bound :sound drum) | |
93 ;; buffer-read-only error | |
94 (read-only :sound drum) | |
95 ;; non-interactive function or lambda called | |
96 (command-error :sound bass) | |
97 (y-or-n-p :sound quiet) | |
98 (yes-or-no-p :sound quiet) | |
99 (auto-save-error :sound whip :volume 100) | |
100 (no-completion :sound whip) | |
101 (isearch-failed :sound quiet) | |
102 (isearch-quit :sound bass) | |
103 ;; QUIT: sound generated by ^G and it's variants. | |
104 (quit :sound quiet :volume 75) | |
105 ;; READY: time-consuming task has completed... compile, | |
106 ;; cvs-update, etc. | |
107 (ready :sound cuckoo) | |
108 ;; WARP: XEmacs has changed the selected-window or frame | |
109 ;; asynchronously... Especially when it's done by an | |
110 ;; asynchronous process filter. Perhaps by a debugger breakpoint | |
111 ;; has been hit? | |
112 (warp :sound yeep :volume 75) | |
113 ;; ALARM: used for reminders... | |
114 (alarm :sound cuckoo :volume 100) | |
115 ) | |
116 sound-alist)) | |
117 (message "Loading sounds...done") | 171 (message "Loading sounds...done") |
118 ;; (beep nil 'quiet) | 172 ;; (beep nil 'quiet) |
119 ) | 173 ) |
120 | 174 |
121 ;; sound.el ends here. | 175 ;; sound.el ends here. |