SFML community forums

Help => Audio => Topic started by: kevincentius on December 13, 2014, 10:03:13 am

Title: sf::sound.setBuffer(...) - how to switch buffer without tiny sound lag?
Post by: kevincentius on December 13, 2014, 10:03:13 am
Let's say I have two SoundBuffer objects Buffer1 and Buffer2.

I have a Sound object, which is currently playing from Buffer 1 with looping on.
At certain times, the Sound object must switch between playing from Buffer 1 and playing from Buffer 2.

But when switching buffers, the sound gets briefly interrupted.
Imagine both buffers simply contain a sine wave: I want to switch buffers, but still hears a continuous, uninterrupted sine wave, as it would have been if I did not switch buffers.

My code goes something like this:

    sf::Time offset = sound.getPlayingOffset();
    sound.setBuffer(Buffer2);
    sound.setPlayingOffset(offset);

So, how can I achieve uninterrupted sound when switching buffers? Thanks!!
Title: AW: sf::sound.setBuffer(...) - how to switch buffer without tiny sound lag?
Post by: eXpl0it3r on December 13, 2014, 10:09:12 am
Use two sound objects. ;)