Memory-safe way of audio playback in XNA -
i using xna's soundeffect
class play sounds in game project. while memory management of directly soundeffect.play()
ing effects relatively clear me (soundeffectinstances
internally created , added lists, , memory removed upon sound stopping), know advised when directly creating soundeffectinstances
e.g. control audio playback (volume etc.) after instance.play()
.
currently, sound effects need control after creation use special class in constuctor creates new instance by:
instance = loadeffect(indexinsoundlibrary).createinstance();
while in destructor of class calls:
instance.dispose();
in summary, use collection of ~400 sound files (just filename) dynamically loaded whenever needed. make sense keep number of soundeffectinstances
in memory (e.g. audio files in collection typically played creating soundeffectinstance
(and not directly using soundeffect.play()
)?
are there limitations of how many soundeffectinstances
can kept in memory @ time?
just additional information, use multiple contentmanagers , regularly unload
unused sounds.
Comments
Post a Comment