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

Author Topic: Sound.Play() always restarts sound in SFML2?  (Read 2539 times)

0 Members and 1 Guest are viewing this topic.

Lupinius

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Sound.Play() always restarts sound in SFML2?
« on: September 26, 2010, 06:47:32 pm »
When I'm calling Play() on a already playing or paused sound in SFML2 the sound restarts, instead of continuing like documented.

Some minimal code:
Code: [Select]

#include <SFML/Audio.hpp>

int main(int argc, char** argv) {

    sf::SoundBuffer buffer;
    buffer.LoadFromFile("sound.wav");
    sf::Sound sound(buffer);

    while(true) {
        sound.Play();
        sf::Sleep(0.01);
    }

    return 0;
}

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Sound.Play() always restarts sound in SFML2?
« Reply #1 on: October 06, 2010, 11:13:26 pm »
In fact there was an error in the documentation, this is the expected behaviour. However when you call Play() after Pause() it resumes from the current position, not from beginning.

Thanks for your feedback.

And sorry for the late answer!
Laurent Gomila - SFML developer