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.