On Jul 27, 2010, at 8:14 PM, Thomas Ward wrote: Hi travis, Hmmm...That's what I was afraid of. Back during the winter when I was thinking about a cross-platform engine I tried both SFML and SDL extensively and was able to do what you did witht the sound objects by using the sf::Sound::SetBuffer() function to reassign buffers. As you pointed out it solves the problem of reassigning a sound object to a new sound buffer, but it waistes a lot of memory in the process. Even worse this kind of creating a buffer without the ability to destroy it when you are done with it can lead to a major memory leak in your program.
I just asked on the sfml forums, and I'm guessing the developer of sfml doesn't use english as his first language, (though he does speak it quite well) my first attempt met with confusion, pointing me to the sounds instead of their buffers. Further clarification lead to the answer you wanted. Apparently, you can clear a buffer (if you want to use it later) simply by assigning it an empty resource. I.E. buffer = SoundBuffer(); This will reassign the buffer to null, thereby allowing the memory to be used for other things. If you allocate the buffer using new, you could also free it (permanently) by using delete. I didn't set mine up that way in the chopper patrol port, so teh new/delete wouldn't work, but the reassigning buffers to empty values does seem to do the trick though. Hope this helps. --- Gamers mailing list __ [email protected] If you want to leave the list, send E-mail to [email protected]. You can make changes or update your subscription via the web, at http://audyssey.org/mailman/listinfo/gamers_audyssey.org. All messages are archived and can be searched and read at http://www.mail-archive.com/[email protected]. If you have any questions or concerns regarding the management of the list, please send E-mail to [email protected].
