SFML community forums

Help => Audio => Topic started by: Gregory on October 16, 2010, 03:47:26 am

Title: A lot of sf::Sounds
Post by: Gregory on October 16, 2010, 03:47:26 am
hey guys! in my top down view game, for the enemys's shoot sound i have one "main" sf::SoundBuffer and each enemy have sf::Sound but some times when the enemy shoot his soud dont play
Title: A lot of sf::Sounds
Post by: Laurent on October 16, 2010, 09:22:05 am
There's a maximum number of sf::Sound allowed, so you should reuse sound instances instead of creating new ones.
Title: A lot of sf::Sounds
Post by: Gregory on October 16, 2010, 07:18:38 pm
i'm thinking in put in a variable the times i need to play the sound and in the end of the frame  i use some 10 sf::Sounds and play it the times that is in the list
Title: A lot of sf::Sounds
Post by: fieryrage on January 26, 2011, 07:18:19 am
Quote from: "Laurent"
There's a maximum number of sf::Sound allowed, so you should reuse sound instances instead of creating new ones.


I just joined this forum and was about to make a new post until I found this thread. What is the maximum number of sf::Sound allowed?
Title: A lot of sf::Sounds
Post by: Laurent on January 26, 2011, 07:38:20 am
Quote
What is the maximum number of sf::Sound allowed?

This is implementation dependent, but if yours is OpenAL-Soft (which should be, on all platforms supported by SFML), then it's probably 512.
Title: A lot of sf::Sounds
Post by: Groogy on January 26, 2011, 08:10:40 am
Just wondering what happens if we create and then destroy sound instances, can it then create a new one? Like, we create 512 sound objects and destroy 2. Does that mean we can create 2 new ones? Or should we create a pool similar to a thread/task pool?
Title: A lot of sf::Sounds
Post by: Laurent on January 26, 2011, 08:18:04 am
Yes, when you destroy a sound instance it frees a slot and you can create a new one. You don't have to manage a pool.