Не воспроизводится музыка SFML
Когда я запускаю игру, sf::Music
не воспроизводится. Я закрываю окно и вижу в консоли вот это:
AL lib: (EE) ALCmmdevPlayback_mixerProc: Failed to get padding: 0x88890004
Failed to open sound file "Assets/Boiler.ogg" (couldn't open stream)
Error when opening music
Failed to play audio stream: sound parameters have not been initialized (call initialize() first)
main.cpp:
int main()
{
srand(time(NULL));
Game game;
game.run();
return 0;
}
Game.hpp:
class Game
{
public:
Game();
~Game();
void run();
void update();
void render();
private:
//Variables
sf::RenderWindow* window;
sf::Event sfEvent;
sf::Music music;
//Initialization
void init();
void initWindow();
void initMusic();
};
Game.cpp:
Game::Game()
{
init();
}
Game::~Game()
{
this->music.stop();
delete this->window;
}
void Game::run()
{
this->music.play();
while (this->window->isOpen())
{
this->update();
this->render();
}
}
void Game::init()
{
this->initWindow();
this->initMusic();
}
void Game::initWindow()
{
this->window = new sf::RenderWindow(sf::VideoMode::getDesktopMode(), "Arkanoid", sf::Style::Fullscreen);
this->window->setFramerateLimit(60);
this->window->setMouseCursorVisible(false);
}
void Game::initMusic()
{
if (!this->music.openFromFile("Assets/Boiler.ogg"))
{
std::cout << "Error when opening music\n";
}
this->music.setLoop(true);
}
sfml-audio-d.lib
и <SFML/Audio.hpp>
тоже подключены.