循环后Java Audio API停止播放

时间:2016-04-17 22:15:44

标签: java audio playback

我编写了这段代码,循环播放音频一次,然后文件继续播放

public void playNextSecond(long startFrame) {
    //Get the number of frames for one second
    float sampleRate = audioStream.getFormat().getSampleRate();

    //Set the current playback time to the start of the loop section
    clip.setFramePosition((int)startFrame);

    //Set up the looping segment
    clip.setLoopPoints((int)startFrame, (int)(startFrame + sampleRate));

    //Loop one time
    clip.loop(1);
}

我想在循环完成后停止播放。反正有没有这样做?或者,无论如何都要玩到特定的帧?

0 个答案:

没有答案
相关问题