播放音频时,出现波形头已损坏的错误。望高手指教。
部分代码如下:
MemoryStream sound = new MemoryStream();sound.Write(myFile.Data, 0, myFile.Data.Length);sound.Position = 0;this.soundPlayer = new SoundPlayer(sound);this.soundPlayer.PlayLooping();sound.Close();
看看这里(http://stackoverflow.com/a/5756867),一行代码搞定:
(new SoundPlayer(@"c:\Media\pacman.wav")).Play();