annotate lisp/gnus/gnus-audio.el @ 120:cca96a509cfe r20-1b12

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