我正在尝试使用 Microsoft.Xna.Framework 播放 wav 文件,但我无法解决此错误。
A first chance exception of type 'System.ArgumentException' occurred in Microsoft.Xna.Framework.ni.dll
An exception of type 'System.ArgumentException' occurred in Microsoft.Xna.Framework.ni.dll but was not handled in user code
下面是我的代码:(错误发生在线TitleContainer.OpenStream(dingSoundFile)
:)
SoundEffectInstance seiCircus;
string dingSoundFile = "/Html/sounds/tap.wav";
using (var stream = TitleContainer.OpenStream(dingSoundFile))
{
var effect = SoundEffect.FromStream(stream);
//create the instance
seiCircus = effect.CreateInstance();
FrameworkDispatcher.Update();
//play sound via the instance
seiCircus.Play();
}