none
使用 XNA Framework 的 SoundEffect 类播放音效时总出现异常,求具体原因? RRS feed

  • 问题

  • WP8开发中,我使用XNA Framework 的 SoundEffect 类播放音效,但在将波形音频文件加载到 SoundEffect 类播放的流时总抛异常。

    var stream = TitleContainer.OpenStream(path);

    var effect = SoundEffect.FromStream(stream);

    查看异常详细信息-堆栈跟踪的提示如下:

       at Microsoft.Xna.Framework.Audio.WavFile.ParseWavHeader()
       at Microsoft.Xna.Framework.Audio.WavFile..ctor(Stream source)
       at Microsoft.Xna.Framework.Audio.WavFile.Open(Stream stream)
       at Microsoft.Xna.Framework.Audio.SoundEffect..ctor(Stream stream)
       at Microsoft.Xna.Framework.Audio.SoundEffect.FromStream(Stream stream)
       at SmartHome.Common.SoundController.PlayShortSound(String path)
       at SmartHome.Common.C4fHelper.ShowToastPrompt(String msg, EventHandler`1 action, Boolean callShake, Boolean callSound, String audioPath)
       at SmartHome.View.MainPage.<.ctor>b__0(Object sender, RoutedEventArgs args)
       at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
       at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)

    求高手指点迷津

    2013年9月4日 8:47