Using SDL to make a simple game and I have music playing in the background from the start of the program, but I want to be able to check when the music has stopped playing so that the next track can be started. I'm using the SDL_mixer library to load and play the music.
bool loadTrack()
{
song = Mix_LoadMUS( "backgroundmusic.mp3" );
if (song == NULL)
{
return false;
}
else
{
Mix_PlayMusic(song, -1);
return true;
}
}
I'm loading and playing the music in a class I made called music, song is defined in the class constructor as NULL then give it the track name and play it in the "loadTrack" method in that class. I want to use another method in the class that can be called and returns true if the track has finished playing and false if it is still playing. My problem is having no idea how to check if the track is still playing or if the mixer libraries has its own function for checking if it is still playing.