Commits

Anonymous committed 1806327

make advocacy.el sound work on MS Windows

Comments (0)

Files changed (3)

+1999-03-05  Adrian Aichner  <aichner@ecf.teradyne.com>
+
+	* advocacy.el (xemacs-praise-sound-file): Don't use
+	sound-extention to keep the value platform-independant.
+	(praise-be-unto-xemacs): Find correct extention for
+	`xemacs-praise-sound-file' in 'sound-extension-list for the given
+	platform and play the file if present.
+	This patch was originally conceived by Charles G. Waldman.
+
+1999-03-06  SL Baur  <steve@gneiss.etl.go.jp>
+
+	* advocacy.el (xemacs-praise-sound-file):
+	(praise-be-unto-xemacs):  Revert change from 4-March.
+
 1999-03-04  Adrian Aichner  <aichner@ecf.teradyne.com>
 
 	* advocacy.el (xemacs-praise-sound-file): Initialize correctly for
 
 # This XEmacs package contains independent single file lisp packages
 
-VERSION = 1.10
+VERSION = 1.11
 AUTHOR_VERSION =
 MAINTAINER = XEmacs Development Team <xemacs-beta@xemacs.org>
 PACKAGE = misc-games
 ;; Boston, MA 02111-1307, USA.
 
 ;;;###autoload
-(defvar xemacs-praise-sound-file
-  (cond
-   ((eq (console-type) 'x)
-    "im_so_happy.au")
-   ((eq (console-type) 'mswindows)
-    "im_so_happy.wav"))
+(defvar xemacs-praise-sound-file "im_so_happy"
   "The name of an audio file containing something to play
 when praising XEmacs")
 
             (let ((p (point)))
               (insert "\n")
               (indent-to (startup-center-spaces xemacs-logo))
-              (set-extent-begin-glyph (make-extent (point) (point)) xemacs-logo)
+              (set-extent-begin-glyph 
+	       (make-extent (point) (point)) xemacs-logo)
               (insert "\n\n")))
 	(while (> count 0)
 	  (progn
 	    (insert-face xemacs-praise-message
 			 (get-face (nth (random max-faces) (face-list))))
 	    (setq count (- count 1))))))
-    (let ((sound-file
-	   (or (and (file-exists-p xemacs-praise-sound-file)
-		    xemacs-praise-sound-file)
-	       (and (file-exists-p
-		     (concat (locate-data-directory "sounds")
-			     xemacs-praise-sound-file))
-		    (concat (locate-data-directory "sounds")
-			    xemacs-praise-sound-file)))))
-      (if (and (device-sound-enabled-p) sound-file)
-	  (progn
-	    (play-sound-file sound-file)
-	    (sit-for 5))
-	(sit-for 5)))))
+    (when (load-library "sound")
+      (let ((sound-file xemacs-praise-sound-file)
+	    (extensions (split-string sound-extension-list ":"))
+	    (data-dir (locate-data-directory "sounds")))
+	(while (and (not (file-exists-p sound-file))
+		    (not (file-exists-p (concat data-dir sound-file)))
+		    extensions)
+	  (setq sound-file (concat xemacs-praise-sound-file (car extensions))
+		extensions (cdr extensions)))
+	(setq sound-file
+	      (or (and (file-exists-p sound-file)
+		       sound-file)
+		  (and (file-exists-p
+			(concat data-dir sound-file))
+		       (concat data-dir sound-file))))
+	(if (and (device-sound-enabled-p) sound-file)
+	    (progn
+	      (sit-for 0)
+	      (play-sound-file sound-file)
+	      (wait-for-sounds)))))
+    (sit-for 10)))
 
 ;;;###autoload
 (defun praise-be-unto-emacs (&optional arg)