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

Author Topic: sf::SoundBuffer bad exit status  (Read 3208 times)

0 Members and 1 Guest are viewing this topic.

bambitheslug

  • Newbie
  • *
  • Posts: 2
    • View Profile
sf::SoundBuffer bad exit status
« on: July 28, 2012, 06:10:45 am »
First post!  ;D

I'm using a CMake build of a recent SFML 2.0 development snapshot on Windows 7 Starter 32-bit (netbook... only while I'm out of my home country) in Code::Blocks 10.05 + MinGW.

I've tested every other SFML module besides Audio and they all worked flawlessly. I followed SFML Coder's Youtube tutorials and everything seems to be set up and working properly. I made sure to put the audio extlibs in my project folder as well.

However, when trying to perform even the most basic audio tasks, I get a weird exit status. Here is my test code:

Code: [Select]

#include <SFML/Audio.hpp>

int main()
{
    sf::SoundBuffer Buffer;
    if (!Buffer.loadFromFile("sound.ogg"))
    {
        return 1;
    }

    sf::Sound Sound(Buffer);

    Sound.play();

    while (Sound.getStatus() == sf::Sound::Playing)
    {
        sf::sleep(sf::seconds(1));
    }

    return 0;
}


The sound plays just fine and the program behaves as expected EXCEPT I keep getting this in the debug console:

Code: [Select]


Process returned -2147418113 (0x8000FFFF)   execution time : 2.505 s
Press any key to continue.


And I get this in the build log:

Code: [Select]
Process terminated with status -2147418113 (1 minutes, 1 seconds)

*Note: The times are only different because I had to copy/paste text, not because there was a large delay in the program.*

I tried the exact tutorial sample program word for word (except for API changes since 1.6) and got the same exit code. I also tried with a longer music file and got the same results. I even tried just opening the sound file with the SoundBuffer constructor without even creating or playing the sf::Sound and I STILL got the error code, which suggests the problem is related to SoundBuffer.

HOWEVER, I did get a 0 exit status twice, once with the short sound effect and once with the music file, but haven't been able to reproduce them again, which makes me wonder if it's a concurrency issue. Still, it seems very strange that I got the bad exit status even when I didn't create a corresponding sf::Sound object.

I also apologize for not doing as thorough of an Internet search as usual because I'm currently in a place with very sparse Internet access and I have other things to take care of at the moment, so I decided to post while I can.

So I guess my questions are:

  • Is this a known sf::SoundBuffer problem with a known solution?
  • Am I / the tutorial missing something important like closing a file?
  • Could this have something to do with being on a slow netbook?
  • Does this appear to be a concurrency issue?

You don't have to answer all of those, I just wanted to get the discussion going. Thank you everybody for your help!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: sf::SoundBuffer bad exit status
« Reply #1 on: July 28, 2012, 09:49:25 am »
Laurent Gomila - SFML developer

bambitheslug

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: sf::SoundBuffer bad exit status
« Reply #2 on: July 28, 2012, 10:55:03 pm »
I've actually forgotten all about how to use GDB so I don't know how to trace the problem to the audio device deconstructor, but I also get the problem with that minimal code just creating an sf::Sound instance. I'm guessing it's the same problem. Anyway, since this won't be my main development PC, I won't worry about it until I get back home.

I don't know much since I'm brand new to SFML, but it seems from that link that there currently isn't a quality solution to the problem, right? It would be nice to have a good exit status, but it doesn't seem to interfere with the audio functionality of the program, so I guess it's just an annoyance more than anything. Anyway, I love SFML, it's by far the easiest library to build and use that I've ever tried! I'll definitely be using it more and more.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: sf::SoundBuffer bad exit status
« Reply #3 on: July 28, 2012, 11:06:32 pm »
Linking SFML statically should hide the problem.
Laurent Gomila - SFML developer

Yukilay

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
Re: sf::SoundBuffer bad exit status
« Reply #4 on: January 28, 2013, 02:42:17 pm »
Hi, I've just got the same problem.

I don't want 'hide' the problem else 'fix' it :-\

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: sf::SoundBuffer bad exit status
« Reply #5 on: January 28, 2013, 03:06:23 pm »
Everything that you need to know is in https://github.com/SFML/SFML/issues/30
Laurent Gomila - SFML developer