📄 gaincontrol.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 Sat May 20 18:57:43 PDT 2000 --><TITLE>: Interface GainControl</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 ID="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT ID="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="package-tree.html"><FONT ID="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT ID="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT ID="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT ID="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../javax/media/GainChangeListener.html"><B>PREV CLASS</B></A> <A HREF="../../javax/media/MediaHandler.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="GainControl.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.media</FONT><BR>Interface GainControl</H2><HR><DL><DT>public interface <B>GainControl</B><DT>extends <A HREF="../../javax/media/Control.html">Control</A></DL><P><code>GainControl</code> is an interface for manipulating audio signal gain. <h3>Gain and Gain Measures</h3> Gain is a multiplicative value applied to an audio signal that modifies the amplitude of the signal. This interface allows the gain to be specified in either decibels or using a floating point value that varies between 0.0 and 1.0. <h4>Specifying Gain in Decibels</h4> The decibel scale is valid over all <code>float</code> values. A gain of 0.0 dB implies that the audio signal is neither amplified nor attenuated. Positive values amplify the audio signal, negative values attenuate the audio signal. The relationship between a linear gain multiplier and the gain specified in decibels is: <p><CENTER><CODE> value = pow(10.0, gainDB/20.0) </CODE></CENTER><h4>Specifying Gain in the Level Scale</h4> The level scale ranges from 0.0 to 1.0, where 0.0 represents a gain that is virtually indistinguishable from silence and 1.0 represents the value that is, in some sense, the maximum gain. In other words, 1.0 represents the highest gain value that produces "useful" results. The mapping for producing a linear multiplicative value is implementation dependent. <h4>Decibel and Level Interactions</h4> The dB and level scales are representations of the same gain value. Calling <code>setLevel</code> will affect subsequent <code>getDB</code> invocations. Level and dB are interrelated in the following ways: <ul> <li>Level Silence Threshold. After <code>setLevel(0.0)</code>, <code>getDB</code> returns the value for which smaller values are not usefully distinguishable from silence. Calling <code>setDB</code> with values equal to or less than this silence threshold causes <code>getLevel</code> to return a value of 0.0. <li>Level Maximum Threshold. After <code>setLevel(1.0)</code>, <code>getDB</code> returns the value for which larger values are not useful. Calling <code>setDB</code> with values equal to or greater than this threshold causes <code>getLevel</code> to return a value of 1.0. <li>The decibel interface is not limited to the thresholds described by the level interface. For example, if you call <code>setDB</code> with a value that is greater than the maximum level threshold and then immediately call <code>getDB</code>, <code>getDB</code> returns the gain that was returned by the <code>setDB</code>, <i>not</i> the value that would be returned if you called <code>setLevel(1.0)</code> and then called <code>getDB</code>. <li>Both measures increase gain monotonically with increasing measure values. </ul> <h4>Defaults</h4> Gain defaults to a value of 0.0 dB. The corresponding level is implementation dependent. Note that for some implementations, the default level might change on a per-instance basis. <h3>Mute</h3> Muting is independent of the gain. If mute is <CODE>true</CODE>, no audio signal is produced by this object; if mute is <CODE>false</CODE> an audio signal is produced and the gain is applied to the signal. <h3>Gain Change Events</h3> When the state of the <code>GainControl</code> changes, a <code>GainChangeEvent</code> is posted. This event is delivered through an object that implements <code>GainChangeListener</code> and has been registered as a listener with the <code>GainControl</code> using <code>addGainChangeListener</code>.<P><DL><DT><B>See Also: </B><DD><A HREF="../../javax/media/GainChangeEvent.html"><CODE>GainChangeEvent</CODE></A>, <A HREF="../../javax/media/GainChangeListener.html"><CODE>GainChangeListener</CODE></A>, <A HREF="../../javax/media/Control.html"><CODE>Control</CODE></A></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== 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/media/GainControl.html#addGainChangeListener(javax.media.GainChangeListener)">addGainChangeListener</A></B>(<A HREF="../../javax/media/GainChangeListener.html">GainChangeListener</A> listener)</CODE><BR> Register for gain change update events.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> float</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/media/GainControl.html#getDB()">getDB</A></B>()</CODE><BR> Get the current gain set for this object in dB.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> float</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/media/GainControl.html#getLevel()">getLevel</A></B>()</CODE><BR> Get the current gain set for this object as a value between 0.0 and 1.0</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/media/GainControl.html#getMute()">getMute</A></B>()</CODE><BR> Get the mute state of the signal associated with this <code>GainControl</code>.</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/media/GainControl.html#removeGainChangeListener(javax.media.GainChangeListener)">removeGainChangeListener</A></B>(<A HREF="../../javax/media/GainChangeListener.html">GainChangeListener</A> listener)</CODE><BR> Remove interest in gain change update events.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> float</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/media/GainControl.html#setDB(float)">setDB</A></B>(float gain)</CODE><BR> Set the gain in decibels.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> float</CODE></FONT></TD>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -