private void init() {
AudioFormat speexFormat = new AudioFormat(16000, 16, 1, true, false);
DataLine.Info sourceLineInfo = new DataLine.Info(SourceDataLine.class, speexFormat, bufferSize);
speexDecoder.init(1, 16000, 1, false);
try {
line = (SourceDataLine) AudioSystem.getLine(sourceLineInfo);
line.open(speexFormat, bufferSize);
volumeControl = (FloatControl) line.getControl(FloatControl.Type.MASTER_GAIN);
minGainDB = volumeControl.getMinimum();
ampGainDB = ((10.0f / 20.0f) * volumeControl.getMaximum()) - volumeControl.getMinimum();
cste = Math.log(10.0) / 20;
volumeControl.setValue((float) minGainDB);
line.start();
} catch (LineUnavailableException e) {
App.logger.w("Failed to create voice player (type: " + type + " id: " + playerId + "):" , e);
if (!exit)
close(false);
}
}
VoicePlayer.java 文件源码
java
阅读 21
收藏 0
点赞 0
评论 0
项目:SoundCenterClient
作者:
评论列表
文章目录