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:
@@ -48,11 +48,11 @@ public class SoundGroup
|
|||||||
*/
|
*/
|
||||||
public Sound getSound (String path)
|
public Sound getSound (String path)
|
||||||
{
|
{
|
||||||
|
ClipBuffer buffer = null;
|
||||||
if (_manager.isInitialized()) {
|
if (_manager.isInitialized()) {
|
||||||
return new Sound(this, _manager.getClip(_provider, path));
|
buffer = _manager.getClip(_provider, path);
|
||||||
} else {
|
|
||||||
return new BlankSound();
|
|
||||||
}
|
}
|
||||||
|
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
|
// start at the beginning of the list looking for an available
|
||||||
// source
|
// source
|
||||||
for (int ii = 0, ll = _sources.size(); ii < ll; ii++) {
|
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()) {
|
if (source.holder == null || source.holder.reclaim()) {
|
||||||
// note this source's new holder
|
// note this source's new holder
|
||||||
source.holder = acquirer;
|
source.holder = acquirer;
|
||||||
@@ -133,5 +133,5 @@ public class SoundGroup
|
|||||||
protected ClipProvider _provider;
|
protected ClipProvider _provider;
|
||||||
|
|
||||||
protected IntBuffer _sourceIds;
|
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);
|
Comparable ckey = ClipBuffer.makeKey(provider, path);
|
||||||
ClipBuffer buffer = _clips.get(ckey);
|
ClipBuffer buffer = _clips.get(ckey);
|
||||||
if (buffer == null) {
|
try {
|
||||||
// check to see if this clip is currently loading
|
|
||||||
buffer = _loading.get(ckey);
|
|
||||||
if (buffer == null) {
|
if (buffer == null) {
|
||||||
buffer = new ClipBuffer(this, provider, path);
|
// check to see if this clip is currently loading
|
||||||
_loading.put(ckey, buffer);
|
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user