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

Author Topic: SFML Audio 1.5 WAV File Not Playing  (Read 10790 times)

0 Members and 1 Guest are viewing this topic.

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
SFML Audio 1.5 WAV File Not Playing
« on: August 14, 2009, 06:12:19 am »
I have tried everything, including resetting the buffer when I load a sound. The Console isn't telling me anything that could be causing the problem, either. Currently I am using:
Sound.LoadFromFile("Resources/SFX/Jump.wav");
                SFX.SetBuffer(Sound);
                SFX.Play();
Yes, I have confirmed that the file exists. SFX was initialized as sf::Sound SFX(Sound), and Sound IS a SoundBuffer. Could it be a problem with the file itself?
I use the latest build of SFML2

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
SFML Audio 1.5 WAV File Not Playing
« Reply #1 on: August 14, 2009, 08:43:58 am »
Can you provide a complete / minimal code that reproduces the problem? It would be helpful to have the sound file, too.
Laurent Gomila - SFML developer

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
SFML Audio 1.5 WAV File Not Playing
« Reply #2 on: August 14, 2009, 09:48:44 pm »
Code: [Select]
#include <SFML/Audio.hpp>

sf::SoundBuffer Sound;
sf::Sound SFX(Sound);

int main()
{
 Sound.OpenFromFile("Resources/SFX/Jump.wav");
 SFX.Play();
 while(SFX.Playing)
 {
 }
 return EXIT_SUCCESS;
}


Sound inside the folders: http://www.mediafire.com/?owkkttdztzn
Link with Audio and System.
BTW, I tried the latest SVN Repository version and tried to statically link: Now my OGG files are being called "malformed". They worked before in SFML 1.5, so I dunno what's wrong. The WAV still doesn't work in the SVN sfml2 Version either.
I use the latest build of SFML2

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
SFML Audio 1.5 WAV File Not Playing
« Reply #3 on: August 14, 2009, 11:21:35 pm »
Well, a code that you actually tried would be more useful (this one doesn't even compile, and throws lots of messages when you fix the syntax errors).

This one works perfectly:
Code: [Select]
#include <SFML/Audio.hpp>

int main()
{
    sf::SoundBuffer Sound;
    Sound.LoadFromFile("jump.wav");

    sf::Sound SFX(Sound);
    SFX.Play();

    while(SFX.GetStatus() == sf::Sound::Playing)
    {
    }

    return EXIT_SUCCESS;
}


-> Don't do anything outside main()
-> Don't pass the buffer to the sound before loading the sound file
Laurent Gomila - SFML developer

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
SFML Audio 1.5 WAV File Not Playing
« Reply #4 on: August 15, 2009, 02:35:52 am »
Quote from: "Laurent"
Well, a code that you actually tried would be more useful (this one doesn't even compile, and throws lots of messages when you fix the syntax errors).

This one works perfectly:
Code: [Select]
#include <SFML/Audio.hpp>

int main()
{
    sf::SoundBuffer Sound;
    Sound.LoadFromFile("jump.wav");

    sf::Sound SFX(Sound);
    SFX.Play();

    while(SFX.GetStatus() == sf::Sound::Playing)
    {
    }

    return EXIT_SUCCESS;
}


-> Don't do anything outside main()
-> Don't pass the buffer to the sound before loading the sound file
Wait, what syntax errors? That's a stripped down version of the code I'm using.

Anyways, I did what you said and it works now, but there's still the problem of Audio thinking my OGG Vorbis Audio files are corrupt.
I use the latest build of SFML2

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
SFML Audio 1.5 WAV File Not Playing
« Reply #5 on: August 15, 2009, 10:15:01 am »
Quote
Wait, what syntax errors? That's a stripped down version of the code I'm using.

OpenFromFile is a member of sf::Music, not sf::SoundBuffer.
SFX.Playing is a constant, so you get an endless loop (ok, this is not really a syntax error).

Quote
there's still the problem of Audio thinking my OGG Vorbis Audio files are corrupt.

So I guess they are. SFML 2.0 uses the official ogg/vorbis libraries, whereas in 1.5 it was an implementation written from scratch (not by me).
Laurent Gomila - SFML developer

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
SFML Audio 1.5 WAV File Not Playing
« Reply #6 on: August 16, 2009, 05:38:36 am »
Quote from: "Laurent"
Quote
Wait, what syntax errors? That's a stripped down version of the code I'm using.

OpenFromFile is a member of sf::Music, not sf::SoundBuffer.
SFX.Playing is a constant, so you get an endless loop (ok, this is not really a syntax error).

Quote
there's still the problem of Audio thinking my OGG Vorbis Audio files are corrupt.

So I guess they are. SFML 2.0 uses the official ogg/vorbis libraries, whereas in 1.5 it was an implementation written from scratch (not by me).
Ack, why do I make so many mistakes?!
I guess Audacity 1.3.8 doesn't correctly support OGGs, cause that's what I'm using to create them. :\ I wonder if there are any fixes.
I use the latest build of SFML2

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
SFML Audio 1.5 WAV File Not Playing
« Reply #7 on: August 17, 2009, 12:59:09 am »
I found the problem. libsndfile-1.dll was outdated by 2 years. :|
I use the latest build of SFML2

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
SFML Audio 1.5 WAV File Not Playing
« Reply #8 on: August 17, 2009, 10:45:36 am »
Hehe, you should always use the DLLs provided in the SFML/extlibs folder :)
Laurent Gomila - SFML developer

 

anything