i'm currently working on a small game with sfml.
For resource loading and holding i'm using the ResourceHolder described in the SFML Game Development Book: SFML ResourceHolder Basically the resources are stored as unique_ptr in a map.
Inside a SoundManager class i'm loading different sounds to this ResourceHolder. This SoundManager has a playSound function when i want to play a sound.
void SoundManager::playSound(SoundType soundToPlay) {
auto buffer = sounds.get(soundToPlay);
auto sound = sf::Sound(buffer);
sound.play();
}
but i don't hear any sounds. Do i have to store different sound objects for every sound in a map? I also tried to use a sf::Sound object as a class member, but this also didn't worked.
Using this ResourceHolder my textures are loaded correctly.
Thank you for you help
I was able to fix this issue with some enter link description here in the sfml-dev forum.