SFML community forums
Help => Audio => Topic started by: wilrader on May 30, 2010, 08:04:17 am
-
Is it better to load all audio for a "level" all at once, or to load them as needed on the fly? The type of audio I'm thinking of would be, for example, random sound effects that are used maybe once or twice in the level.
Wil
ETA: Let me further elaborate. If, for example, I have a spatial sound effect that is toward the end of the level (say, the sound of a waterfall), should I have the audio looping the entire time and running or should I have the audio loaded but not playing until they are within distance or should I load the audio and play when they are within distance at the same time?
-
I think you should load sounds at initialization time, and play them when you need to. Loading a sound will always take a significant amount of time, and produce lag if you do it right before playing the sound.
-
I load all my sounds at level initialisation. As for your example, it's personal preference really. I would prefer to have it stopped, and only start playing it when you are nearly close enough to hear it. I think that's a cleaner approach than having it looping at zero volume. It doesn't seem much more difficult to code either.