No sound/sound depending on machine (MonoGame version 3.4)

(I’m not quite sure if this is the place to report bugs; if not, I’d be happy for redirection)

Steps to reproduce:

  • build .\MonoGame-3.4\Test\Interactive\MonoGame.InteractiveTests.Windows.sln
  • copy the resulting “.\bin” folders to different machines
  • launch “.\SoundTest.exe” resp. “.\SoundTest2.exe”

=> on some machines there is sound (for both), on some machines there is no sound

NOTE: As far as the tests went, this corresponds to the machine having more than one sound device (in dxdiag there is not only one “Sound” tab, but “Sound 1”, “Sound 2”, …); such as regular speaker & digital output. Maybe detection of the device set as Default fails?

Of course, all tested machines were able to play sound (and do so for other applications).

Tests included 5 machines playing sound and 3 machines playing no sound, so the above note MAY be coincidence instead of causality.

Hi @TomMKV.

build .\MonoGame-3.4\Test\Interactive\MonoGame.InteractiveTests.Windows.sln

We haven’t built or run the old interactive tests in years now. I can’t say what your results will be with it.

Did you link it to the Windows version of MonoGame or the WindowsGL version? They use totally different sound systems, so this a critical thing to know before we proceed.

Thanks for the fast response, Tom.

When using the WindowsGL version of MonoGame (which’s existence I just now noticed :frowning: sorry) sound DOES play on ALL machines.

So, the problem arises only with DirectSound.

For maximum reproducibility (and minimum chance for me to mess it up), I used the pre-made binaries from latest development build (MonoGame_Develop_Win_3.5.0.137_artifacts.zip). However, the results are the same as when I compiled the 3.4 version myself.

I was referring to “.\MonoGame-3.4\Test\Interactive\MonoGame.InteractiveTests.Windows.sln” only to have common example code base, sound files etc. pp.; the problem is present generally (I actually noticed it when I re-built a larger project to use Windows MonoGame instead of XNA).

I tested on one of the “problematic” machines:
(1) directly after installing Windows (7 Ultimate) + .NET Framework 4 (after that, DirectX MonoGame version could be launched)
(2) then, after installing graphics drivers (after that, OpenGL MonoGame version could be launched)
(3) then, after installing XNA (after that, XNA version could be launched)
(4) then, after installing sound card drivers
(5) then, after installing all other hardware drivers
(6) then, after applying everything from Windows Update up until now

For all tests, OpenGL MonoGame & XNA versions (as soon as they could be launched) had sound and the DirectX MonoGame version had not.
All versions used the same sound files; both MonoGame versions used the same application “*.exe” binary; the XNA version was compiled from the same “*.cs” source code file as the MonoGame versions.

Weird… that is the opposite of what I expected.

If I could repro this I would step thru this code:

https://github.com/mono/MonoGame/blob/develop/MonoGame.Framework/Audio/SoundEffect.XAudio.cs#L70

And see if we’re getting something strange during initialization.

Thanks for the hint.

I removed the outer try { … } catch { … } of the InitializeSoundEffect method you pointed me to.

Thus, I was able to find out that

SharpDX.SharpDXException: Class not registered

is thrown for

Device = new XAudio2(XAudio2Flags.None, ProcessorSpecifier.DefaultProcessor);

And some investigation pointed me towards a DirectX component not being installed.

After I run the DirectX web installer, the sound was playing.

This did not change the actual DirectX11 runtime (“DXDiag.txt” identical before & after).

Beware, entering guessing territory again:
The DirectX web installer did seem to install DirectX SDKs.

If this observation is any better than the previous one with the multiple sound devices (cough), it seems that the XAudio2 SDK is necessary even for XAudio2Flags.None, not only for XAudio2Flags.DebugEngine.
Thus, you should be able to reproduce the missing sound on any machine which has just the “basic” DirectX11, but not the SDKs installed.