Mercurial > hg > xemacs-beta
comparison lisp/sound.el @ 458:c33ae14dd6d0 r21-2-44
Import from CVS: tag r21-2-44
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:42:25 +0200 |
parents | 576fb035e263 |
children | 7039e6323819 |
comparison
equal
deleted
inserted
replaced
457:4b9290a33024 | 458:c33ae14dd6d0 |
---|---|
104 :group 'sound | 104 :group 'sound |
105 :type 'directory | 105 :type 'directory |
106 ) | 106 ) |
107 | 107 |
108 ;; #### This should really be a list. --hniksic | 108 ;; #### This should really be a list. --hniksic |
109 (defcustom sound-extension-list (if (or (eq system-type 'cygwin32) | 109 (defcustom sound-extension-list (cond ((or (eq system-type 'cygwin32) |
110 (eq system-type 'windows-nt)) | 110 (eq system-type 'windows-nt)) |
111 ".wav:" ".au:") | 111 ".wav:") |
112 ((eq system-type 'linux) | |
113 ".wav:.au:") | |
114 (t | |
115 ".au:")) | |
112 "Filename extensions to complete sound file name with. If more than one | 116 "Filename extensions to complete sound file name with. If more than one |
113 extension is used, they should be separated by \":\". " | 117 extension is used, they should be separated by \":\". " |
114 :group 'sound | 118 :group 'sound |
115 :type 'string) | 119 :type 'string) |
116 | 120 |
117 (defcustom default-sound-directory-list (locate-data-directory-list "sounds") | 121 (defcustom default-sound-directory-list (locate-data-directory-list "sounds") |
118 | |
119 "List of directories which to search for sound files" | 122 "List of directories which to search for sound files" |
120 :group 'sound | 123 :group 'sound |
121 :type '(repeat directory ) | 124 :type '(repeat directory ) |
122 ) | 125 ) |
123 | 126 |
127 (setq sound-alist '((ready nil) (warp nil)))) | 130 (setq sound-alist '((ready nil) (warp nil)))) |
128 | 131 |
129 ;;;###autoload | 132 ;;;###autoload |
130 (defun load-sound-file (filename sound-name &optional volume) | 133 (defun load-sound-file (filename sound-name &optional volume) |
131 "Read in an audio-file and add it to the sound-alist. | 134 "Read in an audio-file and add it to the sound-alist. |
135 | |
136 FILENAME can either be absolute or relative, in which case the file will | |
137 be searched in the directories given by `default-sound-directory-list'. | |
138 When looking for the file, the extensions given by `sound-extension-list' are | |
139 also tried in the given order. | |
132 | 140 |
133 You can only play sound files if you are running on display 0 of the | 141 You can only play sound files if you are running on display 0 of the |
134 console of a machine with native sound support or running a NetAudio | 142 console of a machine with native sound support or running a NetAudio |
135 server and XEmacs has the necessary sound support compiled in. | 143 server and XEmacs has the necessary sound support compiled in. |
136 | 144 |
141 nVolume (0 for default): ") | 149 nVolume (0 for default): ") |
142 (unless (symbolp sound-name) | 150 (unless (symbolp sound-name) |
143 (error "sound-name not a symbol")) | 151 (error "sound-name not a symbol")) |
144 (unless (or (null volume) (integerp volume)) | 152 (unless (or (null volume) (integerp volume)) |
145 (error "volume not an integer or nil")) | 153 (error "volume not an integer or nil")) |
146 (let (buf | 154 (let ((file (if (file-name-absolute-p filename) |
147 data | 155 ;; For absolute file names, we don't have on choice on the |
148 (file (locate-file filename default-sound-directory-list | 156 ;; location, but sound extensions however can still be tried |
149 sound-extension-list))) | 157 (setq file (locate-file filename |
158 (list (file-name-directory filename)) | |
159 (split-string sound-extension-list | |
160 ":"))) | |
161 (setq file (locate-file filename | |
162 default-sound-directory-list | |
163 (split-string sound-extension-list | |
164 ":"))))) | |
165 buf data) | |
150 (unless file | 166 (unless file |
151 (error "Couldn't load sound file %s" filename)) | 167 (error "Couldn't load sound file %s" filename)) |
152 (unwind-protect | 168 (unwind-protect |
153 (save-excursion | 169 (save-excursion |
154 (set-buffer (setq buf (get-buffer-create " *sound-tmp*"))) | 170 (set-buffer (setq buf (get-buffer-create " *sound-tmp*"))) |