#ifndef PLAY_HPP_INCLUDED
#define PLAY_HPP_INCLUDED
void Game::play(std::string soundName)
{
std::cout << "Loading sounds...\n";
if (!buffer.loadFromFile(soundName))
std::cout << "Error: Could not find sound file named " << soundName << " !\n";
sf::Sound sound;
sound.setBuffer(buffer);
sound.play();
std::cout << "Playing \"" << soundName << "\"\n";
}
#endif // PLAY_HPP_INCLUDED
'buffer' is declared outside, and is still in scope when play() is called, but the sound doesn't play. any ideas?