Let's say I have a Music object and I load a certain song to it:
sf::Music song;
song.openFromFile("path.wav");
song.play();
I want to know if a song ended playing or not. If it did I want to load another song. I tried doing something like this:
if (song.getStatus() == sf::Music::Status::Stopped) {
song.openFromFile("anothersong.wav");
song.play();
}
But it doesn't work and the problem seems to be with the condition. This one doesn't say me if the song ended. When the song ends status should be set to stopped, right? I thought so and I thought that my code would work, but it doesn't. I tried several things (I thought about checking song duration, and counting time) and I checked if getStatus() method returns the right value (when I press "S" the song stops playing and its status is set to Stopped, when I press "P" the song starts playing and its status is set to Playing - that works fine, but seems that when the song ends status is still set to Playing). How can I check if song ended playing?