SFML community forums

Help => Audio => Topic started by: Me-Myself-And-I on May 30, 2024, 03:46:49 pm

Title: sf::sound causes severe performance lag.
Post by: Me-Myself-And-I on May 30, 2024, 03:46:49 pm
I'm having trouble getting around this. If I play a simple sound it always makes the program lag. Is there something that i'm doing wrong with sf::Sound?

I have a simple script that happens only once.
                buffer[4].loadFromFile("ASSETS/thunder.wav");
                sound[4].setBuffer(buffer[4]);
                sound[4].play();
 
Its only an array of 10 sounds and an array of 10 buffers. Any clues as to why it causes a lag? More specifically, I notice a definite lag in graphics when this happens.
Title: Re: sf::sound causes severe performance lag.
Post by: fallahn on May 30, 2024, 05:11:08 pm
Make sure you're only loading the buffer from file *once* then keeping it around, and not trying to load it every frame
Title: Re: sf::sound causes severe performance lag.
Post by: Me-Myself-And-I on May 30, 2024, 11:30:26 pm
That fixed it.Thanks