SFML community forums

Help => Audio => Topic started by: Ditto on September 21, 2013, 11:45:15 am

Title: [Resolved]SoundBuffer crashing program?
Post by: Ditto on September 21, 2013, 11:45:15 am
I'm pretty new to SFML but I get everything graphically to work really well. When trying to load a soundbuffer (loadFromFile()) the game crashes before even getting to the code. I tried setting breakpoints on the lines that load sound but that doesn't work at all.

All I get is an Application Error window saying: "The application was unable to start correctly (0xc000007b). Click OK to close the application". I tried searching and found someone saying I should update my C++ redist(http://forums.autodesk.com/t5/DWG-TrueView/The-application-was-unable-to-start-correctly-0xc000007b/td-p/3477858 (http://forums.autodesk.com/t5/DWG-TrueView/The-application-was-unable-to-start-correctly-0xc000007b/td-p/3477858)), but that is already up to date!

Anyone had problem with the SoundBuffer like this?
Title: AW: SoundBuffer crashing program?
Post by: eXpl0it3r on September 21, 2013, 01:00:29 pm
Seems like you aren't running the application through a debugger, otherwise the execution would automatically stop and jump to the code with the issue.
Given that loadFromFile uses strings and the runtime lib doesn't like it when you use multiple versions, I'd say you're mixing debug and release modes.

Btw what OS/compiler?
Title: Re: SoundBuffer crashing program?
Post by: Ditto on September 21, 2013, 01:58:22 pm
I'm using VS2010 ultimate. Problem occurs in both debug and release mode! Breakpoints etc work fine until I add buffer.loadFromFile(); ..
Title: Re: [Resolved]SoundBuffer crashing program?
Post by: Ditto on September 23, 2013, 07:19:17 pm
I got it working now! The problem was with the DLL files not being in the right folder. Specifically the DLL files found in "bin" in the SFML-2.1 folder. put them in my project folder and it now works like a charm.

All this linking is new to me and it's really confusing/frustrating  :-[ Thanks for the help anyways  :D
Title: Re: [Resolved]SoundBuffer crashing program?
Post by: pinko64 on January 30, 2014, 12:59:26 am
I'm suffering the same problem currently.
In the following example:
int main()
{

    std::cout << "gooo";
    sf::SoundBuffer bf;

}
 
The program terminates with 0xc000007b message. Even before executing the std::cout function.
However my dll's should be on the correct directory.

I suppose it has something to do with that openal32.dll?
I built my sfml with tdm64. Can that be a problem?



Okay... i copied both openal32.dll and libsndfile-1.dll from githubs x64 bin directory and it didn't crash.
Weird that the ones that came when i built sfml didn't work.
Title: Re: [Resolved]SoundBuffer crashing program?
Post by: eXpl0it3r on January 30, 2014, 09:12:47 am
I got it working now! The problem was with the DLL files not being in the right folder. Specifically the DLL files found in "bin" in the SFML-2.1 folder. put them in my project folder and it now works like a charm.

Okay... i copied both openal32.dll and libsndfile-1.dll from githubs x64 bin directory and it didn't crash.
Weird that the ones that came when i built sfml didn't work.
Both of you seem to have different versions of those DLLs in a directory that is in PATH, because if the DLLs couldn't be found, the application would fail with an error showing what's missing. Since that doesn't happen, your application is loading the DLL from somewhere, but the versions mismatch.

Generally I try to avoid putting DLLs in directory that are in PATH, to prevent such things.
Title: Re: [Resolved]SoundBuffer crashing program?
Post by: pinko64 on January 30, 2014, 04:00:22 pm

Nope i had to copy the files to the application's directory. So no, those ddl's never got loaded from PATH.
It was just that the first set(libsndfile-1.dll and openal32.dll) found in the SFML/install path/bin did crash the program.
But got working after i replaced those 2 files with the files from GitHubs extlibs/bin/x64.

So those two files didn't get built when i built the sfml, no?  Makes sense, though.
Title: Re: [Resolved]SoundBuffer crashing program?
Post by: eXpl0it3r on January 30, 2014, 04:15:52 pm
The DLLs are pre-built so you don't have to, not sure what you downloaded at first, but I'm glad it worked when you got them from GitHub directly.