diff options
author | Sven Gothel <[email protected]> | 2023-05-18 06:15:32 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-05-18 06:15:32 +0200 |
commit | 7f73d50c90d05cf7388f23977ca956a4933019ad (patch) | |
tree | 1e14df61266798b9276e71290e5acc8844bfc260 /src/test/com/jogamp/openal | |
parent | 2e800ac4277d6234cb9dba2afe01a4d8c75fc989 (diff) |
Sound3D: Make all OO wrapper fully transparent and stand-alone, allow mix-and-match; Align Context makeCurrent/release w/ ALAudioSink ...
Align Context makeCurrent/release w/ ALAudioSink
- use ALC_EXT_thread_local_context if available
- use a recursive lock
- same release method as makeCurrent
- ALC_EXT_thread_local_context or traditional
- destroy also releases the context and fully unwinds lock
Diffstat (limited to 'src/test/com/jogamp/openal')
-rw-r--r-- | src/test/com/jogamp/openal/test/manual/Sound3DTest.java | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/test/com/jogamp/openal/test/manual/Sound3DTest.java b/src/test/com/jogamp/openal/test/manual/Sound3DTest.java index 27a4baa..1a792b6 100644 --- a/src/test/com/jogamp/openal/test/manual/Sound3DTest.java +++ b/src/test/com/jogamp/openal/test/manual/Sound3DTest.java @@ -1,6 +1,5 @@ -package com.jogamp.openal.test.manual; - /** + * Copyright (c) 2010-2023 JogAmp Community. All rights reserved. * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,6 +31,8 @@ package com.jogamp.openal.test.manual; * You acknowledge that this software is not designed or intended for use in the * design, construction, operation or maintenance of any nuclear facility. */ +package com.jogamp.openal.test.manual; + import java.io.IOException; import com.jogamp.openal.UnsupportedAudioFileException; @@ -56,12 +57,18 @@ public class Sound3DTest { public static void main(final String[] args) throws IOException, InterruptedException, UnsupportedAudioFileException { - AudioSystem3D.init(); + if( !AudioSystem3D.isAvailable() ) { + System.err.println("AudioSystem3D is not available, static initialization failed"); + return; + } // create the initial context - this can be collapsed into the init. final Device device = AudioSystem3D.openDevice(null); final Context context = AudioSystem3D.createContext(device); - AudioSystem3D.makeContextCurrent(context); + if( !context.makeCurrent() ) { + System.err.println("Context.makeCurrent() failed"); + return; + } // get the listener object final Listener listener = AudioSystem3D.getListener(); |