0
\$\begingroup\$

I'm trying to code a simple audio playback test game (which will be used in my actual project), and everything works fine, except for the fact that after the audio has finished playing, the game will crash with a 'stopped working' dialog.

Here's the code that's used to load and play the audio. Regardless of whether it's in LoadContent or not, the crash still happens.

List<SoundEffect> soundEffects;
FileStream soundStream = new FileStream("test.wav", FileMode.Open);
soundEffects.Add(SoundEffect.FromStream(soundStream));
soundStream.Dispose();
SoundEffectInstance soundeffectinstance = soundEffects[0].CreateInstance();
soundeffectinstance.Volume = 0.35F;
soundeffectinstance.Play();

The audio file is a 2 seconds long beep. The game works fine, and the graphics draw fine too. I should also mention that the SoundEffectInstance's State property doesn't seem to work properly as well.

I'm using Visual Studio 2010 with .NET 4.0, and MonoGame framework 3.4.0.459 (MonoGame.Framework.WindowsDX, from NuGet), because that's the only thing I can use without Visual Studio telling me to upgrade to .NET 4.5.

I am unable to debug, as when I debug, the 'stopped working' dialog appears again (for some reason I cannot debug any projects directly through the Debug option in VS), and the debugger hook gets confused.

Is this an upstream issue, or is there just something wrong with the way I load the audio file? (P.S. I'm not using the Content Pipeline due to the nature of my project)

\$\endgroup\$
  • \$\begingroup\$ You should really get your development environment in order. A working debugger will save you tons of hours of development time and there should really be no reason to not upgrade your .NET version. \$\endgroup\$ – Philipp Apr 9 '16 at 14:02
  • \$\begingroup\$ @Philipp I've tried to fix VS, but even after a clean reinstall the debugger still refuses to work. If it helps, it's throwing some kind of memory access violation, regardless of whether the project works or not. Normally I'll run the projects' EXEs then hook the debugger to the process I want to debug. It works that way. \$\endgroup\$ – user1479266433284446 Apr 9 '16 at 14:04
  • \$\begingroup\$ You should ask a question about how to get VS to work properly as a separate question. But not here, because it's not game-development specific. \$\endgroup\$ – Philipp Apr 9 '16 at 14:09
0
\$\begingroup\$

Fixed after updating MonoGame to 3.5 and .NET to 4.5. Apparently it was a MonoGame 3.4 issue that was causing the problem. It's a pity though, because that means I can't support Windows XP users anymore.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.