AudioPlayer.java 文件源码

java
阅读 27 收藏 0 点赞 0 评论 0

项目:BotLibre 作者:
/**
 * 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())
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号