SFML community forums

Help => Audio => Topic started by: dpixel on August 30, 2013, 07:06:04 am

Title: Audio crashes of exit
Post by: dpixel on August 30, 2013, 07:06:04 am
I've been reading about some issues with Windows XP and sf::Sound, etc.  I don't really understand what's going on...if it's an issue that I have?  Or if the issue was fixed?

My program crashes on exit with a:

The instruction at "0x100453cc" referenced memory ar "0x030cb490". The memory could not be "read".

All I have to put in is this one line to make it crash on exit...
sf::SoundBuffer buf1;

Other than that, the audio works fine.
Title: Re: Audio crashes of exit
Post by: Laurent on August 30, 2013, 08:01:22 am
https://github.com/SFML/SFML/issues/30

It would be great if you could try the latest sources (you'll need to recompile SFML), it is potentially fixed.
Title: Re: Audio crashes of exit
Post by: dpixel on August 30, 2013, 04:04:27 pm
It took a while to figure out, but I got it compiled, but still the crash exists.

On the compile I noticed that theres no new:
libsndfile-1.dll
or
openal32.dll

Does that make a difference?

EDIT:

I found the libsndfile-1.dll and openal32.dll and copied the to my project.  Still Crashes.   :(

FMOD?  lol

Just for reference my audio code is this:
sf::SoundBuffer buf1;
sf::Sound sound;
buf1.loadFromFile("explode1.wav");
 

Then call it like this:
if ((bullet[j].x >= zombie[i].x-WorldPosX) && (bullet[j].x <= zombie[i].x+40-WorldPosX) && (bullet[j].y >= zombie[i].y + 5) && (bullet[j].y <= zombie[i].y + 60))
                            {
                                bullet[j].flag = false; //turn off for mega bullet
                                zombie[i].state = 1;
                                zombie[i].alive = false;
                                player.score = player.score + 10;
                                //Mix_PlayChannel( 1, sound1, 0 );
                                sound.setBuffer(buf1);
                                sound.play();
                            }
 
Title: Re: Audio crashes of exit
Post by: dpixel on August 31, 2013, 02:23:07 am
For the time being I'm using SDL_mixer.  It seems to work fine with SFML.

Would there be some kind of shut down code I could use to clear the memory or something with SMFL Audio to avoid the crash on shutdown?
Title: Re: Audio crashes of exit
Post by: VinZy on September 18, 2013, 04:22:29 pm
I have the exact same Problem:

programs using sfml-audio from SFML 2.1 (wether debug or release) crash on exit on Windows XP.

On Windows 7 it runs fine.
I´ve tried it on different PCs and complied it with different Compilers (Code Blocks with TDM GCC, QT Creator with MinGW), always crashes on exit on XP, even if just an Object of sfml-audio was initialized.
I also recompiled the sources.

I´ve just changed from SFML 1.6 to 2.1 and I don´t wanna go back now.
Ive seen the problem in many threads with SFML 2.0, but no solution.
Please help, thats a major bug.

VinZy
Title: Re: Audio crashes of exit
Post by: Michard on September 24, 2013, 01:46:02 pm
I am facing this problem too, self-compiled latest SFML 2.1 on Windows XP.

I think this bug should be fixed as soon as possible, it's been months since it was discovered, and a lot of users are complaining about it.

Is there any workaround (and with any, I mean even a very dirty one, as long as it works) compatible with dynamic linking? Modifying SFML source and recompiling wouldn't be an issue.
Title: Re: Audio crashes of exit
Post by: Laurent on September 24, 2013, 02:12:57 pm
The problem is that the only possible fix is a big one, it requires a redesign of some parts of SFML.
Title: Re: Audio crashes of exit
Post by: wintertime on October 21, 2013, 11:14:47 pm
Is there any news on this issue meanwhile? :(
Title: Re: Audio crashes of exit
Post by: Laurent on October 22, 2013, 07:41:23 am
No.
Title: Re: Audio crashes of exit
Post by: Phanoo on May 09, 2014, 08:24:36 pm
Bump. I have the same problem
Title: Re: Audio crashes of exit
Post by: Laurent on May 09, 2014, 08:41:31 pm
Bumping this thread won't magically fix the bug ;)
Title: AW: Audio crashes of exit
Post by: eXpl0it3r on May 09, 2014, 09:24:33 pm
Also if you're on XP and connected to the internet, you're endangering yourself. ;)

If you're not on XP you might not experience the exacte same thing.
Title: Re: Audio crashes of exit
Post by: Phanoo on May 10, 2014, 12:25:01 am
windows XP is fine for my 1ghz cpu. fortunately it's not my main computer ;D
Title: Re: Audio crashes of exit
Post by: wintertime on May 12, 2014, 03:52:41 pm
I vaguely remember this was a static double-destruction issue cause of some interaction of SFML and the audio library and did not get fixed cause of code design choices to hide the audio device and instead rely on consistent sequence of static destruction? So this wont be magically fixed completely on some newer OS, even though it accidentally shows its presence mostly just on XP.
Title: Re: Audio crashes of exit
Post by: bleakhouse on September 15, 2016, 08:18:09 pm
I just started using SFML myself this week.
I am using VC2008 and a Windows XP machine.
Yes, yes I know, hopelessly old fashioned and courting the rath of every bad guy on the net for not keeping up with the herd.:)
I encountered the exact same bug you mentioned using v2.1 (the latest version that supports vc2008).
Using the pre-built example program "sound.exe" that ships with the sdk I noticed that program did not crash on exit, after you copy openal32.dll and libsndfile-1.dll in to the folder with the app.

I then started rebuilding the sound.cpp example program in VC2008, using different configurations.
It turns out, at least for me, that if you statically link to the SFML libraries instead of dynamically linking to the dll versions, the crash goes away.
I built the sound example with dll linking, and it crashed every single time on exit.
I built it with static linking, and it worked fine.
Some interaction between  the sfml audio dll shutdown code and Windows XP, isn't playing nice.
For now I'll use static linking since, from reading this thread, it seems clear that the developers are more willing to comment on our choice of operating system, than in fixing a major, repeatable, crash issue.