SFML community forums

Help => Audio => Topic started by: darthspawn on October 08, 2009, 11:48:41 am

Title: LoadFromFile doesn't work
Post 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
Title: LoadFromFile doesn't work
Post by: Laurent on October 08, 2009, 02:41:42 pm
Quote
the file is not loaded

What does this mean? What error do you get, and from where?
Title: LoadFromFile doesn't work
Post by: darthspawn on October 08, 2009, 02:55:58 pm
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
Title: LoadFromFile doesn't work
Post by: Laurent on October 08, 2009, 02:58:28 pm
Quote
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?
Title: LoadFromFile doesn't work
Post by: darthspawn on October 08, 2009, 03:41:07 pm
Quote from: "Laurent"
Quote
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"
Title: LoadFromFile doesn't work
Post by: Laurent on October 08, 2009, 03:43:26 pm
What error message do you get in the standard output?
Title: LoadFromFile doesn't work
Post by: darthspawn on October 08, 2009, 04:59:10 pm
Quote from: "Laurent"
What error message do you get in the standard output?


Failed to load sound buffer to file
Title: LoadFromFile doesn't work
Post by: Laurent on October 08, 2009, 05:03:23 pm
Can you send me your program (with source code) and the audio file?
Title: LoadFromFile doesn't work
Post by: darthspawn on October 08, 2009, 05:06:41 pm
This is the code, I'm using U++ libraries, the file is "ding.wav" from windows, how can I send it?


Code: [Select]
#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();
}
Title: LoadFromFile doesn't work
Post by: darthspawn on October 08, 2009, 05:22:23 pm
Strange! with the debug libraries the application works correctly
Title: LoadFromFile doesn't work
Post by: panithadrum on November 23, 2009, 09:59:44 am
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.
Title: LoadFromFile doesn't work
Post by: Laurent on November 23, 2009, 10:31:07 am
You have to update your sndfile.dll from the one in sfml2/extlibs.