/**
* Sets Gain value. Line should be opened before calling this method. Linear scale 0.0 <--> 1.0 Threshold Coef. : 1/2 to avoid saturation.
*
* @param fGain
*/
public void setGain(float fGain) {
// if (line != null)
// System.out.println(((FloatControl)
// line.getControl(FloatControl.Type.MASTER_GAIN)).getValue())
// Set the value
gain = fGain;
// Better type
if (line != null && line.isControlSupported(FloatControl.Type.MASTER_GAIN))
( (FloatControl) line.getControl(FloatControl.Type.MASTER_GAIN) ).setValue((float) ( 20 * Math.log10(fGain <= 0.0 ? 0.0000 : fGain) ));
// OR (Math.log(fGain == 0.0 ? 0.0000 : fGain) / Math.log(10.0))
// if (line != null)
// System.out.println(((FloatControl)
// line.getControl(FloatControl.Type.MASTER_GAIN)).getValue())
}
AudioPlayer.java 文件源码
java
阅读 31
收藏 0
点赞 0
评论 0
项目:Java-Google-Speech-Recognizer
作者:
评论列表
文章目录