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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Rokner

Pages: [1]
1
Audio / Audio device init failed
« on: November 07, 2015, 04:41:58 am »
Hi. I've having some strange problems with the audio in sfml. Every now and then when I start my game I get this error :
AL lib: (EE) MMDevApiOpenPlayback: Device init failed: 0x80004005
Failed to open the audio device
 
I have no idea if I am doing anything wrong but it happens only from time to time. Like if I start the game 5 times without changing any code at all, 2 of the times I'll get the error. Is it possible that it is from my audio devices? I only have some headphones which are quite new and I never had any problems with them.

2
Audio / Re: Divice init failed and format not supported error
« on: October 29, 2015, 01:11:21 pm »
Oh my gosh thanks a lot that was the problem. Thank you so much.

3
Audio / Divice init failed and format not supported error
« on: October 29, 2015, 12:26:14 pm »
So I started learning sfml really soon so I'm new here. I encountered a problem with playing audio. Here is the full error I get :
"AL lib: (EE) MMDevApiOpenPlayback: Device init failed: 0x80004005
Failed to open the audio device
Failed to open sound file (format not supported) "

Here is the code I use for playing music:

class ServiceLocator
{
public:
   static IAudioProvider* GetAudio() { return _audioProvider; }const

   static void RegisterServiceLocator(IAudioProvider *provider)
   {
      _audioProvider = provider;
   }

private:
   static IAudioProvider *_audioProvider;
};

//...

void SFMLSoundProvider::PlaySong(std::string filename, bool looping)
{      
        _music.openFromFile(filename);
        _music.setLoop(looping);
        _music.play();
}

//...

void Game::Start(void)
{
        if (_gameState != Uninitialized)
                return;

        _mainWindow.create(sf::VideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 32), "Pang!");

        SFMLSoundProvider soundProvider;
        ServiceLocator::RegisterServiceLocator(&soundProvider);

        ServiceLocator::GetAudio()->PlaySound("music\\Techno-Celebration.wav");

        _gameState = Game::ShowingSplash;

        while (!IsExiting())
        {
                GameLoop();
        }

        _mainWindow.close();
}
 

I don't have problem with my audio devices. And I think I have everything linked correctly because everything else is working. And I have the OpenAl.dll in the correct directory.

Pages: [1]