I updated my driver (by the Realtek website), changed the PC, but nothing changed. It must have something to do with my code.
I tried to disable any SFML dependency gradually. The error never happen if I don't instanciate any sf::Sound classes. But my LoopingMusic class doesn't induce any error : it's based on a LoopingMusic class I found on Github, inherit from SoundStream, there are 4 of these playing at the same time (I'm experimenting things with music layers xD).
THEN it must come from my using of sf::Sound.
It's pretty sound intensive game with a lot of shooting, explosions, so I thought it was a good idea to prepare 8 layers of sounds, empty at start, that will be filled with previously loaded buffers and played when needed (32 different sounds).
If I simply load the SoundBuffer in memory, no crash, But if I have some prepared sound that plays nothing, here come the crash.
Here is a minimal code (way simpler than the real one) :
class SoundManager {
sf::Sound soundLayers[NOOT_SOUNDLAYERS_COUNT];//"preparing" the layers, when I comment this line, no more crash
vector<sf::SoundBuffer> loadedSounds;
void PlaySound(int sound_id) {
for (int i=0;i<NOOT_SOUNDLAYERS_COUNT;i++) {
sf::Sound* sfsound=&soundLayers[i];
if (sfsound->getStatus()!=sf::Sound::Playing) {//if the layer isn't used
sfsound->setBuffer(*loadedSounds[sound_id]->buffer);
sfsound->play();
}
}
}
}
Is it a bad practice to keep empty sound that just wait to be filled and played ? Or may I instanciate them when needed then release them when they are Stopped ?