1
Audio / [SFML] Audio file won't load
« on: January 11, 2013, 09:21:33 pm »
Hello dear SFML programmers,
I am having an issue which I have been trying to resolve the past few days. I am not able to load/play music files.
Example:
The program immediately closes therefore it is obvious that the sound file "mainMusic.wav" does not open.
Yes, the .wav file exists. I have all needed .dll files. I am running the SFML 2.0 version, Windows 7. I have included the .lib files for dynamic linkage.
Could you, please, help me?
Thank you in advance.
Sincerely yours,
Brukmoon
I am having an issue which I have been trying to resolve the past few days. I am not able to load/play music files.
Example:
Code: [Select]
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode(sf::VideoMode::getDesktopMode()), "SFML");
sf::SoundBuffer buffer;
if (!buffer.loadFromFile("mainMusic.wav"))
return -1;
sf::Sound sound;
sound.setBuffer(buffer);
sound.play();
while(window.isOpen())
{
sf::Event event;
while(window.pollEvent(event))
{
if(event.type == sf::Event::Closed)
window.close();
}
}
}
The program immediately closes therefore it is obvious that the sound file "mainMusic.wav" does not open.
Yes, the .wav file exists. I have all needed .dll files. I am running the SFML 2.0 version, Windows 7. I have included the .lib files for dynamic linkage.
Could you, please, help me?
Thank you in advance.
Sincerely yours,
Brukmoon