I'm trying to make an audio manager that stores the pointers of sound buffer in a **map**.
Retrieving the sound buffer pointers and playing them works fine inside the main function.
But when you play a sound outside the main function, it doesn't. Even when the sound buffer still exists.
An example code that recreates this problem:
void say()
{
sf::SoundBuffer buffer;
buffer.loadFromFile("Assets/Audio/burp.wav");
sf::Sound sound;
sound.setBuffer(buffer);
sound.play(); // Doesn't play the sound.
}
int main()
{
say();
// SFML window stuff...
}