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