From d2aabbcfae6f48dd05bbb848387890ef6b43b5d2 Mon Sep 17 00:00:00 2001 From: Mark Johnson Date: Thu, 14 Dec 2006 23:00:21 +0000 Subject: [PATCH] Added the ability to stop and reclaim all the sources without fully disposing the sound group. git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@94 ed5b42cb-e716-0410-a449-f6a68f950b19 --- src/java/com/threerings/openal/SoundGroup.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/java/com/threerings/openal/SoundGroup.java b/src/java/com/threerings/openal/SoundGroup.java index efd2ec21..ff3e5b89 100644 --- a/src/java/com/threerings/openal/SoundGroup.java +++ b/src/java/com/threerings/openal/SoundGroup.java @@ -63,6 +63,20 @@ public class SoundGroup * longer be usable and should be discarded. */ public void dispose () + { + reclaimAll(); + if (_sourceIds != null) { + _sources.clear(); + AL10.alDeleteSources(_sourceIds); + _sourceIds = null; + } + } + + /** + * Stops and reclaims all sounds from this sound group but does not + * free the sources. + */ + public void reclaimAll () { if (_sourceIds != null) { // make sure any bound sources are released @@ -72,9 +86,6 @@ public class SoundGroup source.holder.reclaim(); } } - _sources.clear(); - AL10.alDeleteSources(_sourceIds); - _sourceIds = null; } }