Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Audio crashes of exit  (Read 6853 times)

0 Members and 1 Guest are viewing this topic.

dpixel

  • Newbie
  • *
  • Posts: 20
    • View Profile
Audio crashes of exit
« 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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Audio crashes of exit
« Reply #1 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.
Laurent Gomila - SFML developer

dpixel

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Audio crashes of exit
« Reply #2 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();
                            }
 
« Last Edit: August 30, 2013, 04:16:09 pm by dpixel »

dpixel

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Audio crashes of exit
« Reply #3 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?

VinZy

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Audio crashes of exit
« Reply #4 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

Michard

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Re: Audio crashes of exit
« Reply #5 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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Audio crashes of exit
« Reply #6 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.
Laurent Gomila - SFML developer

wintertime

  • Sr. Member
  • ****
  • Posts: 255
    • View Profile
Re: Audio crashes of exit
« Reply #7 on: October 21, 2013, 11:14:47 pm »
Is there any news on this issue meanwhile? :(

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Audio crashes of exit
« Reply #8 on: October 22, 2013, 07:41:23 am »
No.
Laurent Gomila - SFML developer

Phanoo

  • Full Member
  • ***
  • Posts: 136
    • View Profile
Re: Audio crashes of exit
« Reply #9 on: May 09, 2014, 08:24:36 pm »
Bump. I have the same problem

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Audio crashes of exit
« Reply #10 on: May 09, 2014, 08:41:31 pm »
Bumping this thread won't magically fix the bug ;)
Laurent Gomila - SFML developer

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10838
    • View Profile
    • development blog
    • Email
AW: Audio crashes of exit
« Reply #11 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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Phanoo

  • Full Member
  • ***
  • Posts: 136
    • View Profile
Re: Audio crashes of exit
« Reply #12 on: May 10, 2014, 12:25:01 am »
windows XP is fine for my 1ghz cpu. fortunately it's not my main computer ;D

wintertime

  • Sr. Member
  • ****
  • Posts: 255
    • View Profile
Re: Audio crashes of exit
« Reply #13 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.

bleakhouse

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: Audio crashes of exit
« Reply #14 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.
Premature optimization is the root of all evil.

 

anything