2 * Copyright 2001 Sun Microsystems, Inc.
4 * See the file "license.terms" for information on usage and
5 * redistribution of this file, and for a DISCLAIMER OF ALL
8 import javax.swing.ListModel;
9 import javax.speech.synthesis.SynthesizerModeDesc;
12 * Defines the data model used by the GUI of the <code>Player</code>.
13 * Defines ways to control volume, speaking rate, pitch and range, etc..
14 * Also gives you information such as the list of <code>Synthesizers</code>,
15 * list of <code>Voices</code>, the play list, etc., that the user interface
16 * will need. Also allows you to get and play different types of
17 * <code>Playable</code> objects.
19 public interface PlayerModel {
22 * Performs text-to-speech on the given Playable.
24 * @param Playable the Playable to perform text-to-speech
26 public void play(Playable Playable);
30 * Performs text-to-speech on the object at the given index of
33 * @param index the index of the Playable object on the play list
35 public void play(int index);
39 * Returns true if the player is paused.
41 * @return <code>true</code> if the player is paused,
42 * <code>false</code> otherwise
44 public boolean isPaused();
60 * Stops the player if it is playing.
66 * Cancels the currently playing item.
72 * Sets whether the Monitor is visible.
74 * @param visible true to set it to visible
76 public void setMonitorVisible(boolean visible);
80 * Tells whether the monitor is visible.
82 * @return true if the monitor is visible, false otherwise
84 public boolean isMonitorVisible();
88 * Creates the list of synthesizers.
90 public void createSynthesizers();
94 * Returns the monitor of the synthesizer at the given index.
96 * @param index the position of the synthesizer in the synthesizer list
98 * @return the monitor of the specified synthesizer
100 public Monitor getMonitor(int index);
104 * Returns the monitor of the current synthesizer.
106 * @return the monitor of the current synthesizer
108 public Monitor getMonitor();
112 * Sets the current monitor.
114 * @param monitor the current monitor
116 public void setMonitor(Monitor monitor);
120 * Sets the Synthesizer at the given index to use
122 * @param index index of the synthesizer in the list
124 public void setSynthesizer(int index);
128 * Sets the Voice at the given index to use.
130 * @param index the index of the voice in the list
132 public void setVoice(int index);
136 * Sets the list of voices using the given Synthesizer mode description.
138 * @param modeDesc the synthesizer mode description
140 public void setVoiceList(SynthesizerModeDesc modeDesc);
144 * Returns the volume.
146 * @return the volume, or -1 if unknown, or an error occurred
148 public float getVolume();
154 * @param volume set the volume of the synthesizer
156 * @return true if new volume is set; false otherwise
158 public boolean setVolume(float volume);
162 * Returns the speaking rate.
164 * @return the speaking rate, or -1 if unknown or an error occurred
166 public float getSpeakingRate();
170 * Sets the speaking rate in the number of words per minute.
172 * @param wordsPerMin the speaking rate
174 * @return true if new speaking rate is set; false otherwise
176 public boolean setSpeakingRate(float wordsPerMin);
180 * Returns the baseline pitch for the current synthesis voice.
182 * @return the baseline pitch for the current synthesis voice
184 public float getPitch();
188 * Sets the baseline pitch for the current synthesis voice.
190 * @param pitch the baseline pitch
192 * @return true if new pitch is set; false otherwise
194 public boolean setPitch(float pitch);
198 * Returns the pitch range for the current synthesis voice.
200 * @return the pitch range for the current synthesis voice
202 public float getRange();
206 * Sets the pitch range for the current synthesis voice.
208 * @param range the pitch range
210 * @return true if new range is set; false otherwise
212 public boolean setRange(float range);
216 * Returns the play list.
218 * @return the play list
220 public ListModel getPlayList();
224 * Returns the list of voices of the current synthesizer
226 * @return the list of voices
228 public ListModel getVoiceList();
232 * Returns the list synthesizers.
234 * @return the synthesizer list
236 public ListModel getSynthesizerList();
240 * Returns the Playable object at the given index of the play list.
242 * @param index the index of the Playable object on the play list
244 * @return the Playable object
246 public Object getPlayableAt(int index);
250 * Adds the given Playable object to the end of the play list.
252 * @param Playable the Playable object to add
254 public void addPlayable(Playable Playable);
258 * Removes the Playable at the given position from the list
260 * @param index the index of the Playable to remove
262 public void removePlayableAt(int index);
266 * Closes the PlayerModel