Naudio已经分配了呼叫waveoutopen

时间:2013-05-01 21:57:44

标签: c# naudio

我有频繁播放相同声音的问题。如果我经常点击按钮,我会收到错误“已经分配waveoutOpen调用”。如何清洁waveOut?怎么样?这是我的代码:

        public WaveFileReader reader1;

它的按钮:

        if (radioButton1.Checked == true)
        {
         reader2 = new WaveFileReader(Application.StartupPath + "\\Dzwieki\\Piano\\D piano.wav");

        }
        else if (radioButton2.Checked == true)
        {
            reader2 = new WaveFileReader(Application.StartupPath + "\\Dzwieki\\Organ\\D organ.wav");
        }

        z2 = new NAudio.Wave.WaveOut(); 
        z2.Init(reader2);
        z2.Play();

0 个答案:

没有答案