diff --git a/src/java/com/threerings/openal/SoundGroup.java b/src/java/com/threerings/openal/SoundGroup.java index 7bdbd5b9b..661ad73a8 100644 --- a/src/java/com/threerings/openal/SoundGroup.java +++ b/src/java/com/threerings/openal/SoundGroup.java @@ -48,11 +48,11 @@ public class SoundGroup */ public Sound getSound (String path) { + ClipBuffer buffer = null; if (_manager.isInitialized()) { - return new Sound(this, _manager.getClip(_provider, path)); - } else { - return new BlankSound(); + buffer = _manager.getClip(_provider, path); } + return (buffer == null) ? new BlankSound() : new Sound(this, buffer); } /** @@ -109,7 +109,7 @@ public class SoundGroup // start at the beginning of the list looking for an available // source for (int ii = 0, ll = _sources.size(); ii < ll; ii++) { - Source source = (Source)_sources.get(ii); + Source source = _sources.get(ii); if (source.holder == null || source.holder.reclaim()) { // note this source's new holder source.holder = acquirer; @@ -133,5 +133,5 @@ public class SoundGroup protected ClipProvider _provider; protected IntBuffer _sourceIds; - protected ArrayList _sources = new ArrayList(); + protected ArrayList _sources = new ArrayList(); } diff --git a/src/java/com/threerings/openal/SoundManager.java b/src/java/com/threerings/openal/SoundManager.java index ad2278f10..b9eec8b8d 100644 --- a/src/java/com/threerings/openal/SoundManager.java +++ b/src/java/com/threerings/openal/SoundManager.java @@ -156,16 +156,23 @@ public class SoundManager { Comparable ckey = ClipBuffer.makeKey(provider, path); ClipBuffer buffer = _clips.get(ckey); - if (buffer == null) { - // check to see if this clip is currently loading - buffer = _loading.get(ckey); + try { if (buffer == null) { - buffer = new ClipBuffer(this, provider, path); - _loading.put(ckey, buffer); + // check to see if this clip is currently loading + buffer = _loading.get(ckey); + if (buffer == null) { + buffer = new ClipBuffer(this, provider, path); + _loading.put(ckey, buffer); + } } + buffer.resolve(null); + return buffer; + + } catch (Throwable t) { + Log.warning("Failure resolving buffer [key=" + ckey + "]."); + Log.logStackTrace(t); + return null; } - buffer.resolve(null); - return buffer; } /**