Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Newbie Problem sf::Music cannot end music thread  (Read 6046 times)

0 Members and 1 Guest are viewing this topic.

Agito

  • Newbie
  • *
  • Posts: 4
    • View Profile
Newbie Problem sf::Music cannot end music thread
« 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

nulloid

  • Full Member
  • ***
  • Posts: 134
    • View Profile
Newbie Problem sf::Music cannot end music thread
« Reply #1 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 :)

Agito

  • Newbie
  • *
  • Posts: 4
    • View Profile
Newbie Problem sf::Music cannot end music thread
« Reply #2 on: March 26, 2010, 03:16:42 pm »
Well, I am not sure wether this is a bug or just me being stupid...

nulloid

  • Full Member
  • ***
  • Posts: 134
    • View Profile
Newbie Problem sf::Music cannot end music thread
« Reply #3 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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Newbie Problem sf::Music cannot end music thread
« Reply #4 on: March 26, 2010, 05:16:17 pm »
You should show us your code (a minimal one, if it's too big).
Laurent Gomila - SFML developer

Agito

  • Newbie
  • *
  • Posts: 4
    • View Profile
Newbie Problem sf::Music cannot end music thread
« Reply #5 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

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Newbie Problem sf::Music cannot end music thread
« Reply #6 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 ;)
Laurent Gomila - SFML developer

Agito

  • Newbie
  • *
  • Posts: 4
    • View Profile
Newbie Problem sf::Music cannot end music thread
« Reply #7 on: March 26, 2010, 05:58:47 pm »
found the problem, the while(1) loop was the problem

 

anything