SFML community forums
Help => Audio => Topic started by: darthspawn on October 08, 2009, 11:48:41 am
-
Hi to all, I've just downloaded SFML, i'm using it with u++.
I have the dll openal32 and libsndfile-1 in the program directory, but when I do a OpenFromFile, for load an ogg file in a Music object, or LoadFromFile for load in a soundbuffer a wav file, the file is not loaded.
Any suggestion?
Sam
-
the file is not loaded
What does this mean? What error do you get, and from where?
-
OpenFromFile return 0, and myduration and myFile are 0
But i have verified that the file exist. Maybe I must include or define something, or add some library? thanks
Sam
-
OpenFromFile return 0
Then you must check the standard error output for a more detailed message.
But it will probably say that it can open the file, which would mean that your current working directory is not the one containing the files. Are you launching the program from the IDE?
-
OpenFromFile return 0
Are you launching the program from the IDE?
Yes, but also if I launch the program manually the file is not found, and also if I put a full path "C:\\sound.wav"
-
What error message do you get in the standard output?
-
What error message do you get in the standard output?
Failed to load sound buffer to file
-
Can you send me your program (with source code) and the audio file?
-
This is the code, I'm using U++ libraries, the file is "ding.wav" from windows, how can I send it?
#include <Core/Core.h>
#include <SFML/Audio.hpp>
#include <iomanip>
#include <iostream>
using namespace Upp;
CONSOLE_APP_MAIN
{
sf::SoundBuffer Buffer;
if (!Buffer.LoadFromFile("ding.wav"))
return;
// Create a sound instance and play it
sf::Sound Sound(Buffer);
Sound.Play();
}
-
Strange! with the debug libraries the application works correctly
-
I got the same. I use Windows XP, Visual Studio 2008, SFML2, and a crappy notebook.
Whethever I try to load the lepidoptera.ogg (haven't tried other oggs) the console shows:
"Failed to read sound file "lepidoptera.ogg" (Supported file format but file is malformed).
I tried the same code compiling with SFML-1.5, it works well both in Debug and Release mode.
-
You have to update your sndfile.dll from the one in sfml2/extlibs.