AudioStream.java 文件源码

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

项目:cloudturbine 作者:
/**
 * Implementation of the abstract start() method from DataStream
 */
public void start() throws Exception {
    if (queue != null) { throw new Exception("ERROR in AudioStream.start(): LinkedBlockingQueue object is not null"); }
    // Make sure we can open the audio line
    try {
        format = getFormat();
        DataLine.Info info = new DataLine.Info(TargetDataLine.class, format);
        line = (TargetDataLine) AudioSystem.getLine(info);
        line.open(format);
        line.start();
    } catch (LineUnavailableException e) {
        throw new Exception("Audio stream error, could not open the audio line:\n" + e.getMessage());
    }
    bIsRunning = true;
    // Make sure there is no other audio capture running
    stopAudio();
    queue = new LinkedBlockingQueue<TimeValue>();
    // start the audio capture
    audioThread = new Thread(this);
    audioThread.start();
    updatePreview();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号