对如何播放声音感到困惑

时间:2015-01-15 14:15:13

标签: java

我想要做的非常清楚,只是发出声音并暂停它。问题是我无法暂停音乐。我找不到错误;我做错了什么?

public class MainC extends JFrame implements ActionListener {

    int Copened,Cplay,Cstop,Csave,Cpause;
    AudioStream aStream;
    String Filename;
    File file;

    FileInputStream fis;
    public MainC() {
        Filename="";
        txtname=new JTextField();
        chooser=new JFileChooser();
    }

    public void actionPerformed(ActionEvent e) {
        if(e.getSource()==btnopen){
            chooser.showOpenDialog(this);
            file=chooser.getSelectedFile();
        }

        if(e.getSource()==btnPause){
            AudioPlayer.player.stop(fis);
        }
        if(e.getSource()==btnplay){
                fis=new  FileInputStream(file);
                aStream=new AudioStream(fis);
                AudioPlayer.player.start(aStream);

0 个答案:

没有答案