#include <SFML/System.hpp>
#include <SFML/Audio.hpp>
int main() {
sf::SoundBuffer buffer;
buffer.loadFromFile("sounds/ballhurtbar.wav");
sf::Sound sound;
sound.setBuffer(buffer);
sound.play();
const auto delay = sf::milliseconds(1);
do {
sf::sleep(delay);
} while(sound.getStatus() == sf::SoundSource::Playing);
}
$ g++ -std=c++11 -o play -lsfml-audio -lsfml-system play.cc
$ ./play