1 /*****************************************************/
\r
2 /* This java file is a part of the */
\r
4 /* - Plouf's Java IRC Client - */
\r
6 /* Copyright (C) 2002 - 2004 Philippe Detournay */
\r
8 /* All contacts : theplouf@yahoo.com */
\r
10 /* PJIRC is free software; you can redistribute */
\r
11 /* it and/or modify it under the terms of the GNU */
\r
12 /* General Public License as published by the */
\r
13 /* Free Software Foundation; version 2 or later of */
\r
16 /* PJIRC is distributed in the hope that it will */
\r
17 /* be useful, but WITHOUT ANY WARRANTY; without */
\r
18 /* even the implied warranty of MERCHANTABILITY or */
\r
19 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU */
\r
20 /* General Public License for more details. */
\r
22 /* You should have received a copy of the GNU */
\r
23 /* General Public License along with PJIRC; if */
\r
24 /* not, write to the Free Software Foundation, */
\r
25 /* Inc., 59 Temple Place, Suite 330, Boston, */
\r
26 /* MA 02111-1307 USA */
\r
28 /*****************************************************/
\r
32 import java.util.Enumeration;
\r
33 import java.util.Hashtable;
\r
36 * Audio configuration class.
\r
38 public class AudioConfiguration {
\r
39 private SoundHandler _sound;
\r
41 private String _query;
\r
42 private String _beep;
\r
43 private Hashtable _word;
\r
46 * Create a new AudioConfiguration, using the given SoundHandler.
\r
49 * the SoundHandler to use.
\r
51 public AudioConfiguration(SoundHandler sound) {
\r
55 _word = new Hashtable();
\r
59 * Play the given sound.
\r
62 * the sound to be played.
\r
64 public void play(String snd) {
\r
65 _sound.playSound(snd);
\r
69 * Set the query sound.
\r
74 public void setQuery(String snd) {
\r
79 * Set the beep sound.
\r
84 public void setBeep(String snd) {
\r
89 * Set the word sound.
\r
94 * the sound to play for the given word.
\r
96 public void setWord(String word, String snd) {
\r
97 _word.put(word, snd);
\r
101 * Play the sound associated with the new query.
\r
103 public void onQuery() {
\r
104 if (_query != null)
\r
105 _sound.playSound(_query);
\r
109 * Play the beep sound.
\r
111 public void beep() {
\r
113 _sound.playSound(_beep);
\r
117 * Play the word sound.
\r
120 * word sound to play.
\r
122 public void onWord(String word) {
\r
123 String snd = (String) _word.get(word);
\r
125 _sound.playSound(snd);
\r
129 * Get an enumeration of all know sound words.
\r
131 * @return an enumeration of string.
\r
133 public Enumeration getSoundWords() {
\r
134 return _word.keys();
\r