Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: LoadFromFile doesn't work  (Read 7290 times)

0 Members and 1 Guest are viewing this topic.

darthspawn

  • Newbie
  • *
  • Posts: 6
    • View Profile
LoadFromFile doesn't work
« 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

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
LoadFromFile doesn't work
« Reply #1 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?
Laurent Gomila - SFML developer

darthspawn

  • Newbie
  • *
  • Posts: 6
    • View Profile
LoadFromFile doesn't work
« Reply #2 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

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
LoadFromFile doesn't work
« Reply #3 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?
Laurent Gomila - SFML developer

darthspawn

  • Newbie
  • *
  • Posts: 6
    • View Profile
LoadFromFile doesn't work
« Reply #4 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"

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
LoadFromFile doesn't work
« Reply #5 on: October 08, 2009, 03:43:26 pm »
What error message do you get in the standard output?
Laurent Gomila - SFML developer

darthspawn

  • Newbie
  • *
  • Posts: 6
    • View Profile
LoadFromFile doesn't work
« Reply #6 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

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
LoadFromFile doesn't work
« Reply #7 on: October 08, 2009, 05:03:23 pm »
Can you send me your program (with source code) and the audio file?
Laurent Gomila - SFML developer

darthspawn

  • Newbie
  • *
  • Posts: 6
    • View Profile
LoadFromFile doesn't work
« Reply #8 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();
}

darthspawn

  • Newbie
  • *
  • Posts: 6
    • View Profile
LoadFromFile doesn't work
« Reply #9 on: October 08, 2009, 05:22:23 pm »
Strange! with the debug libraries the application works correctly

panithadrum

  • Sr. Member
  • ****
  • Posts: 304
    • View Profile
    • Skyrpex@Github
    • Email
LoadFromFile doesn't work
« Reply #10 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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
LoadFromFile doesn't work
« Reply #11 on: November 23, 2009, 10:31:07 am »
You have to update your sndfile.dll from the one in sfml2/extlibs.
Laurent Gomila - SFML developer

 

anything