Cope more gracefully when we can't access the sound device.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4070 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2006-04-27 22:24:38 +00:00
parent 3cd66e17ad
commit bb19beb053
2 changed files with 10 additions and 1 deletions
@@ -176,6 +176,11 @@ public class Sound
protected boolean play (
boolean allowDefer, final boolean loop, final StartObserver obs)
{
// if we were unable to get our buffer, fail immediately
if (_buffer == null) {
return false;
}
// if we're not ready to go...
if (!_buffer.isPlayable()) {
if (allowDefer) {
@@ -62,7 +62,10 @@ public class SoundGroup
*/
public void dispose ()
{
AL10.alDeleteSources(_sourceIds);
if (_sourceIds != null) {
AL10.alDeleteSources(_sourceIds);
_sourceIds = null;
}
}
protected SoundGroup (
@@ -84,6 +87,7 @@ public class SoundGroup
if (errno != AL10.AL_NO_ERROR) {
Log.warning("Failed to create sources [cprov=" + provider +
", sources=" + sources + ", errno=" + errno + "].");
_sourceIds = null;
// we'll have no sources which means all requests to play
// sounds will silently fail as if all sources were in use