From 2d3237ef72a0ce908f1ca61e4f151e01dc8e27f3 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 10 Jul 2023 16:42:36 +0200 Subject: AL_SOFT_events: Define 'ALCcontext` as `UserParam` type for more clarity --- make/config/joal-alext.cfg | 4 +++- src/java/com/jogamp/openal/ALContextKey.java | 11 ++++------- src/java/com/jogamp/openal/util/ALAudioSink.java | 4 ++-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/make/config/joal-alext.cfg b/make/config/joal-alext.cfg index 12cb51d..84baf22 100644 --- a/make/config/joal-alext.cfg +++ b/make/config/joal-alext.cfg @@ -28,7 +28,7 @@ ForceProcAddressGen __ALL__ LocalProcAddressCallingConvention __ALL__ AL_APIENTRY ArgumentIsPascalString ALEVENTPROCSOFT 3 4 -JavaCallbackDef alEventCallbackSOFT 1 ALEVENTPROCSOFT 5 com.jogamp.openal.ALContextKey +JavaCallbackDef alEventCallbackSOFT 1 ALEVENTPROCSOFT 5 ALCcontext ALContextKey JavaCallbackKey alEventCallbackSOFT 1 ALEVENTPROCSOFT 5 Import java.io.UnsupportedEncodingException @@ -36,6 +36,8 @@ Import java.util.* Import com.jogamp.openal.* Import jogamp.openal.* Import java.security.PrivilegedAction +Import com.jogamp.openal.ALContextKey +Import com.jogamp.openal.ALCcontext # Factor out the OpenAL constants into their own interface Ignore ^AL_.+ diff --git a/src/java/com/jogamp/openal/ALContextKey.java b/src/java/com/jogamp/openal/ALContextKey.java index 2e85a05..450c42b 100644 --- a/src/java/com/jogamp/openal/ALContextKey.java +++ b/src/java/com/jogamp/openal/ALContextKey.java @@ -43,15 +43,12 @@ public class ALContextKey { private final int hashCodeValue; /** Creates an instance using the current context as key. */ - public ALContextKey( final Object userParam ) { - if( null == userParam ) { - throw new IllegalArgumentException("userParam null"); - } - if( !(userParam instanceof ALCcontext) ) { - throw new IllegalArgumentException("userParam not ALCcontext but "+userParam.getClass()); + public ALContextKey( final ALCcontext context ) { + if( null == context ) { + throw new IllegalArgumentException("null context"); } // alCtx = alc.alcGetCurrentContext(); - alCtx = (ALCcontext) userParam; + alCtx = context; if( null != alCtx ) { nativeAddress = alCtx.getDirectBufferAddress(); hashCodeValue = HashUtil.getAddrHash32_EqualDist(nativeAddress); diff --git a/src/java/com/jogamp/openal/util/ALAudioSink.java b/src/java/com/jogamp/openal/util/ALAudioSink.java index e579084..21fcce9 100644 --- a/src/java/com/jogamp/openal/util/ALAudioSink.java +++ b/src/java/com/jogamp/openal/util/ALAudioSink.java @@ -785,9 +785,9 @@ public final class ALAudioSink implements AudioSink { @SuppressWarnings("unused") @Override public void callback(final int eventType, final int object, final int param, - final int length, final String message, final Object userParam) { + final int length, final String message, final ALCcontext context) { if( false ) { - final com.jogamp.openal.ALContextKey k = new com.jogamp.openal.ALContextKey(userParam); + final com.jogamp.openal.ALContextKey k = new com.jogamp.openal.ALContextKey(context); System.err.println("ALAudioSink.Event: type "+toHexString(eventType)+", obj "+toHexString(object)+", param "+param+ ", msg[len "+length+", val '"+message+"'], userParam "+k); } -- cgit v1.2.3