Re: Does holding sounds in memory make sense?

Yeah, and this is similar to what the BGT cloning feature does. When you first load a given sound, it stores its metadata in memory somehow, don't ask me how exactly, so that every other time you load that same sound with the same name and characteristics, it remembers it and no longer reads the raw data from disk any more but rather only fetches the actual sound from its stored memory representation, no matter whether the newly loaded copy comes from the same or a different location on disk, from a pack file, from memory or anywhere else. However, for this to work properly, you need to keep at least one sound object in memory which stores that sound at all times. That's why the preload approach works well in conjunction with this feature to help prevent CPU or hard drive overload. As soon as you close the very last available sound object holding this very sound, BGT forgets that metadata in order to help save memory because it assumes this specific sound is no longer needed for now.

At the start of a game round in all of my projects, I always load every single sound I know I will need into an array of sound objects called preloads, and I only purge this array (resize it to 0) at the end of the game round, so I reliably know all these sounds will always be there no matter what. Then, I manipulate the actual individual in-game sounds through the sound pool and in no other way any more.

Hope this helps,
Lukas

_______________________________________________
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Rastislav Kiss via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : roelvdwal via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : lukas via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Rastislav Kiss via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : lukas via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Trajectory via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : roelvdwal via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : lukas via Audiogames-reflector

Reply via email to