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;
}