Cope if something in the underlying sound system freaks out.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4094 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2006-05-05 23:26:33 +00:00
parent c8fa910ffe
commit f07c7307c9
2 changed files with 19 additions and 12 deletions
@@ -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<Source> _sources = new ArrayList<Source>();
}
@@ -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;
}
/**