Windows SoundEffect not playing [Solved]

I cannot get SoundEffect to work on Windows platform (Windows 10, VS15). Song is working fine. It looks like it’s loaded fine by content loader but then not played. No exceptions are thrown.

When debugging with MonoGame project loaded I can see XAudio2 Device is not initialized which means no SoundEffect can be played. These are the lines, both Device creation lines are throwing exceptions, later caught by catch.

SoundEffect.XAudio.cs : Line 86

if (Device == null)
{
	#if !WINRT && DEBUG
	try
	{
	        //Fails if the XAudio2 SDK is not installed
		Device = new XAudio2(XAudio2Flags.DebugEngine, ProcessorSpecifier.DefaultProcessor);
		Device.StartEngine();
	}
	catch
	#endif
	{
		Device = new XAudio2(XAudio2Flags.None, ProcessorSpecifier.DefaultProcessor);
		Device.StartEngine();
	}
}

Could it be some prerequisites problem? Also not sure if it is MonoGame or SharpDX issue.

EDIT : Tried it with different Audio devices and Desktop PC and sound still doesn’t work. Here is the exception that I got from SharpDX library when trying to create Device.

Message “HRESULT: [0x80040154], Module: [Unknown], ApiCode: [Unknown/Unknown], Message: Class not registered\r\n” string

I just had a user report sound issues like this… It has to do with what devices are plugged in and registered by windows.

they had music, but sound was broken until they took out headphones…

You could try that… But changing your device while the game is running can have side effects.

I don’t use headphones with my laptop, but I do connect USB audio device sometimes, and it’s used by default when It’s plugged in. I will try playing with it later today.

yeah, has to do with the actual audio device I think… But post back how it goes.

Have tried with different audio playback devices and Desktop PC, still no luck. Have update original post with info about thrown exception.

https://support.microsoft.com/en-us/kb/201191

You maybe don’t have visual c++ components installed? (if that matters?)

or read here

1 Like

Thank you, It seems I was missing DirectX redistributable. Installing fixed it.

https://www.microsoft.com/en-gb/download/details.aspx?id=8109

that was my next guess,

a lot of people failing to play games are missing DirectX 9.0c