Hello! I am working on a game and I load all resources from zip file using PhysFS. I am using this class from SFML wiki:
https://github.com/SFML/SFML/wiki/Source:-PhysicsFS-Input-StreamAnd I have noticed strange behaivour: if I open PhysFsStream once, open music from it, then everything is OK. But if I do this again (to change current music) - my application hangs (100% of CPU core).
Minimal code (all variables are class members):
//GameState
//init() - called once when game state is shown up
pfsStream.open("music/1.ogg");
music.openFromStream(pfsStream);
music.play();
//input() - called on input.
music.stop();
pfsStream.open("music/2.ogg");
music.openFromStream(pfsStream);
music.play();
My PhysFS setup is fully wokrable (I use the same way to load textures, sounds, they are all working and loaded correctly).
After debugging application for some time, I ended on this code in sf::SoundStream:
void SoundStream::stop()
{
// Request the thread to terminate
{
Lock lock(m_threadMutex);
m_isStreaming = false;
}
...
I wil really appreciate any help concerning this topic, maybe newer version of PhysFS stream or any possible fixes.