使用功能NAudio.Wave音频播放本地文件或者URL

using NAudio.Wave;

AudioFileReader audioFileReader;

           //播放设置
            if (waveOutDevice!=null)
            {
                waveOutDevice.Stop();
            }
            waveOutDevice = new WaveOut();//
            audioFileReader = new AudioFileReader(msg.ReturnStr);///传入数据地址
            waveOutDevice.Init(audioFileReader);
            waveOutDevice.Play(); 

关闭事件里写入

        if (waveOutDevice != null)
        {
            waveOutDevice.Stop();
        }
        if (waveOutDevice != null)
        {
            waveOutDevice.Dispose();
            waveOutDevice = null;
        }
上一篇:将字节写入波形文件?


下一篇:使用SoundPool生成介于10和20000Hz之间的正弦波