From 14961042bb8ca1f9f787d9d1f1cb64560b6dba22 Mon Sep 17 00:00:00 2001 From: Magne Nordtveit Date: Thu, 7 Mar 2013 07:33:53 +0100 Subject: Adding method for determining the playing state of an audio source. --- src/java/com/jogamp/openal/sound3d/Source.java | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src') diff --git a/src/java/com/jogamp/openal/sound3d/Source.java b/src/java/com/jogamp/openal/sound3d/Source.java index 2e2f512..873ad12 100644 --- a/src/java/com/jogamp/openal/sound3d/Source.java +++ b/src/java/com/jogamp/openal/sound3d/Source.java @@ -88,6 +88,17 @@ public final class Source { al.alDeleteSources(1, new int[] { sourceID }, 0); } + /** + * Determines whether or not this source is playing. + * + * @return {@code true} if this source is playing. + */ + public boolean isPlaying() { + int[] result = new int[1]; + al.alGetSourcei(sourceID, AL.AL_SOURCE_STATE, result, 0); + return result[0] == AL.AL_PLAYING; + } + /** * Sets the pitch of the audio on this source. The pitch may be modified * without altering the playback speed of the audio. -- cgit v1.2.3