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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - atmamta

Pages: [1]
1
Audio / Music how to?
« on: November 22, 2011, 06:06:53 pm »
...the problem is that your main thread exits before the audio playing thread could play any samples, and kills any spawned threads. if you insert this line right after sound.Play() the code will work fine.:

sf::Sleep(sound.GetDuration());

2
Audio / Loading .ogg Issue
« on: November 22, 2011, 05:52:28 pm »
..you need to tell the main thread to wait (or do something else) while the other thread playing the audio is executing. Otherwise it will immediately finish (and that will kill the audio thread as well, so you won't hear anything).

In your short example, you could use this code:

sf::Music music;
music.Play();
sf::Sleep(music.GetDuration());
return 1;

Pages: [1]
anything