1 ;;; gnus-audio.el --- Sound effects for Gnus
2 ;; Copyright (C) 1996 Free Software Foundation
4 ;; Author: Steven L. Baur <steve@miranova.com>
6 ;; This file is part of GNU Emacs.
8 ;; GNU Emacs is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; GNU Emacs is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GNU Emacs; see the file COPYING. If not, write to the
20 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 ;; Boston, MA 02111-1307, USA.
24 ;; This file provides access to sound effects in Gnus.
25 ;; Prerelease: This file is partially stripped to support earcons.el
26 ;; You can safely ignore most of it until Red Gnus. **Evil Laugh**
30 (eval-when-compile (require 'cl))
32 (defvar gnus-audio-inline-sound
33 (and (fboundp 'device-sound-enabled-p)
34 (device-sound-enabled-p))
35 "When t, we will not spawn a subprocess to play sounds.")
37 (defvar gnus-audio-directory (nnheader-find-etc-directory "sounds")
38 "The directory containing the Sound Files.")
40 (defvar gnus-audio-au-player "/usr/bin/showaudio"
41 "Executable program for playing sun AU format sound files.")
43 (defvar gnus-audio-wav-player "/usr/local/bin/play"
44 "Executable program for playing WAV files.")
46 ;;; The following isn't implemented yet. Wait for Millennium Gnus.
47 ;;(defvar gnus-audio-effects-enabled t
48 ;; "When t, Gnus will use sound effects.")
49 ;;(defvar gnus-audio-enable-hooks nil
50 ;; "Functions run when enabling sound effects.")
51 ;;(defvar gnus-audio-disable-hooks nil
52 ;; "Functions run when disabling sound effects.")
53 ;;(defvar gnus-audio-theme-song nil
54 ;; "Theme song for Gnus.")
55 ;;(defvar gnus-audio-enter-group nil
56 ;; "Sound effect played when selecting a group.")
57 ;;(defvar gnus-audio-exit-group nil
58 ;; "Sound effect played when exiting a group.")
59 ;;(defvar gnus-audio-score-group nil
60 ;; "Sound effect played when scoring a group.")
61 ;;(defvar gnus-audio-busy-sound nil
62 ;; "Sound effect played when going into a ... sequence.")
66 ;;(defun gnus-audio-enable-sound ()
67 ;; "Enable Sound Effects for Gnus."
69 ;; (setq gnus-audio-effects-enabled t)
70 ;; (gnus-run-hooks gnus-audio-enable-hooks))
73 ;(defun gnus-audio-disable-sound ()
74 ;; "Disable Sound Effects for Gnus."
76 ;; (setq gnus-audio-effects-enabled nil)
77 ;; (gnus-run-hooks gnus-audio-disable-hooks))
80 (defun gnus-audio-play (file)
81 "Play a sound through the speaker."
83 (let ((sound-file (if (file-exists-p file)
85 (concat gnus-audio-directory file))))
86 (when (file-exists-p sound-file)
87 (if gnus-audio-inline-sound
88 (play-sound-file sound-file)
89 (cond ((string-match "\\.wav$" sound-file)
90 (call-process gnus-audio-wav-player
95 ((string-match "\\.au$" sound-file)
96 (call-process gnus-audio-au-player
103 ;;; The following isn't implemented yet, wait for Red Gnus
104 ;;(defun gnus-audio-startrek-sounds ()
105 ;; "Enable sounds from Star Trek the original series."
107 ;; (setq gnus-audio-busy-sound "working.au")
108 ;; (setq gnus-audio-enter-group "bulkhead_door.au")
109 ;; (setq gnus-audio-exit-group "bulkhead_door.au")
110 ;; (setq gnus-audio-score-group "ST_laser.au")
111 ;; (setq gnus-audio-theme-song "startrek.au")
112 ;; (add-hook 'gnus-select-group-hook 'gnus-audio-startrek-select-group)
113 ;; (add-hook 'gnus-exit-group-hook 'gnus-audio-startrek-exit-group))
116 (defvar gnus-startup-jingle "Tuxedomoon.Jingle4.au"
117 "Name of the Gnus startup jingle file.")
119 (defun gnus-play-jingle ()
120 "Play the Gnus startup jingle, unless that's inhibited."
122 (gnus-audio-play gnus-startup-jingle))
124 (provide 'gnus-audio)
126 (run-hooks 'gnus-audio-load-hook)
128 ;;; gnus-audio.el ends here