void PlaySound(string &filename){
Music music;
music.openFromFile(filename.c_str());
music.play();
}
This code doesn't play music, but if I try to play music in main.cpp, everything is ok.
void PlaySound(string &filename){
Music music;
music.openFromFile(filename.c_str());
music.play();
}
This code doesn't play music, but if I try to play music in main.cpp, everything is ok.
This is not an SFML forum.
But to answer your question, you probably need to keep the Music object alive longer than the scope of the function.