问题
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