SFML community forums
Help => Audio => Topic started by: SuperCharger on April 01, 2016, 08:07:26 am
-
Not sure what I have done wrong or what I am missing but when I run this code I get
"Failed to open sound file "canary.wav" (couldn't open stream) message.
My code is:
sf::SoundBuffer music;
if (!music.loadFromFile("canary.wav"))
{
std::cout << "Error" << std::endl;
}
sf::Sound buffer(music);
buffer.play();
-
It means the wav file wasn't found. The errorr message is slightly misleading due to a bug that has already been fixed in master.
-
It means the wav file wasn't found. The errorr message is slightly misleading due to a bug that has already been fixed in master.
I currently have it located in my debug folder, where should I move it and what is the correct way to type in a string for loadFromFile(string)?
-
It needs to be in the working directory. If you use VS then that's by default next to your vcxprj file. The working directory can usually be changed in the project settings.
-
It needs to be in the working directory. If you use VS then that's by default next to your vcxprj file. The working directory can usually be changed in the project settings.
That worked, just moved the files, thankyou