SFML community forums

Help => Audio => Topic started by: Agito on March 26, 2010, 01:15:37 pm

Title: Newbie Problem sf::Music cannot end music thread
Post by: Agito on March 26, 2010, 01:15:37 pm
Hi guys/girls,

I started coding a simple breakout clone and used the sf::Music class for the background music.
The problem is, the programm can be exited by pressing [exit] or simply clicking the [X]. After the main programm closes, the sound continues to run.
I am using Ubuntu 9.04 with SFML 1.5.

In System Monitor I see the main programm (the music thread part I guess) after I closed the main programm. I tried the Stop() funnction and creating the Music object on the Heap and deleting it, but this part of the programm just won't quit, and I cannot access Terminate() since its declared private in the class above sf::Music

I guess I am overlooking something, is there a way to end the Music thread before the whole soundfile has played?

thx in advance,
Agito
Title: Newbie Problem sf::Music cannot end music thread
Post by: nulloid on March 26, 2010, 02:01:11 pm
Well, until other solutions, would you give 1.6 a try? There is a lot of bug fixed in that. Switching from 1.5 to 1.6 also fixed my problem, so mybe it worth a try :)
Title: Newbie Problem sf::Music cannot end music thread
Post by: Agito on March 26, 2010, 03:16:42 pm
Well, I am not sure wether this is a bug or just me being stupid...
Title: Newbie Problem sf::Music cannot end music thread
Post by: nulloid on March 26, 2010, 04:10:08 pm
It seems to me, that this should be a bug, cause I think that's the way, how sf::Music meant to be used.
Title: Newbie Problem sf::Music cannot end music thread
Post by: Laurent on March 26, 2010, 05:16:17 pm
You should show us your code (a minimal one, if it's too big).
Title: Newbie Problem sf::Music cannot end music thread
Post by: Agito on March 26, 2010, 05:30:31 pm
http://codepad.org/JnBsV8mQ heres my full code, all in one file

i'm really puzzled about this
Title: Newbie Problem sf::Music cannot end music thread
Post by: Laurent on March 26, 2010, 05:39:03 pm
You should try two things:
1. allocate the music on the stack, so that you don't need to call Stop() and delete.
2. remove all the graphics part so that we can focus on the problem ;)
Title: Newbie Problem sf::Music cannot end music thread
Post by: Agito on March 26, 2010, 05:58:47 pm
found the problem, the while(1) loop was the problem