1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
\r
5 <!-- Generated by javadoc (build 1.4.2_16) on Mon Mar 09 18:20:29 CET 2009 -->
\r
7 JavaStreamingAudioPlayer (FreeTTS 1.2)
\r
10 <META NAME="keywords" CONTENT="com.sun.speech.freetts.audio.JavaStreamingAudioPlayer class">
\r
12 <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">
\r
14 <SCRIPT type="text/javascript">
\r
15 function windowTitle()
\r
17 parent.document.title="JavaStreamingAudioPlayer (FreeTTS 1.2)";
\r
23 <BODY BGCOLOR="white" onload="windowTitle();">
\r
26 <!-- ========= START OF TOP NAVBAR ======= -->
\r
27 <A NAME="navbar_top"><!-- --></A>
28 <A HREF="#skip-navbar_top" title="Skip navigation links"></A>
29 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
\r
31 <TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
\r
32 <A NAME="navbar_top_firstrow"><!-- --></A>
33 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
\r
34 <TR ALIGN="center" VALIGN="top">
\r
35 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
\r
36 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
\r
37 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
\r
38 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
\r
39 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
\r
40 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
\r
41 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
\r
45 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
\r
51 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
\r
52 <A HREF="../../../../../com/sun/speech/freetts/audio/JavaClipAudioPlayer.html" title="class in com.sun.speech.freetts.audio"><B>PREV CLASS</B></A>
\r
53 <A HREF="../../../../../com/sun/speech/freetts/audio/MultiFile8BitAudioPlayer.html" title="class in com.sun.speech.freetts.audio"><B>NEXT CLASS</B></A></FONT></TD>
\r
54 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
\r
55 <A HREF="../../../../../index.html" target="_top"><B>FRAMES</B></A>
\r
56 <A HREF="JavaStreamingAudioPlayer.html" target="_top"><B>NO FRAMES</B></A>
\r
57 <SCRIPT type="text/javascript">
\r
60 document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
\r
65 <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
\r
71 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
\r
72 SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
\r
73 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
\r
74 DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
\r
77 <A NAME="skip-navbar_top"></A>
78 <!-- ========= END OF TOP NAVBAR ========= -->
\r
81 <!-- ======== START OF CLASS DATA ======== -->
\r
84 com.sun.speech.freetts.audio</FONT>
\r
86 Class JavaStreamingAudioPlayer</H2>
\r
89 <IMG SRC="../../../../../resources/inherit.gif" ALT="extended by"><B>com.sun.speech.freetts.audio.JavaStreamingAudioPlayer</B>
\r
92 <DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html" title="interface in com.sun.speech.freetts.audio">AudioPlayer</A></DD>
\r
96 <DT>public class <B>JavaStreamingAudioPlayer</B><DT>extends java.lang.Object<DT>implements <A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html" title="interface in com.sun.speech.freetts.audio">AudioPlayer</A></DL>
\r
99 Streams audio to java audio. This class provides a low latency
100 method of sending audio output through the javax.sound audio API.
101 Audio data is sent in small sets to the audio system allowing it to
102 be played soon after it is generated.
104 Unfortunately, the current release of the JDK (JDK 1.4 beta 2) has
106 the implementation of 'SourceDataLine.drain'. A workaround solution that
107 sleep/waits on SourceDataLine.isActive is used here instead. To
108 disable the work around (i.e use the real 'drain') set the
112 com.sun.speech.freetts.audio.AudioPlayer.drainWorksProperly;
114 to <code>true</code>.
116 If the workaround is enabled, the line.isActive method will be
117 performed periodically. The period of the test can be controlled
122 com.sun.speech.freetts.audio.AudioPlayer.drainDelay"
131 com.sun.speech.freetts.audio.AudioPlayer.bufferSize"
135 Controls the audio buffer size, it defaults to 8192
138 Even with this drain work around, there are some issues with this
139 class. The workaround drain is not completely reliable.
140 A <code>resume</code> following a <code>pause</code> does not
141 always continue at the proper position in the audio. On a rare
142 occasion, sound output will be repeated a number of times. This may
143 be related to bug 4421330 in the Bug Parade database.
\r
150 <!-- ======== NESTED CLASS SUMMARY ======== -->
\r
153 <!-- =========== FIELD SUMMARY =========== -->
\r
156 <!-- ======== CONSTRUCTOR SUMMARY ======== -->
\r
158 <A NAME="constructor_summary"><!-- --></A>
159 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
\r
160 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
\r
161 <TD COLSPAN=2><FONT SIZE="+2">
\r
162 <B>Constructor Summary</B></FONT></TD>
\r
164 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
165 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/audio/JavaStreamingAudioPlayer.html#JavaStreamingAudioPlayer()">JavaStreamingAudioPlayer</A></B>()</CODE>
\r
168 Constructs a default JavaStreamingAudioPlayer</TD>
\r
172 <!-- ========== METHOD SUMMARY =========== -->
\r
174 <A NAME="method_summary"><!-- --></A>
175 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
\r
176 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
\r
177 <TD COLSPAN=2><FONT SIZE="+2">
\r
178 <B>Method Summary</B></FONT></TD>
\r
180 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
181 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
182 <CODE> void</CODE></FONT></TD>
\r
183 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/audio/JavaStreamingAudioPlayer.html#begin(int)">begin</A></B>(int size)</CODE>
\r
186 Starts the output of a set of data.
189 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
190 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
191 <CODE> void</CODE></FONT></TD>
\r
192 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/audio/JavaStreamingAudioPlayer.html#cancel()">cancel</A></B>()</CODE>
\r
195 Cancels currently playing audio.</TD>
\r
197 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
198 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
199 <CODE> void</CODE></FONT></TD>
\r
200 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/audio/JavaStreamingAudioPlayer.html#close()">close</A></B>()</CODE>
\r
203 Closes this audio player</TD>
\r
205 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
206 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
207 <CODE> boolean</CODE></FONT></TD>
\r
208 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/audio/JavaStreamingAudioPlayer.html#drain()">drain</A></B>()</CODE>
\r
211 Waits for all queued audio to be played</TD>
\r
213 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
214 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
215 <CODE> boolean</CODE></FONT></TD>
\r
216 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/audio/JavaStreamingAudioPlayer.html#end()">end</A></B>()</CODE>
\r
219 Marks the end of a set of data. </TD>
\r
221 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
222 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
223 <CODE> javax.sound.sampled.AudioFormat</CODE></FONT></TD>
\r
224 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/audio/JavaStreamingAudioPlayer.html#getAudioFormat()">getAudioFormat</A></B>()</CODE>
\r
227 Gets the audio format for this player</TD>
\r
229 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
230 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
231 <CODE> long</CODE></FONT></TD>
\r
232 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/audio/JavaStreamingAudioPlayer.html#getTime()">getTime</A></B>()</CODE>
\r
235 Gets the amount of played since the last mark</TD>
\r
237 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
238 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
239 <CODE> float</CODE></FONT></TD>
\r
240 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/audio/JavaStreamingAudioPlayer.html#getVolume()">getVolume</A></B>()</CODE>
\r
243 Returns the current volume.</TD>
\r
245 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
246 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
247 <CODE> void</CODE></FONT></TD>
\r
248 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/audio/JavaStreamingAudioPlayer.html#pause()">pause</A></B>()</CODE>
\r
251 Pauses audio output</TD>
\r
253 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
254 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
255 <CODE> void</CODE></FONT></TD>
\r
256 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/audio/JavaStreamingAudioPlayer.html#reset()">reset</A></B>()</CODE>
\r
259 Prepares for another batch of output. </TD>
\r
261 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
262 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
263 <CODE> void</CODE></FONT></TD>
\r
264 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/audio/JavaStreamingAudioPlayer.html#resetTime()">resetTime</A></B>()</CODE>
\r
267 Resets the audio clock</TD>
\r
269 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
270 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
271 <CODE> void</CODE></FONT></TD>
\r
272 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/audio/JavaStreamingAudioPlayer.html#resume()">resume</A></B>()</CODE>
\r
275 Resumes audio output</TD>
\r
277 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
278 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
279 <CODE> void</CODE></FONT></TD>
\r
280 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/audio/JavaStreamingAudioPlayer.html#setAudioFormat(javax.sound.sampled.AudioFormat)">setAudioFormat</A></B>(javax.sound.sampled.AudioFormat format)</CODE>
\r
283 Sets the audio format for this player</TD>
\r
285 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
286 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
287 <CODE> void</CODE></FONT></TD>
\r
288 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/audio/JavaStreamingAudioPlayer.html#setVolume(float)">setVolume</A></B>(float volume)</CODE>
\r
291 Sets the current volume.</TD>
\r
293 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
294 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
295 <CODE> void</CODE></FONT></TD>
\r
296 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/audio/JavaStreamingAudioPlayer.html#showMetrics()">showMetrics</A></B>()</CODE>
\r
299 Shows metrics for this audio player</TD>
\r
301 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
302 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
303 <CODE> void</CODE></FONT></TD>
\r
304 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/audio/JavaStreamingAudioPlayer.html#startFirstSampleTimer()">startFirstSampleTimer</A></B>()</CODE>
\r
307 Starts the first sample timer</TD>
\r
309 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
310 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
311 <CODE> java.lang.String</CODE></FONT></TD>
\r
312 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/audio/JavaStreamingAudioPlayer.html#toString()">toString</A></B>()</CODE>
\r
315 Returns the name of this audioplayer</TD>
\r
317 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
318 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
319 <CODE> boolean</CODE></FONT></TD>
\r
320 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/audio/JavaStreamingAudioPlayer.html#write(byte[])">write</A></B>(byte[] audioData)</CODE>
\r
323 Writes the given bytes to the audio stream</TD>
\r
325 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
326 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
\r
327 <CODE> boolean</CODE></FONT></TD>
\r
328 <TD><CODE><B><A HREF="../../../../../com/sun/speech/freetts/audio/JavaStreamingAudioPlayer.html#write(byte[], int, int)">write</A></B>(byte[] bytes,
330 int size)</CODE>
\r
333 Writes the given bytes to the audio stream</TD>
\r
336 <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
337 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
\r
338 <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
\r
339 <TD><B>Methods inherited from class java.lang.Object</B></TD>
\r
341 <TR BGCOLOR="white" CLASS="TableRowColor">
\r
342 <TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</CODE></TD>
\r
348 <!-- ============ FIELD DETAIL =========== -->
\r
351 <!-- ========= CONSTRUCTOR DETAIL ======== -->
\r
353 <A NAME="constructor_detail"><!-- --></A>
354 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
\r
355 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
\r
356 <TD COLSPAN=1><FONT SIZE="+2">
\r
357 <B>Constructor Detail</B></FONT></TD>
\r
361 <A NAME="JavaStreamingAudioPlayer()"><!-- --></A><H3>
\r
362 JavaStreamingAudioPlayer</H3>
\r
364 public <B>JavaStreamingAudioPlayer</B>()</PRE>
\r
366 <DD>Constructs a default JavaStreamingAudioPlayer
\r
370 <!-- ============ METHOD DETAIL ========== -->
\r
372 <A NAME="method_detail"><!-- --></A>
373 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
\r
374 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
\r
375 <TD COLSPAN=1><FONT SIZE="+2">
\r
376 <B>Method Detail</B></FONT></TD>
\r
380 <A NAME="setAudioFormat(javax.sound.sampled.AudioFormat)"><!-- --></A><H3>
\r
381 setAudioFormat</H3>
\r
383 public void <B>setAudioFormat</B>(javax.sound.sampled.AudioFormat format)</PRE>
\r
385 <DD>Sets the audio format for this player
\r
388 <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html#setAudioFormat(javax.sound.sampled.AudioFormat)">setAudioFormat</A></CODE> in interface <CODE><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html" title="interface in com.sun.speech.freetts.audio">AudioPlayer</A></CODE></DL>
\r
391 <DT><B>Parameters:</B><DD><CODE>format</CODE> - the audio format
393 <DD><CODE>java.lang.UnsupportedOperationException</CODE> - if the line cannot be opened with
394 the given format</DL>
\r
399 <A NAME="getAudioFormat()"><!-- --></A><H3>
\r
400 getAudioFormat</H3>
\r
402 public javax.sound.sampled.AudioFormat <B>getAudioFormat</B>()</PRE>
\r
404 <DD>Gets the audio format for this player
\r
407 <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html#getAudioFormat()">getAudioFormat</A></CODE> in interface <CODE><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html" title="interface in com.sun.speech.freetts.audio">AudioPlayer</A></CODE></DL>
\r
411 <DT><B>Returns:</B><DD>format the audio format</DL>
\r
416 <A NAME="startFirstSampleTimer()"><!-- --></A><H3>
\r
417 startFirstSampleTimer</H3>
\r
419 public void <B>startFirstSampleTimer</B>()</PRE>
\r
421 <DD>Starts the first sample timer
\r
424 <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html#startFirstSampleTimer()">startFirstSampleTimer</A></CODE> in interface <CODE><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html" title="interface in com.sun.speech.freetts.audio">AudioPlayer</A></CODE></DL>
\r
432 <A NAME="pause()"><!-- --></A><H3>
\r
435 public void <B>pause</B>()</PRE>
\r
437 <DD>Pauses audio output
\r
440 <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html#pause()">pause</A></CODE> in interface <CODE><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html" title="interface in com.sun.speech.freetts.audio">AudioPlayer</A></CODE></DL>
\r
448 <A NAME="resume()"><!-- --></A><H3>
\r
451 public void <B>resume</B>()</PRE>
\r
453 <DD>Resumes audio output
\r
456 <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html#resume()">resume</A></CODE> in interface <CODE><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html" title="interface in com.sun.speech.freetts.audio">AudioPlayer</A></CODE></DL>
\r
464 <A NAME="cancel()"><!-- --></A><H3>
\r
467 public void <B>cancel</B>()</PRE>
\r
469 <DD>Cancels currently playing audio.
\r
472 <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html#cancel()">cancel</A></CODE> in interface <CODE><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html" title="interface in com.sun.speech.freetts.audio">AudioPlayer</A></CODE></DL>
\r
480 <A NAME="reset()"><!-- --></A><H3>
\r
483 public void <B>reset</B>()</PRE>
\r
485 <DD>Prepares for another batch of output. Larger groups of output
486 (such as all output associated with a single FreeTTSSpeakable)
487 should be grouped between a reset/drain pair.
\r
490 <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html#reset()">reset</A></CODE> in interface <CODE><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html" title="interface in com.sun.speech.freetts.audio">AudioPlayer</A></CODE></DL>
\r
498 <A NAME="close()"><!-- --></A><H3>
\r
501 public void <B>close</B>()</PRE>
\r
503 <DD>Closes this audio player
\r
506 <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html#close()">close</A></CODE> in interface <CODE><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html" title="interface in com.sun.speech.freetts.audio">AudioPlayer</A></CODE></DL>
\r
514 <A NAME="getVolume()"><!-- --></A><H3>
\r
517 public float <B>getVolume</B>()</PRE>
\r
519 <DD>Returns the current volume.
\r
522 <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html#getVolume()">getVolume</A></CODE> in interface <CODE><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html" title="interface in com.sun.speech.freetts.audio">AudioPlayer</A></CODE></DL>
\r
526 <DT><B>Returns:</B><DD>the current volume (between 0 and 1)</DL>
\r
531 <A NAME="setVolume(float)"><!-- --></A><H3>
\r
534 public void <B>setVolume</B>(float volume)</PRE>
\r
536 <DD>Sets the current volume.
\r
539 <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html#setVolume(float)">setVolume</A></CODE> in interface <CODE><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html" title="interface in com.sun.speech.freetts.audio">AudioPlayer</A></CODE></DL>
\r
542 <DT><B>Parameters:</B><DD><CODE>volume</CODE> - the current volume (between 0 and 1)</DL>
\r
547 <A NAME="begin(int)"><!-- --></A><H3>
\r
550 public void <B>begin</B>(int size)</PRE>
\r
552 <DD>Starts the output of a set of data.
553 For this JavaStreamingAudioPlayer, it actually opens the audio line.
554 Since this is a streaming audio player, the <code>size</code>
555 parameter has no meaning and effect at all, so any value can be used.
556 Audio data for a single utterance should be grouped
557 between begin/end pairs.
\r
560 <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html#begin(int)">begin</A></CODE> in interface <CODE><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html" title="interface in com.sun.speech.freetts.audio">AudioPlayer</A></CODE></DL>
\r
563 <DT><B>Parameters:</B><DD><CODE>size</CODE> - supposedly the size of data between now and the end,
564 but since this is a streaming audio player, this parameter
565 has no meaning and effect at all</DL>
\r
570 <A NAME="end()"><!-- --></A><H3>
\r
573 public boolean <B>end</B>()</PRE>
\r
575 <DD>Marks the end of a set of data. Audio data for a single
576 utterance should be groupd between begin/end pairs.
\r
579 <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html#end()">end</A></CODE> in interface <CODE><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html" title="interface in com.sun.speech.freetts.audio">AudioPlayer</A></CODE></DL>
\r
583 <DT><B>Returns:</B><DD>true if the audio was output properly, false if the
584 output was cancelled or interrupted.</DL>
\r
589 <A NAME="drain()"><!-- --></A><H3>
\r
592 public boolean <B>drain</B>()</PRE>
\r
594 <DD>Waits for all queued audio to be played
\r
597 <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html#drain()">drain</A></CODE> in interface <CODE><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html" title="interface in com.sun.speech.freetts.audio">AudioPlayer</A></CODE></DL>
\r
601 <DT><B>Returns:</B><DD>true if the audio played to completion, false if
602 the audio was stopped
605 The javax.sound.sampled drain is almost working properly. On
606 linux, there is still a little bit of sound that needs to go
607 out, even after drain is called. Thus, the drainDelay. We
608 wait for a few hundred milliseconds while the data is really
609 drained out of the system
615 <A NAME="getTime()"><!-- --></A><H3>
\r
618 public long <B>getTime</B>()</PRE>
\r
620 <DD>Gets the amount of played since the last mark
\r
623 <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html#getTime()">getTime</A></CODE> in interface <CODE><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html" title="interface in com.sun.speech.freetts.audio">AudioPlayer</A></CODE></DL>
\r
627 <DT><B>Returns:</B><DD>the amount of audio in milliseconds</DL>
\r
632 <A NAME="resetTime()"><!-- --></A><H3>
\r
635 public void <B>resetTime</B>()</PRE>
\r
637 <DD>Resets the audio clock
\r
640 <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html#resetTime()">resetTime</A></CODE> in interface <CODE><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html" title="interface in com.sun.speech.freetts.audio">AudioPlayer</A></CODE></DL>
\r
648 <A NAME="write(byte[])"><!-- --></A><H3>
\r
651 public boolean <B>write</B>(byte[] audioData)</PRE>
\r
653 <DD>Writes the given bytes to the audio stream
\r
656 <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html#write(byte[])">write</A></CODE> in interface <CODE><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html" title="interface in com.sun.speech.freetts.audio">AudioPlayer</A></CODE></DL>
\r
659 <DT><B>Parameters:</B><DD><CODE>audioData</CODE> - audio data to write to the device
660 <DT><B>Returns:</B><DD><code>true</code> of the write completed successfully,
661 <code> false </code>if the write was cancelled.</DL>
\r
666 <A NAME="write(byte[], int, int)"><!-- --></A><H3>
\r
669 public boolean <B>write</B>(byte[] bytes,
671 int size)</PRE>
\r
673 <DD>Writes the given bytes to the audio stream
\r
676 <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html#write(byte[], int, int)">write</A></CODE> in interface <CODE><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html" title="interface in com.sun.speech.freetts.audio">AudioPlayer</A></CODE></DL>
\r
679 <DT><B>Parameters:</B><DD><CODE>bytes</CODE> - audio data to write to the device<DD><CODE>offset</CODE> - the offset into the buffer<DD><CODE>size</CODE> - the size into the buffer
680 <DT><B>Returns:</B><DD><code>true</code> of the write completed successfully,
681 <code> false </code>if the write was cancelled.</DL>
\r
686 <A NAME="toString()"><!-- --></A><H3>
\r
689 public java.lang.String <B>toString</B>()</PRE>
\r
691 <DD>Returns the name of this audioplayer
\r
698 <DT><B>Returns:</B><DD>the name of the audio player</DL>
\r
703 <A NAME="showMetrics()"><!-- --></A><H3>
\r
706 public void <B>showMetrics</B>()</PRE>
\r
708 <DD>Shows metrics for this audio player
\r
711 <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html#showMetrics()">showMetrics</A></CODE> in interface <CODE><A HREF="../../../../../com/sun/speech/freetts/audio/AudioPlayer.html" title="interface in com.sun.speech.freetts.audio">AudioPlayer</A></CODE></DL>
\r
717 <!-- ========= END OF CLASS DATA ========= -->
\r
721 <!-- ======= START OF BOTTOM NAVBAR ====== -->
\r
722 <A NAME="navbar_bottom"><!-- --></A>
723 <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
724 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
\r
726 <TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
\r
727 <A NAME="navbar_bottom_firstrow"><!-- --></A>
728 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
\r
729 <TR ALIGN="center" VALIGN="top">
\r
730 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
\r
731 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
\r
732 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
\r
733 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
\r
734 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
\r
735 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
\r
736 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
\r
740 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
\r
746 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
\r
747 <A HREF="../../../../../com/sun/speech/freetts/audio/JavaClipAudioPlayer.html" title="class in com.sun.speech.freetts.audio"><B>PREV CLASS</B></A>
\r
748 <A HREF="../../../../../com/sun/speech/freetts/audio/MultiFile8BitAudioPlayer.html" title="class in com.sun.speech.freetts.audio"><B>NEXT CLASS</B></A></FONT></TD>
\r
749 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
\r
750 <A HREF="../../../../../index.html" target="_top"><B>FRAMES</B></A>
\r
751 <A HREF="JavaStreamingAudioPlayer.html" target="_top"><B>NO FRAMES</B></A>
\r
752 <SCRIPT type="text/javascript">
\r
755 document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
\r
760 <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
\r
766 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
\r
767 SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
\r
768 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
\r
769 DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
\r
772 <A NAME="skip-navbar_bottom"></A>
773 <!-- ======== END OF BOTTOM NAVBAR ======= -->
\r