SinkAudio.java 文件源码

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

项目:FoxTelem 作者:
/**
 * FIXME:
 * specify the buffer size in the open(AudioFormat,int) method. A delay of 10ms-100ms will be acceptable for realtime audio. Very low latencies like will 
 * not work on all computer systems, and 100ms or more will probably be annoying for your users. A good tradeoff is, e.g. 50ms. For your audio format, 
 * 8-bit, mono at 44100Hz, a good buffer size is 2200 bytes, which is almost 50ms
 */
void initializeOutput() {

    DataLine.Info dataLineInfo = new DataLine.Info(  SourceDataLine.class, audioFormat);
    //line = (TargetDataLine) AudioSystem.getLine(info);
    //Mixer m = AudioSystem.getMixer(null);
    try {
        //sourceDataLine = (SourceDataLine)m.getLine(dataLineInfo);
        sourceDataLine = (SourceDataLine)AudioSystem.getLine(dataLineInfo);
        sourceDataLine.open(audioFormat);
        sourceDataLine.start();
    } catch (LineUnavailableException e) {
        // TODO Auto-generated catch block
        e.printStackTrace(Log.getWriter());
    }

}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号