Releasing OpenAL Sound Buffers

Friendly conversations, and everything that doesn't fit into the other forums.
2 posts Page 1 of 1
OTHGMars
Posts: 1
Joined: Fri Jul 14, 2017 2:19 am
by OTHGMars » Fri Jul 14, 2017 2:24 am
I'm posting this here hoping to save someone debugging time. We use looping music during our game menus and the music changes as you switch menus. I noticed memory usage would increase every time the music changed. You can see the issue with devhead or release and full template by doing the following:
Launch game, make sure OpenAL is the sound provider and open the guiMusicPlayer.
exec("core/scripts/gui/guiMusicPlayer.cs"); toggleMusicPlayer();
Select "art/sound/environment/amb.ogg" (because it's big).
Click play, then stop and repeat several times while watching the apps memory usage and you'll see the memory usage continue to climb and never return to it's original baseline state. If you then switch to DirectSound and repeat the experiment, you'll see the baseline memory usage remains pretty constant.
The problem turned out to be related to the sound streaming. The descriptions are set to isStreaming = true; If those are changed to isStreaming = false; both OpenAL and DirectSound release all memory reserved for the sound buffers when the sound is stopped and do not hold a large chunk until the app exits. Another work-around would be to manage all of the sound sources from script and not recreate them as the sounds are played/stopped, but in our case in addition to menus, we have multiple music tracks that will play depending on where the user is in a level, so that is not an appealing option.
irei1as
Posts: 70
Joined: Fri Feb 27, 2015 5:13 pm
by irei1as » Fri Jul 14, 2017 11:26 am
I'm having some issues with OpenAL streaming buffers trying to fix the broken SFXSound::setPosition(x), too.
Maybe it's related, thanks for the info.

By the way, if anybody wants to test streaming sounds make them from sound files longer than 24 seconds. Otherwise they're internally treated like non-streaming samples and the issues don't show.
2 posts Page 1 of 1

Who is online

Users browsing this forum: No registered users and 7 guests