diff options
author | Sven Gothel <[email protected]> | 2023-12-18 02:41:11 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-12-18 02:41:11 +0100 |
commit | 0fd9d02430082e930fe1058b08f4d80155a007ed (patch) | |
tree | 9140f2855cbb8f9499718b06e6974c79c21e3391 | |
parent | c5890ee3e6bfa8aa40a55145b3b7e8a9bca344be (diff) |
GraphUI UISceneDemo20: Only use ALAudioSink if its context is already created (ready)
-rw-r--r-- | src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java index 6a30c057a..6d03212e4 100644 --- a/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java +++ b/src/demos/com/jogamp/opengl/demos/graph/ui/UISceneDemo20.java @@ -746,13 +746,13 @@ public class UISceneDemo20 implements GLEventListener { }); button.onMove((final Shape shape, final Vec3f origin, final Vec3f dest) -> { final ALAudioSink aSink = alAudioSink[0]; - if( null != aSink ) { + if( null != aSink && aSink.getContext().isValid() ) { setSoundPosition(shape, aSink.getContext(), aSink.getSource()); } } ); button.onInit( (final Shape shape) -> { final ALAudioSink aSink = alAudioSink[0]; - if( null != aSink ) { + if( null != aSink && aSink.getContext().isValid() ) { initSound(shape, aSink.getContext(), aSink.getSource()); System.err.println("Media Audio: "+aSink); return true; @@ -830,9 +830,13 @@ public class UISceneDemo20 implements GLEventListener { final Shape.ListenerBool initAudio = new Shape.ListenerBool() { @Override public boolean run(final Shape shape) { - initSound(shape, aSink.getContext(), aSource); - System.err.println("Sine Audio: "+aSink); - return true; + if( null != aSink && aSink.getContext().isValid() ) { + initSound(shape, aSink.getContext(), aSource); + System.err.println("Sine Audio: "+aSink); + return true; + } else { + return false; + } } }; button.onInit( initAudio ); |