📄 sourcedataline.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Thu Apr 27 23:37:55 PDT 2000 --><TITLE>Java 2 Platform SE v1.3: Interface SourceDataLine</TITLE><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"></HEAD><BODY BGCOLOR="white"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/SourceDataLine.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Std. Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../javax/sound/sampled/Port.html"><B>PREV CLASS</B></A> <A HREF="../../../javax/sound/sampled/TargetDataLine.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="SourceDataLine.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">javax.sound.sampled</FONT><BR>Interface SourceDataLine</H2><DL><DT><B>All Superinterfaces:</B> <DD><A HREF="../../../javax/sound/sampled/DataLine.html">DataLine</A>, <A HREF="../../../javax/sound/sampled/Line.html">Line</A></DD></DL><HR><DL><DT>public interface <B>SourceDataLine</B><DT>extends <A HREF="../../../javax/sound/sampled/DataLine.html">DataLine</A></DL><P>A source data line is a data line to which data may be written. It acts as a source to its mixer. An application writes audio bytes to a source data line, which handles the buffering of the bytes and delivers them to the mixer. The mixer may mix the samples with those from other sources and then deliver the mix to a target such as an output port (which may represent an audio output device on a sound card). <p> Note that the naming convention for this interface reflects the relationship between the line and its mixer. From the perspective of an application, a source data line may act as a target for audio data. <p> A source data line can be obtained from a mixer by invoking the <code><A HREF="../../../javax/sound/sampled/Mixer.html#getLine(javax.sound.sampled.Line.Info)"><CODE>getLine</CODE></A></code> method of <code>Mixer</code> with an appropriate <code><A HREF="../../../javax/sound/sampled/DataLine.Info.html"><CODE>DataLine.Info</CODE></A></code> object. <p> The <code>SourceDataLine</code> interface provides a method for writing audio data to the data line's buffer. Applications that play or mix audio should write data to the source data line quickly enough to keep the buffer from underflowing (emptying), which could cause discontinuities in the audio that are perceived as clicks. Applications can use the <code><A HREF="../../../javax/sound/sampled/DataLine.html#available()"><CODE>available</CODE></A></code> method defined in the <code>DataLine</code> interface to determine the amount of data currently queued in the data line's buffer. The amount of data which can be written to the buffer without blocking is the difference between the buffer size and the amount of queued data. If the delivery of audio output stops due to underflow, a <code><A HREF="../../../javax/sound/sampled/LineEvent.Type.html#STOP"><CODE>STOP</CODE></A></code> event is generated. A <code><A HREF="../../../javax/sound/sampled/LineEvent.Type.html#START"><CODE>START</CODE></A></code> event is generated when the audio output resumes.<P><DL><DT><B>Since: </B><DD>1.3</DD><DT><B>See Also: </B><DD><A HREF="../../../javax/sound/sampled/Mixer.html"><CODE>Mixer</CODE></A>, <A HREF="../../../javax/sound/sampled/DataLine.html"><CODE>DataLine</CODE></A>, <A HREF="../../../javax/sound/sampled/TargetDataLine.html"><CODE>TargetDataLine</CODE></A></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><A NAME="inner_classes_inherited_from_class_javax.sound.sampled.DataLine"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Inner classes inherited from class javax.sound.sampled.<A HREF="../../../javax/sound/sampled/DataLine.html">DataLine</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../../javax/sound/sampled/DataLine.Info.html">DataLine.Info</A></CODE></TD></TR></TABLE> <A NAME="inner_classes_inherited_from_class_javax.sound.sampled.Line"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Inner classes inherited from class javax.sound.sampled.<A HREF="../../../javax/sound/sampled/Line.html">Line</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../../javax/sound/sampled/Line.Info.html">Line.Info</A></CODE></TD></TR></TABLE> <!-- =========== FIELD SUMMARY =========== --><!-- ======== CONSTRUCTOR SUMMARY ======== --><!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/sound/sampled/SourceDataLine.html#open(javax.sound.sampled.AudioFormat)">open</A></B>(<A HREF="../../../javax/sound/sampled/AudioFormat.html">AudioFormat</A> format)</CODE><BR> Opens the line with the specified format, causing the line to acquire any required system resources and become operational.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/sound/sampled/SourceDataLine.html#open(javax.sound.sampled.AudioFormat, int)">open</A></B>(<A HREF="../../../javax/sound/sampled/AudioFormat.html">AudioFormat</A> format, int bufferSize)</CODE><BR> Opens the line with the specified format and suggested buffer size, causing the line to acquire any required system resources and become operational.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/sound/sampled/SourceDataLine.html#write(byte[], int, int)">write</A></B>(byte[] b, int off, int len)</CODE><BR> Writes audio data to the mixer via this source data line.</TD></TR></TABLE> <A NAME="methods_inherited_from_class_javax.sound.sampled.DataLine"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from interface javax.sound.sampled.<A HREF="../../../javax/sound/sampled/DataLine.html">DataLine</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../../javax/sound/sampled/DataLine.html#available()">available</A>, <A HREF="../../../javax/sound/sampled/DataLine.html#drain()">drain</A>, <A HREF="../../../javax/sound/sampled/DataLine.html#flush()">flush</A>, <A HREF="../../../javax/sound/sampled/DataLine.html#getBufferSize()">getBufferSize</A>, <A HREF="../../../javax/sound/sampled/DataLine.html#getFormat()">getFormat</A>, <A HREF="../../../javax/sound/sampled/DataLine.html#getFramePosition()">getFramePosition</A>, <A HREF="../../../javax/sound/sampled/DataLine.html#getLevel()">getLevel</A>, <A HREF="../../../javax/sound/sampled/DataLine.html#getMicrosecondPosition()">getMicrosecondPosition</A>, <A HREF="../../../javax/sound/sampled/DataLine.html#isActive()">isActive</A>, <A HREF="../../../javax/sound/sampled/DataLine.html#isRunning()">isRunning</A>, <A HREF="../../../javax/sound/sampled/DataLine.html#start()">start</A>, <A HREF="../../../javax/sound/sampled/DataLine.html#stop()">stop</A></CODE></TD></TR></TABLE> <A NAME="methods_inherited_from_class_javax.sound.sampled.Line"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from interface javax.sound.sampled.<A HREF="../../../javax/sound/sampled/Line.html">Line</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../../javax/sound/sampled/Line.html#addLineListener(javax.sound.sampled.LineListener)">addLineListener</A>, <A HREF="../../../javax/sound/sampled/Line.html#close()">close</A>, <A HREF="../../../javax/sound/sampled/Line.html#getControl(javax.sound.sampled.Control.Type)">getControl</A>, <A HREF="../../../javax/sound/sampled/Line.html#getControls()">getControls</A>, <A HREF="../../../javax/sound/sampled/Line.html#getLineInfo()">getLineInfo</A>, <A HREF="../../../javax/sound/sampled/Line.html#isControlSupported(javax.sound.sampled.Control.Type)">isControlSupported</A>, <A HREF="../../../javax/sound/sampled/Line.html#isOpen()">isOpen</A>, <A HREF="../../../javax/sound/sampled/Line.html#open()">open</A>, <A HREF="../../../javax/sound/sampled/Line.html#removeLineListener(javax.sound.sampled.LineListener)">removeLineListener</A></CODE></TD></TR></TABLE> <P>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -