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

Author Topic: Failed to open the audio device  (Read 14869 times)

0 Members and 1 Guest are viewing this topic.

CodingMadeEasy

  • Newbie
  • *
  • Posts: 38
    • MSN Messenger - petetheheat_represent@msn.com
    • AOL Instant Messenger - 622+Amaretto+Ave
    • Yahoo Instant Messenger - petetheheat_baller@yahoo.com
    • View Profile
    • http://www.youtube.com/CodingMadeEasy
Failed to open the audio device
« on: January 06, 2011, 05:55:15 am »
Hi. I'm trying to you music in my program but somethings wrong with
the audio class.

I include it
Code: [Select]

#include <SFML/Audio.hpp>


and whenever I create my music file I get an error in the console window that says

"Failed to open the audio device"

I've added the audio to the linker.
I've defined SFML_DYNAMIC.
I have everything in the right folder.
Graphics and stuff work fine. I just started on music today and now I can't figure out the problem.

Say I have a code like this

Code: [Select]

#include <SFML/Audio.hpp>

int main () {
sf::Music Music;
return 0;
}


I get the same error .. so what's going on with the Audio class?
[/code]

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Failed to open the audio device
« Reply #1 on: January 06, 2011, 08:48:03 am »
Do you use the openal32.dll file which is provided with SFML? What's your OS?
Laurent Gomila - SFML developer

CodingMadeEasy

  • Newbie
  • *
  • Posts: 38
    • MSN Messenger - petetheheat_represent@msn.com
    • AOL Instant Messenger - 622+Amaretto+Ave
    • Yahoo Instant Messenger - petetheheat_baller@yahoo.com
    • View Profile
    • http://www.youtube.com/CodingMadeEasy
Failed to open the audio device
« Reply #2 on: January 07, 2011, 05:07:47 am »
yes i'm using openal32.dll which is provided with sfml.
I'm running this on windows and I'm using sfml version 1.6 .

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Failed to open the audio device
« Reply #3 on: January 07, 2011, 09:13:38 am »
Are you sure that there's not another openal32.dll in Windows\System32 that may conflict?
Laurent Gomila - SFML developer

CodingMadeEasy

  • Newbie
  • *
  • Posts: 38
    • MSN Messenger - petetheheat_represent@msn.com
    • AOL Instant Messenger - 622+Amaretto+Ave
    • Yahoo Instant Messenger - petetheheat_baller@yahoo.com
    • View Profile
    • http://www.youtube.com/CodingMadeEasy
Failed to open the audio device
« Reply #4 on: January 07, 2011, 09:44:35 pm »
I checked and there was a openal32.dll and a openal64.dll. So I removed them and it still didn't work.

So I placed the sfml's openal32 into the system32 folder and it still won't work.

I have tried every option and it just won't work.

CodingMadeEasy

  • Newbie
  • *
  • Posts: 38
    • MSN Messenger - petetheheat_represent@msn.com
    • AOL Instant Messenger - 622+Amaretto+Ave
    • Yahoo Instant Messenger - petetheheat_baller@yahoo.com
    • View Profile
    • http://www.youtube.com/CodingMadeEasy
Failed to open the audio device
« Reply #5 on: January 09, 2011, 10:11:12 am »
So is there any way you can help me? I've tried the 2.0 version and the 1.5 version but they still give the same error.

I really don't know what else I can do but I really need the sound in my game.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Failed to open the audio device
« Reply #6 on: January 09, 2011, 01:07:13 pm »
Is your audio config ok (hardware, drivers, etc.)? Can you play music in other softwares?
Laurent Gomila - SFML developer

CodingMadeEasy

  • Newbie
  • *
  • Posts: 38
    • MSN Messenger - petetheheat_represent@msn.com
    • AOL Instant Messenger - 622+Amaretto+Ave
    • Yahoo Instant Messenger - petetheheat_baller@yahoo.com
    • View Profile
    • http://www.youtube.com/CodingMadeEasy
Failed to open the audio device
« Reply #7 on: January 09, 2011, 06:46:19 pm »
Yes. Everything else works fine ... I make music on my laptop everyday and I listen to music everyday so all the sound drivers are fine

CodingMadeEasy

  • Newbie
  • *
  • Posts: 38
    • MSN Messenger - petetheheat_represent@msn.com
    • AOL Instant Messenger - 622+Amaretto+Ave
    • Yahoo Instant Messenger - petetheheat_baller@yahoo.com
    • View Profile
    • http://www.youtube.com/CodingMadeEasy
Failed to open the audio device
« Reply #8 on: January 10, 2011, 07:07:26 pm »
What I'll do is test it out on my other computer to see if it plays the music.
If it doesn't then there must be something wrong with the audio files.

If it does work then there must be something wrong with my laptop.
I'll report back to you once I've tested it

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Failed to open the audio device
« Reply #9 on: January 10, 2011, 07:21:48 pm »
Quote
If it doesn't then there must be something wrong with the audio files.

I don't think so. You should even have the same message without loading any sound.
Laurent Gomila - SFML developer

CodingMadeEasy

  • Newbie
  • *
  • Posts: 38
    • MSN Messenger - petetheheat_represent@msn.com
    • AOL Instant Messenger - 622+Amaretto+Ave
    • Yahoo Instant Messenger - petetheheat_baller@yahoo.com
    • View Profile
    • http://www.youtube.com/CodingMadeEasy
Failed to open the audio device
« Reply #10 on: January 10, 2011, 10:41:35 pm »
So loading the sound is the problem?

CodingMadeEasy

  • Newbie
  • *
  • Posts: 38
    • MSN Messenger - petetheheat_represent@msn.com
    • AOL Instant Messenger - 622+Amaretto+Ave
    • Yahoo Instant Messenger - petetheheat_baller@yahoo.com
    • View Profile
    • http://www.youtube.com/CodingMadeEasy
Failed to open the audio device
« Reply #11 on: January 10, 2011, 10:54:07 pm »
I remember it saying earlier that I needed to use the initialize function .... but I didn't because I saw examples where you didn't need it .... and then after a while it said that it failed to open the audio device...

does that have anything to do with it?

CodingMadeEasy

  • Newbie
  • *
  • Posts: 38
    • MSN Messenger - petetheheat_represent@msn.com
    • AOL Instant Messenger - 622+Amaretto+Ave
    • Yahoo Instant Messenger - petetheheat_baller@yahoo.com
    • View Profile
    • http://www.youtube.com/CodingMadeEasy
Failed to open the audio device
« Reply #12 on: January 10, 2011, 11:37:42 pm »
Ok this is weird.... Now I've made my file into an executable file and when I run the executable (.exe) file the sound works fine. But when I run it in the compiler it doesn't play :/

Maxamor

  • Newbie
  • *
  • Posts: 8
    • View Profile
Failed to open the audio device
« Reply #13 on: January 11, 2011, 04:00:43 am »
Is your working directory correct?

If you're using Visual Studio, for example, unless you have specified the working directory when you run your program by pressing the "debug" button it does not actually execute the program from your "Debug" folder. This could be a problem if you are referencing files in the same directory or using a relative path since they won't be found in the working directory.

In Visual Studio you can change your working directory for each configuration by going to Project > [project name] Properties... > Configuration Properties > Debugging > Working Directory.

CodingMadeEasy

  • Newbie
  • *
  • Posts: 38
    • MSN Messenger - petetheheat_represent@msn.com
    • AOL Instant Messenger - 622+Amaretto+Ave
    • Yahoo Instant Messenger - petetheheat_baller@yahoo.com
    • View Profile
    • http://www.youtube.com/CodingMadeEasy
Failed to open the audio device
« Reply #14 on: January 11, 2011, 05:55:10 pm »
I'm using Code::Blocks and I have the music files in my project folder. I put the graphics in the same place and the graphics work fine .... maybe I should put the .dll files in the same folder as the .exe file.. maybe it will work then ... when I reach home I'll test it out and tell you the results

but how would you set the working directory in code::blocks?