PurgeResources and audio
by Martin Andresen · in Torque Game Builder · 03/09/2007 (6:03 am) · 2 replies
I have an audio problem I hope someone can help me with:
For music we use non-streaming ogg files. In order to only have one music file in memory at once we use purgeResources(). This function, as far as I have read, should also purge audio from memory, but as far as I can see it only removes information about the sound and not the sound itself form the Open AL driver. This seems like a bug! Have anyone else seen this problem? Any solutions? Workarounds?
Looking through the C++ source I saw that when shutting down the driver it calls alDeleteSources, and when I tried calling OpenALShutdownDriver it finally removes the sounds from memory. As a workaround I now re-initialize the OpenAL driver after calling purgeResources and that fixed the memory issue, but now instead the audio driver plays a click everytime the Open AL driver is initialized. Very annoying!
Hope someone can help!!
For music we use non-streaming ogg files. In order to only have one music file in memory at once we use purgeResources(). This function, as far as I have read, should also purge audio from memory, but as far as I can see it only removes information about the sound and not the sound itself form the Open AL driver. This seems like a bug! Have anyone else seen this problem? Any solutions? Workarounds?
Looking through the C++ source I saw that when shutting down the driver it calls alDeleteSources, and when I tried calling OpenALShutdownDriver it finally removes the sounds from memory. As a workaround I now re-initialize the OpenAL driver after calling purgeResources and that fixed the memory issue, but now instead the audio driver plays a click everytime the Open AL driver is initialized. Very annoying!
Hope someone can help!!
#2
03/10/2007 (3:49 am)
Thanks for the reply! We decided to do streaming music instead, and since it was only the music we wanted to free, this has solved our problem for now.
Associate David Higgins
DPHCoders.com
Though, if your only intent is to free Audio Memory during this process, it may be beneficial to simply just create a Console Function that calls 'alDeleteSources' for you ... call it 'alxDeleteSources' and toss it at the end of the current OpenAL Console Function List ...