SFML community forums

Help => Audio => Topic started by: Lupinius on September 26, 2010, 06:47:32 pm

Title: Sound.Play() always restarts sound in SFML2?
Post by: Lupinius 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;
}
Title: Sound.Play() always restarts sound in SFML2?
Post by: Laurent 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!