Sound effects question

Started by
3 comments, last by CoderGuy 17 years, 11 months ago
The way our project is currently set up is that we will have to load all the sound effects ahead of time using OpenAL. All the tutorials we've seen have the sound effects all loaded at once during initialization. Is this how it is normally handled in games? Can we load up a sound effect when it is needed but yet have it be able to be played while other sound effects are going on?
Advertisement
Usually the SFX are in fact stored directly into RAM. Depending on RAM budgets and file size of SFX I've seen them streamed before, but it's not the best way to go typically...

If for sure a specific sound effect isn't going to be used then I'm sure you can dump it from the buffer if you're trying to squeeze in another sfx.

Do you have some RAM limitiations with something or what?

Tony
Thanks for the info...I do not have any problems with memory, I have just never programmed the music side and all the examples that I have seen load them at the same time. I wanted to know if that was the normal way of doing it for games or if there were better ways.

Thanks for the help
Disk I/O of any kind during a game level will typicall cause a glitch in the frame rate; it's a very noticeable jerk when that happens. Thus, most games pre-load everything they'll need for a level.

Some games, notably those with extremely large, "streaming" or "paging" worlds, will load and unload data as needed, and will use asynchronous I/O (on UNIX), overlapped I/O (on Windows), or a separate disk loading thread (any platform) to get rid of that glitch, because most of the glitch is just spent doing nothing while waiting for the call to read() to return (which in turn is waiting for hardware, so the CPU is idle).
enum Bool { True, False, FileNotFound };
Thank you very much hplus0603 and Tony for your replies. I'll pre-load the sound effects.

This topic is closed to new replies.

Advertisement