试图将采样的声音静音

时间:2014-10-08 19:19:20

标签: java controls mute javax.sound.sampled

我在添加MUTE控件时遇到问题。

赦免我,我是初学者。

private BooleanControl muteControl;

private Clip audioClip;

public void load(String audioFilePath)
        throws UnsupportedAudioFileException, IOException,
        LineUnavailableException {
    File audioFile = new File(audioFilePath);

    AudioInputStream ais = AudioSystem
            .getAudioInputStream(audioFile);

    AudioFormat format = ais.getFormat();

    DataLine.Info info = new DataLine.Info(Clip.class, format);

    audioClip = (Clip) AudioSystem.getLine(info);

    muteControl = (BooleanControl) audioClip.getControl(BooleanControl.Type.MUTE);

    audioClip.addLineListener(this);

    audioClip.open(ais);
}

muteControl = (BooleanControl) audioClip.getControl(BooleanControl.Type.MUTE);行 继续给我一个" IlligalArgumentException:不支持的控件类型:静音"

我也尝试过使用MASTER_GAIN控件,它给了我"" IlligalArgumentException:不支持的控件类型:MASTER_GAIN"

0 个答案:

没有答案