upstream version 1.2.2
[debian/freetts] / demo / JSAPI / Player / PlayerModel.java
1 /**
2  * Copyright 2001 Sun Microsystems, Inc.
3  * 
4  * See the file "license.terms" for information on usage and
5  * redistribution of this file, and for a DISCLAIMER OF ALL 
6  * WARRANTIES.
7  */
8 import javax.swing.ListModel;
9 import javax.speech.synthesis.SynthesizerModeDesc;
10
11 /**
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.
18  */
19 public interface PlayerModel {
20
21     /**
22      * Performs text-to-speech on the given Playable.
23      *
24      * @param Playable the Playable to perform text-to-speech
25      */
26     public void play(Playable Playable);
27
28
29     /**
30      * Performs text-to-speech on the object at the given index of
31      * the play list.
32      *
33      * @param index the index of the Playable object on the play list
34      */
35     public void play(int index);
36
37
38     /**
39      * Returns true if the player is paused.
40      *
41      * @return <code>true</code> if the player is paused,
42      *         <code>false</code> otherwise
43      */
44     public boolean isPaused();
45
46     
47     /**
48      * Pauses the player.
49      */
50     public void pause();
51     
52
53     /**
54      * Resumes the player.
55      */
56     public void resume();
57         
58
59     /**
60      * Stops the player if it is playing.
61      */
62     public void stop();
63
64
65     /**
66      * Cancels the currently playing item.
67      */
68     public void cancel();
69
70
71     /**
72      * Sets whether the Monitor is visible.
73      *
74      * @param visible true to set it to visible
75      */
76     public void setMonitorVisible(boolean visible);
77
78
79     /**
80      * Tells whether the monitor is visible.
81      *
82      * @return true if the monitor is visible, false otherwise
83      */
84     public boolean isMonitorVisible();
85
86
87     /**
88      * Creates the list of synthesizers.
89      */
90     public void createSynthesizers();
91      
92
93     /**
94      * Returns the monitor of the synthesizer at the given index.
95      *
96      * @param index the position of the synthesizer in the synthesizer list
97      *
98      * @return the monitor of the specified synthesizer
99      */
100     public Monitor getMonitor(int index);
101
102
103     /**
104      * Returns the monitor of the current synthesizer.
105      *
106      * @return the monitor of the current synthesizer
107      */
108     public Monitor getMonitor();
109
110
111     /**
112      * Sets the current monitor.
113      *
114      * @param monitor the current monitor
115      */
116     public void setMonitor(Monitor monitor);
117
118
119     /**
120      * Sets the Synthesizer at the given index to use
121      *
122      * @param index index of the synthesizer in the list
123      */
124     public void setSynthesizer(int index);
125
126     
127     /**
128      * Sets the Voice at the given index to use.
129      *
130      * @param index the index of the voice in the list
131      */
132     public void setVoice(int index);
133
134         
135     /**
136      * Sets the list of voices using the given Synthesizer mode description.
137      *
138      * @param modeDesc the synthesizer mode description
139      */
140     public void setVoiceList(SynthesizerModeDesc modeDesc);
141
142
143     /**
144      * Returns the volume.
145      *
146      * @return the volume, or -1 if unknown, or an error occurred
147      */
148     public float getVolume();
149
150     
151     /**
152      * Sets the volume.
153      *
154      * @param volume set the volume of the synthesizer
155      *
156      * @return true if new volume is set; false otherwise
157      */
158     public boolean setVolume(float volume);
159
160
161     /**
162      * Returns the speaking rate.
163      *
164      * @return the speaking rate, or -1 if unknown or an error occurred
165      */
166     public float getSpeakingRate();
167
168     
169     /**
170      * Sets the speaking rate in the number of words per minute.
171      *
172      * @param wordsPerMin the speaking rate
173      *
174      * @return true if new speaking rate is set; false otherwise
175      */
176     public boolean setSpeakingRate(float wordsPerMin);
177
178
179     /**
180      * Returns the baseline pitch for the current synthesis voice.
181      *
182      * @return the baseline pitch for the current synthesis voice
183      */
184     public float getPitch();
185
186
187     /**
188      * Sets the baseline pitch for the current synthesis voice.
189      *
190      * @param pitch the baseline pitch
191      *
192      * @return true if new pitch is set; false otherwise
193      */
194     public boolean setPitch(float pitch);
195
196     
197     /**
198      * Returns the pitch range for the current synthesis voice.
199      *
200      * @return the pitch range for the current synthesis voice
201      */
202     public float getRange();
203
204
205     /**
206      * Sets the pitch range for the current synthesis voice.
207      *
208      * @param range the pitch range
209      *
210      * @return true if new range is set; false otherwise
211      */
212     public boolean setRange(float range);
213
214          
215     /**
216      * Returns the play list.
217      *
218      * @return the play list
219      */
220     public ListModel getPlayList();
221
222
223     /**
224      * Returns the list of voices of the current synthesizer
225      *
226      * @return the list of voices
227      */
228     public ListModel getVoiceList();
229
230     
231     /**
232      * Returns the list synthesizers.
233      *
234      * @return the synthesizer list
235      */
236     public ListModel getSynthesizerList();
237     
238
239     /**
240      * Returns the Playable object at the given index of the play list.
241      *
242      * @param index the index of the Playable object on the play list
243      *
244      * @return the Playable object
245      */
246     public Object getPlayableAt(int index);
247
248
249     /**
250      * Adds the given Playable object to the end of the play list.
251      *
252      * @param Playable the Playable object to add
253      */
254     public void addPlayable(Playable Playable);
255
256
257     /**
258      * Removes the Playable at the given position from the list
259      *
260      * @param index the index of the Playable to remove
261      */
262     public void removePlayableAt(int index);
263
264
265     /**
266      * Closes the PlayerModel
267      */
268     public void close();
269 }