📄 line.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:54 PDT 2000 --><TITLE>Java 2 Platform SE v1.3: Interface Line</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/Line.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/DataLine.html"><B>PREV CLASS</B></A> <A HREF="../../../javax/sound/sampled/LineListener.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="Line.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: <A HREF="#inner_class_summary">INNER</A> | 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 Line</H2><DL><DT><B>All Known Subinterfaces:</B> <DD><A HREF="../../../javax/sound/sampled/Clip.html">Clip</A>, <A HREF="../../../javax/sound/sampled/DataLine.html">DataLine</A>, <A HREF="../../../javax/sound/sampled/Mixer.html">Mixer</A>, <A HREF="../../../javax/sound/sampled/Port.html">Port</A>, <A HREF="../../../javax/sound/sampled/SourceDataLine.html">SourceDataLine</A>, <A HREF="../../../javax/sound/sampled/TargetDataLine.html">TargetDataLine</A></DD></DL><HR><DL><DT>public interface <B>Line</B></DL><P>The <code>Line</code> interface represents a mono or multi-channel audio feed. A line is an element of the digital audio "pipeline," such as a mixer, an input or output port, or a data path into or out of a mixer. <p> A line can have controls, such as gain, pan, and reverb. The controls themselves are instances of classes that extend the base <code><A HREF="../../../javax/sound/sampled/Control.html"><CODE>Control</CODE></A></code> class. The <code>Line</code> interface provides two accessor methods for obtaining the line's controls: <code><A HREF="../../../javax/sound/sampled/Line.html#getControls()"><CODE>getControls</CODE></A></code> returns the entire set, and <code><A HREF="../../../javax/sound/sampled/Line.html#getControl(javax.sound.sampled.Control.Type)"><CODE>getControl</CODE></A></code> returns a single control of specified type. <p> Lines exist in various states at different times. When a line opens, it reserves system resources for itself, and when it closes, these resources are freed for other objects or applications. The <code><A HREF="../../../javax/sound/sampled/Line.html#isOpen()"><CODE>isOpen()</CODE></A></code> method lets you discover whether a line is open or closed. An open line need not be processing data, however. Such processing is typically initiated by subinterface methods such as <code><A HREF="../../../javax/sound/sampled/SourceDataLine.html#write(byte[], int, int)"><CODE>SourceDataLine.write</CODE></A></code> and <code><A HREF="../../../javax/sound/sampled/TargetDataLine.html#read(byte[], int, int)"><CODE>TargetDataLine.read</CODE></A></code>.<p> You can register an object to receive notifications whenever the line's state changes. The object must implement the <code><A HREF="../../../javax/sound/sampled/LineListener.html"><CODE>LineListener</CODE></A></code> interface, which consists of the single method <code><A HREF="../../../javax/sound/sampled/LineListener.html#update(javax.sound.sampled.LineEvent)"><CODE>update</CODE></A></code>. This method will be invoked when a line opens and closes (and, if it's a <A HREF="../../../javax/sound/sampled/DataLine.html"><CODE>DataLine</CODE></A>, when it starts and stops). <p> An object can be registered to listen to multiple lines. The event it receives in its <code>update</code> method will specify which line created the event, what type of event it was (<code>OPEN</code>, <code>CLOSE</code>, <code>START</code>, or <code>STOP</code>), and how many sample frames the line had processed at the time the event occurred. <p> Certain line operations, such as open and close, can generate security exceptions if invoked by unprivileged code when the line is a shared audio resource.<P><DL><DT><B>Since: </B><DD>1.3</DD><DT><B>See Also: </B><DD><A HREF="../../../javax/sound/sampled/LineEvent.html"><CODE>LineEvent</CODE></A></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><A NAME="inner_class_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Inner Class Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static class</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/sound/sampled/Line.Info.html">Line.Info</A></B></CODE><BR> A <code>Line.Info</code> object contains information about a line.</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/Line.html#addLineListener(javax.sound.sampled.LineListener)">addLineListener</A></B>(<A HREF="../../../javax/sound/sampled/LineListener.html">LineListener</A> listener)</CODE><BR> Adds a listener to this line.</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/Line.html#close()">close</A></B>()</CODE><BR> Closes the line, indicating that any system resources in use by the line can be released.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../javax/sound/sampled/Control.html">Control</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/sound/sampled/Line.html#getControl(javax.sound.sampled.Control.Type)">getControl</A></B>(<A HREF="../../../javax/sound/sampled/Control.Type.html">Control.Type</A> control)</CODE><BR> Obtains a control of the specified type, if there is any.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../javax/sound/sampled/Control.html">Control</A>[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/sound/sampled/Line.html#getControls()">getControls</A></B>()</CODE><BR> Obtains the set of controls associated with this line.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../javax/sound/sampled/Line.Info.html">Line.Info</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/sound/sampled/Line.html#getLineInfo()">getLineInfo</A></B>()</CODE><BR> Obtains the <code>Line.Info</code> object describing this line.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/sound/sampled/Line.html#isControlSupported(javax.sound.sampled.Control.Type)">isControlSupported</A></B>(<A HREF="../../../javax/sound/sampled/Control.Type.html">Control.Type</A> control)</CODE><BR> Indicates whether the line supports a control of the specified type.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/sound/sampled/Line.html#isOpen()">isOpen</A></B>()</CODE><BR> Indicates whether the line is open, meaning that it has reserved system resources and is operational, although it might not currently be playing or capturing sound.</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/Line.html#open()">open</A></B>()</CODE><BR> Opens the line, indicating that it should 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/Line.html#removeLineListener(javax.sound.sampled.LineListener)">removeLineListener</A></B>(<A HREF="../../../javax/sound/sampled/LineListener.html">LineListener</A> listener)</CODE><BR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -