SFML community forums
Help => Audio => Topic started 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
-
There's a maximum number of sf::Sound allowed, so you should reuse sound instances instead of creating new ones.
-
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
-
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?
-
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.
-
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?
-
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.