diff options
author | Sven Gothel <[email protected]> | 2023-07-09 21:16:28 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-07-09 21:16:28 +0200 |
commit | 9eb33b0016e8f0781140a3b03509562cb6d95bc1 (patch) | |
tree | f6341fb107b748eac7512a9b2335b3fde6d14ab9 /src/java | |
parent | 2319ef1079dae17d4d23df804632c16bb768a132 (diff) |
ALAudioSink.destroy(): Shutdown alEventCallbackSOFT properly (only if hasAL_SOFT_events, 1st disable all events); growBuffers(): No pre-condition exception for hasAL_SOFT_events
Diffstat (limited to 'src/java')
-rw-r--r-- | src/java/com/jogamp/openal/util/ALAudioSink.java | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/java/com/jogamp/openal/util/ALAudioSink.java b/src/java/com/jogamp/openal/util/ALAudioSink.java index cc74be7..e579084 100644 --- a/src/java/com/jogamp/openal/util/ALAudioSink.java +++ b/src/java/com/jogamp/openal/util/ALAudioSink.java @@ -639,11 +639,7 @@ public final class ALAudioSink implements AudioSink { } if( hasAL_SOFT_events ) { alExt.alEventCallbackSOFT(alEventCallback, context.getALContext()); - alExt.alEventControlSOFT(1, new int[] { ALExtConstants.AL_EVENT_TYPE_BUFFER_COMPLETED_SOFT - // , ALExtConstants.AL_EVENT_TYPE_SOURCE_STATE_CHANGED_SOFT - // , ALExtConstants.AL_EVENT_TYPE_DISCONNECTED_SOFT - }, 0, true); - System.err.println("CALLBACK registered"); + alExt.alEventControlSOFT(1, new int[] { ALExtConstants.AL_EVENT_TYPE_BUFFER_COMPLETED_SOFT }, 0, true); } } finally { if( releaseContext ) { @@ -675,7 +671,7 @@ public final class ALAudioSink implements AudioSink { } */ private boolean growBuffers(final int addByteCount) { - if( !hasAL_SOFT_events && !alFramesFree.isEmpty() || !alFramesPlaying.isFull() ) { + if( !alFramesFree.isEmpty() || !alFramesPlaying.isFull() ) { throw new InternalError("Buffers: Avail is !empty "+alFramesFree+" or Playing is !full "+alFramesPlaying+", while !hasAL_SOFT_events"); } final float addDuration = chosenFormat.getBytesDuration(addByteCount); // [s] @@ -761,7 +757,13 @@ public final class ALAudioSink implements AudioSink { available = false; if( null != context ) { makeCurrent(true /* throw */); - alExt.alEventCallbackSOFT(null, context.getALContext()); + if( hasAL_SOFT_events ) { + alExt.alEventControlSOFT(3, new int[] { ALExtConstants.AL_EVENT_TYPE_BUFFER_COMPLETED_SOFT, + ALExtConstants.AL_EVENT_TYPE_SOURCE_STATE_CHANGED_SOFT, + ALExtConstants.AL_EVENT_TYPE_DISCONNECTED_SOFT + }, 0, false); + alExt.alEventCallbackSOFT(null, context.getALContext()); + } } try { stopImpl(true); |