Jump to content

SFML: "Failed to open the audio device"

STRMfrmXMN
Go to solution Solved by STRMfrmXMN,
3 hours ago, ONOTech said:

Try updating GCC. That often fixed a lot of the issues I had when I used SFML w/ Code Blocks.

 

Edit: Pssh, SFML cannot open .wavs you silly goose. Use .oggs. Then it should work

 

I highly recommend using VS if you have the computer for it. It's support for SFML is miles better.

Code::Blocks default compiler is only GCC

 

I got it working. WAV files are supported according to SFML and I got it working with a WAV of Spooky Scary Skeletons so lol xD

 

I'm forced to use CB due to this being a school PC.

 

For those looking to solve this in the future, make sure you actually have the correct DLLs you need. I just so happened to have downloaded a game off Github earlier and saw that it had those DLLs in there and though "hey, why not swap them with the ones I have." Boom, works perfect.

Currently trying to write a program in SFML that plays music when the game is opened. What I have done to make this work:

 

Included sfml-audio-s-d in linker settings in Codeblocks 13.12 as the very first listing.

Defined SFML_DYNAMIC in #defines

Have the audio to be played in the .wav format

All correct DLLs in the folder with the music and cpp file

Called the music to play using:

    if(!music.openFromFile("spooky.wav")){
        cout << "Oops, no music!" << endl;
    }

and declared "music" as so (using namespace sf):

Music music;

 

Every single time I open the program this message pops up:

rmdnBoF.png

 

When I close the program manually it stops working.

 

My teacher, the TA and other people in the room who have got music working in SFML have struggled to figure out why this doesn't work. Can some guru here help me out?

|PSU Tier List /80 Plus Efficiency| PSU stuff if you need it. 

My system: PCPartPicker || For Corsair support tag @Corsair Josephor @Corsair Nick || My 5MT Legacy GT Wagon ||

Link to comment
Share on other sites

Link to post
Share on other sites

3 hours ago, ONOTech said:

Try updating GCC. That often fixed a lot of the issues I had when I used SFML w/ Code Blocks.

 

Edit: Pssh, SFML cannot open .wavs you silly goose. Use .oggs. Then it should work

 

I highly recommend using VS if you have the computer for it. It's support for SFML is miles better.

Code::Blocks default compiler is only GCC

 

I got it working. WAV files are supported according to SFML and I got it working with a WAV of Spooky Scary Skeletons so lol xD

 

I'm forced to use CB due to this being a school PC.

 

For those looking to solve this in the future, make sure you actually have the correct DLLs you need. I just so happened to have downloaded a game off Github earlier and saw that it had those DLLs in there and though "hey, why not swap them with the ones I have." Boom, works perfect.

|PSU Tier List /80 Plus Efficiency| PSU stuff if you need it. 

My system: PCPartPicker || For Corsair support tag @Corsair Josephor @Corsair Nick || My 5MT Legacy GT Wagon ||

Link to comment
Share on other sites

Link to post
Share on other sites

3 hours ago, ONOTech said:

I think it's cool how you guys use SFML. I don't know of any other high school that does that.

My high school is honestly pretty dope with technology, love my comp science teacher too. 

|PSU Tier List /80 Plus Efficiency| PSU stuff if you need it. 

My system: PCPartPicker || For Corsair support tag @Corsair Josephor @Corsair Nick || My 5MT Legacy GT Wagon ||

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×