From 80935131839903ecf0124817b38b252f060499a0 Mon Sep 17 00:00:00 2001 From: Mark Johnson Date: Wed, 21 Jun 2006 02:49:46 +0000 Subject: [PATCH] Have play call StartObserver.soundStarted with a null sound when the sound fails to play for any reason. We use the StartObserver to time other effects with sounds, however if the sound isn't going to play, we still want the other effects to go ahead. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4203 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/java/com/threerings/openal/Sound.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/java/com/threerings/openal/Sound.java b/src/java/com/threerings/openal/Sound.java index ae892c8d0..fbe67ca76 100644 --- a/src/java/com/threerings/openal/Sound.java +++ b/src/java/com/threerings/openal/Sound.java @@ -36,7 +36,10 @@ public class Sound * delayed in loading. */ public interface StartObserver { - /** Called when the specified sound has started playing. */ + /** Called when the specified sound has started playing. If + * sound is null then the sound failed to play but soundStarted + * was called anyway to perform whatever actions were waiting + * on the sound. */ public void soundStarted (Sound sound); } @@ -181,6 +184,9 @@ public class Sound { // if we were unable to get our buffer, fail immediately if (_buffer == null) { + if (obs != null) { + obs.soundStarted(null); + } return false; } @@ -204,6 +210,9 @@ public class Sound return true; } else { // sorry charlie... + if (obs != null) { + obs.soundStarted(null); + } return false; } }