Monogame: WAV not playing

时光毁灭记忆、已成空白 提交于 2020-01-03 19:14:31

问题


This is MonoGame 3.4 and I'm using it through VS2013. I'm compiling my WAV file using mgcb the same way as my textures. MGCB works fine, but when it comes to playing a sound using SoundEffect class, it doesn't play anything. There is no exception and SoundEffect.Play() function returns true, but I can't hear anything. Here's my code:

Loading:

JumpSound = content.Load<SoundEffect>("SpinJump"); 

Playing:

var Ins = JumpSound.CreateInstance();
Ins.Volume = 1f;
Ins.Play();

The very same code plays the sound just fine in XNA project. Is this a known bug or something?


回答1:


I had the exact same problem. My solution was to reinstall DirectX. For some reason this helped. I was running Windows 10 and VS 2015 Community Edition. I also had XNA installed where the same code was running just fine!

After reinstalling DirectX (https://www.microsoft.com/en-us/download/details.aspx?id=35&84e4d527-1a2f-c70a-8906-a877ec4baada=1) the SoundEffect class started working again!

Hope this helps.




回答2:


Monogame with VS2017, same problem, ok but no sound, issue finally simply solved with a ActiveX update.



来源:https://stackoverflow.com/questions/30011883/monogame-wav-not-playing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!