

为什么它不起作用?我什至尝试使用isRuning方法测试剪辑是否正在运行,我得到的唯一结果是文件长度和False作为对isRunning方法的返回。
我要播放的 WAV 文件来自Wikipedia的WAV文件文章,格式表中的第二个文件。我想它的格式很好。
由于我看不到您的代码,因此我发布了我的操作方法,此代码“加载”了声音:
    AudioInputStream audioPush = null;
    try {
        push = AudioSystem.getClip();
        URL urlPush = getClass().getResource(
                    "path to the file");
        audioPush = AudioSystem.getAudioInputStream(urlPush);
        push.open(audioPush);
    } catch (IOException e) {
        e.printStackTrace();
    } catch (LineUnavailableException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
然后你必须像这样玩它:
push.start();
我就是这样做的,不知道是否有其他方法,但是这个方法有效。