3

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?

dotNET
  • 33,414
  • 24
  • 162
  • 251
  • Is this an OpenGL project? – Truerror May 10 '15 at 11:26
  • Don't think so. I chose **MonoGame Windows Project** in New Project dialog. – dotNET May 10 '15 at 18:19
  • Last time I used Monogame (3.2), there was a bug on the installer templates that would not play any sound. In order to solve it, you had to download the templates via Nuget. I know I answer a similar question on SO but cannot seem to find it, or the links that my answer contained. Just check the Monogame forums, I found all the info with this problem in there! – Nahuel Ianni May 22 '15 at 12:36

2 Answers2

7

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.

csharpskolan
  • 95
  • 1
  • 6
  • Thank god for this. You saved me a big troubleshooting headache! – Hardycore Nov 28 '16 at 17:28
  • I cant install this on windows 7, Do You have any idea what can be wrong? – patex1987 Dec 25 '16 at 21:20
  • Yup, this fixes it. It's weird. Also, Does anyone know what version of directx monogame uses? There is no downloadable package of dx 11 or 12 other than through getting it from windows update.. But the link to dx 9 above works fine. – bwoogie May 02 '17 at 20:23
  • Did the sound work before? I just got a new computer and the sound isn't working. Don't know if this problem just always occurs or... – Daniel G May 28 '17 at 01:35
0

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