SFML community forums
Help => Audio => Topic started by: Kivattt on August 24, 2018, 09:44:24 pm
-
I tried posting this before, I got the msg that it was already posted, but I didn't see any posts by me. I hope I'm not reposting anything
Hello, I'm trying to play a wav file using sf::Sound. The buffer I'm using loads the file, and the sound's status is sf::Sound::Playing. I can't hear anything though. Any idea why? I've had problems with jack before. See https://ibb.co/m0mYTU for code, and https://ibb.co/dJa5a9 for output.
-
Have you tried adding sleep or getline to not let your main quit instantly?
-
Meaning if you don't actually wait for the sound to finish playing and just quite the main function, your sound objects will be destroyed and you application will be terminated.
You can have a while loop that checks the status and to prevent the loop from eating up the full process time, you can add a sleep for a few milliseconds every loop iteration.
Also it's better to post short code snippets directly here as text with the [code=cpp][/code] tags rather than externally hosted or even worse posted as image. ;)
-
Have you tried adding sleep or getline to not let your main quit instantly?
Silly me, that made it work
-
At least it's not an actual bug and if you ever need to ask something else you already have the forum account. ;D
And it gave me a good giggle during a busy week. :P