Mercurial > emacs
annotate lisp/gnus/gnus-audio.el @ 32097:adf341c172af
(vc-transfer-file, vc-default-receive-file): Rewritten to factorize
backend-specific code cleanly.
(vc-unregister): Function removed.
author | André Spiegel <spiegel@gnu.org> |
---|---|
date | Tue, 03 Oct 2000 12:24:15 +0000 |
parents | 9968f55ad26e |
children | bc12cef85a10 |
rev | line source |
---|---|
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 | |
6 ;; This file is part of GNU Emacs. | |
7 | |
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) | |
11 ;; any later version. | |
12 | |
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. | |
17 | |
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. | |
22 | |
23 ;;; Commentary: | |
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** | |
27 ;;; Code: | |
28 | |
29 (when (null (boundp 'running-xemacs)) | |
30 (defvar running-xemacs (string-match "XEmacs\\|Lucid" emacs-version))) | |
31 | |
32 (require 'nnheader) | |
33 (eval-when-compile (require 'cl)) | |
34 | |
35 (defvar gnus-audio-inline-sound | |
36 (and (fboundp 'device-sound-enabled-p) | |
37 (device-sound-enabled-p)) | |
38 "When t, we will not spawn a subprocess to play sounds.") | |
39 | |
40 (defvar gnus-audio-directory (nnheader-find-etc-directory "sounds") | |
41 "The directory containing the Sound Files.") | |
42 | |
43 (defvar gnus-audio-au-player "/usr/bin/showaudio" | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
44 "Executable program for playing sun AU format sound files.") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
45 |
17493 | 46 (defvar gnus-audio-wav-player "/usr/local/bin/play" |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
47 "Executable program for playing WAV files.") |
17493 | 48 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
17493
diff
changeset
|
49 ;;; The following isn't implemented yet. Wait for Millennium Gnus. |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
50 ;;(defvar gnus-audio-effects-enabled t |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
51 ;; "When t, Gnus will use sound effects.") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
52 ;;(defvar gnus-audio-enable-hooks nil |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
53 ;; "Functions run when enabling sound effects.") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
54 ;;(defvar gnus-audio-disable-hooks nil |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
55 ;; "Functions run when disabling sound effects.") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
56 ;;(defvar gnus-audio-theme-song nil |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
57 ;; "Theme song for Gnus.") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
58 ;;(defvar gnus-audio-enter-group nil |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
59 ;; "Sound effect played when selecting a group.") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
60 ;;(defvar gnus-audio-exit-group nil |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
61 ;; "Sound effect played when exiting a group.") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
62 ;;(defvar gnus-audio-score-group nil |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
63 ;; "Sound effect played when scoring a group.") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
64 ;;(defvar gnus-audio-busy-sound nil |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
65 ;; "Sound effect played when going into a ... sequence.") |
17493 | 66 |
67 | |
68 ;;;###autoload | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
69 ;;(defun gnus-audio-enable-sound () |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
70 ;; "Enable Sound Effects for Gnus." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
71 ;; (interactive) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
72 ;; (setq gnus-audio-effects-enabled t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
73 ;; (gnus-run-hooks gnus-audio-enable-hooks)) |
17493 | 74 |
75 ;;;###autoload | |
76 ;(defun gnus-audio-disable-sound () | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
77 ;; "Disable Sound Effects for Gnus." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
78 ;; (interactive) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
79 ;; (setq gnus-audio-effects-enabled nil) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
80 ;; (gnus-run-hooks gnus-audio-disable-hooks)) |
17493 | 81 |
82 ;;;###autoload | |
83 (defun gnus-audio-play (file) | |
84 "Play a sound through the speaker." | |
85 (interactive) | |
86 (let ((sound-file (if (file-exists-p file) | |
87 file | |
88 (concat gnus-audio-directory file)))) | |
89 (when (file-exists-p sound-file) | |
90 (if gnus-audio-inline-sound | |
91 (play-sound-file sound-file) | |
92 (cond ((string-match "\\.wav$" sound-file) | |
93 (call-process gnus-audio-wav-player | |
94 sound-file | |
95 0 | |
96 nil | |
97 sound-file)) | |
98 ((string-match "\\.au$" sound-file) | |
99 (call-process gnus-audio-au-player | |
100 sound-file | |
101 0 | |
102 nil | |
103 sound-file))))))) | |
104 | |
105 | |
106 ;;; The following isn't implemented yet, wait for Red Gnus | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
107 ;;(defun gnus-audio-startrek-sounds () |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
108 ;; "Enable sounds from Star Trek the original series." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
109 ;; (interactive) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
110 ;; (setq gnus-audio-busy-sound "working.au") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
111 ;; (setq gnus-audio-enter-group "bulkhead_door.au") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
112 ;; (setq gnus-audio-exit-group "bulkhead_door.au") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
113 ;; (setq gnus-audio-score-group "ST_laser.au") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
114 ;; (setq gnus-audio-theme-song "startrek.au") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
115 ;; (add-hook 'gnus-select-group-hook 'gnus-audio-startrek-select-group) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
116 ;; (add-hook 'gnus-exit-group-hook 'gnus-audio-startrek-exit-group)) |
17493 | 117 ;;;*** |
118 | |
119 (defvar gnus-startup-jingle "Tuxedomoon.Jingle4.au" | |
120 "Name of the Gnus startup jingle file.") | |
121 | |
122 (defun gnus-play-jingle () | |
123 "Play the Gnus startup jingle, unless that's inhibited." | |
124 (interactive) | |
125 (gnus-audio-play gnus-startup-jingle)) | |
126 | |
127 (provide 'gnus-audio) | |
128 | |
129 (run-hooks 'gnus-audio-load-hook) | |
130 | |
131 ;;; gnus-audio.el ends here |