SFML community forums

Help => Audio => Topic started by: Barkypoo on April 27, 2018, 01:28:56 am

Title: How to get the current audio sample during realtime using sf::Music?
Post by: Barkypoo on April 27, 2018, 01:28:56 am
Title says it all, really

I've been working on a FFT application, and been using sf::Sound since then. However, when playing big files (1+ minute) you can perceive some lag in it, at certain times.

How do I, then, get the same result from
mySoundBuffer.getSamples()[iterator]
into
sf::Music
?
Title: Re: How to get the current audio sample during realtime using sf::Music?
Post by: eXpl0it3r on April 27, 2018, 09:27:30 am
As shown in the official tutorial (https://www.sfml-dev.org/tutorials/2.4/audio-streams.php). Keep in mind that this is always just an approximation to "real-time" as you can't fully know when the samples are really being played, but this should get you very close to it. ;)