aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/com/jogamp/openal
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-12-02 21:57:24 +0100
committerSven Gothel <[email protected]>2023-12-02 21:57:24 +0100
commit7171b103eb7a62226595c7b6621ca1de63d41e65 (patch)
tree8beeb18f7dfe9ac78ddd6d97281e7d4570d04604 /src/test/com/jogamp/openal
parentd6293dc4e8e97a046ed605782f17993d429720c3 (diff)
Bump OpenAL-Soft to git 571b546f35eead77ce109f8d4dd6c3de3199d573 2023-11-25, post v1.23.1; Adding 2 extensions (ALExt)
New extensions: - ALC_EXT_debug - AL_EXT_debug - ALC_SOFT_system_events Testing: - ALDebugExtTest contains minimal test for - ALC_EXT_debug - AL_EXT_debug +++ commit 1aaf4f070011490bcece50394b9b32dfa593fd9e (HEAD -> master) Merge: 6e7cee4f 571b546f Author: Sven Gothel <[email protected]> Date: Tue Nov 28 12:51:46 2023 +0100 Merge remote-tracking branch 'upstream/master' commit 571b546f35eead77ce109f8d4dd6c3de3199d573 (upstream/master) Author: Chris Robinson <[email protected]> Date: Sat Nov 25 22:09:28 2023 -0800 Update some in-progress format enums
Diffstat (limited to 'src/test/com/jogamp/openal')
-rw-r--r--src/test/com/jogamp/openal/test/junit/ALDebugExtTest.java131
1 files changed, 131 insertions, 0 deletions
diff --git a/src/test/com/jogamp/openal/test/junit/ALDebugExtTest.java b/src/test/com/jogamp/openal/test/junit/ALDebugExtTest.java
new file mode 100644
index 0000000..0b8a84c
--- /dev/null
+++ b/src/test/com/jogamp/openal/test/junit/ALDebugExtTest.java
@@ -0,0 +1,131 @@
+/**
+ * Copyright 2023 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+package com.jogamp.openal.test.junit;
+
+import java.io.IOException;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.runners.MethodSorters;
+
+import com.jogamp.openal.AL;
+import com.jogamp.openal.ALC;
+import com.jogamp.openal.ALCcontext;
+import com.jogamp.openal.ALCdevice;
+import com.jogamp.openal.ALExt;
+import com.jogamp.openal.ALExtConstants;
+import com.jogamp.openal.ALFactory;
+import com.jogamp.openal.sound3d.AudioSystem3D;
+import com.jogamp.openal.test.util.UITestCase;
+import com.jogamp.openal.util.ALHelpers;
+
+/**
+ * Testing the OpenAL-Soft Debug Extension.
+ */
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class ALDebugExtTest extends UITestCase {
+
+ @Test
+ public void test01DebugExt() {
+ final ALC alc = ALFactory.getALC();
+ final ALCdevice device = alc.alcOpenDevice(null);
+
+ if( !alc.alcIsExtensionPresent(device, ALHelpers.ALC_EXT_debug) ) {
+ System.err.println("ALCdevice has no "+ALHelpers.ALC_EXT_debug+" extension");
+ return;
+ }
+ final int[] attributes = new int[] { ALExtConstants.ALC_CONTEXT_FLAGS_EXT, ALExtConstants.ALC_CONTEXT_DEBUG_BIT_EXT };
+ final ALCcontext context = alc.alcCreateContext(device, attributes, 0);
+ if( !alc.alcMakeContextCurrent(context) ) {
+ System.err.println("makeCurrent() failed");
+ return;
+ }
+ // final JoalVersion jv = JoalVersion.getInstance();
+ // System.err.println(jv.toString(alc));
+ System.err.println("-----------------------------------------------------------------------------------------------------");
+
+ final AL al = ALFactory.getAL();
+ if( !al.alIsExtensionPresent(ALHelpers.AL_EXT_debug) ) {
+ System.err.println("Current context has no "+ALHelpers.AL_EXT_debug+" extension");
+ return;
+ }
+ final AtomicInteger dbg_counter = new AtomicInteger(0);
+ final AtomicReference<String> dbg_msg = new AtomicReference<String>();
+ final ALExt.ALDEBUGPROCEXT debug_cb = new ALExt.ALDEBUGPROCEXT() {
+ @Override
+ public void callback(final int source, final int type, final int id, final int severity, final String message, final ALCcontext userParam) {
+ final int count = dbg_counter.incrementAndGet();
+ if( 1 == count ) {
+ dbg_msg.set(message);
+ }
+ System.err.println("AL-Debug["+count+"]: src 0x"+Integer.toHexString(source)+
+ ", type 0x"+Integer.toHexString(type)+
+ ", id "+id+
+ ", severity 0x"+Integer.toHexString(severity)+", msg '"+message+"', ctx "+userParam);
+ }
+ };
+ final String expMessage = "Test Message";
+ AudioSystem3D.getALExt().alDebugMessageCallbackEXT(debug_cb, context);
+ AudioSystem3D.getALExt().alDebugMessageControlEXT(ALExtConstants.AL_DEBUG_SOURCE_OTHER_EXT,
+ ALExtConstants.AL_DEBUG_TYPE_OTHER_EXT,
+ ALExtConstants.AL_DEBUG_SEVERITY_NOTIFICATION_EXT,
+ 0, null, 0,
+ true);
+ AudioSystem3D.getALExt().alDebugMessageInsertEXT(ALExtConstants.AL_DEBUG_SOURCE_APPLICATION_EXT,
+ ALExtConstants.AL_DEBUG_TYPE_OTHER_EXT,
+ 0,
+ ALExtConstants.AL_DEBUG_SEVERITY_NOTIFICATION_EXT, expMessage);
+ Assert.assertEquals(1, dbg_counter.get());
+ Assert.assertEquals(expMessage, dbg_msg.get());
+ alc.alcDestroyContext(context);
+ alc.alcCloseDevice(device);
+ }
+
+ @After
+ @Override
+ public void tearDown() {
+ super.tearDown();
+ final ALC alc = ALFactory.getALC();
+ final ALCcontext context = alc.alcGetCurrentContext();
+ if(null != context) {
+ alc.alcDestroyContext(context);
+ final ALCdevice device = alc.alcGetContextsDevice(context);
+ if(null != device) {
+ alc.alcCloseDevice(device);
+ }
+ }
+ }
+
+ public static void main(final String args[]) throws IOException {
+ org.junit.runner.JUnitCore.main(ALDebugExtTest.class.getName());
+ }
+}