diff --git a/lib/flibitEFX.jar b/lib/flibitEFX.jar index cab70ee..75d8ad2 100644 Binary files a/lib/flibitEFX.jar and b/lib/flibitEFX.jar differ diff --git a/src/lwjake2/sound/lwjgl/Channel.java b/src/lwjake2/sound/lwjgl/Channel.java index 2bc2072..690abbd 100644 --- a/src/lwjake2/sound/lwjgl/Channel.java +++ b/src/lwjake2/sound/lwjgl/Channel.java @@ -291,7 +291,7 @@ public class Channel { //stack variable private static float[] entityOrigin = {0, 0, 0}; - static void playAllSounds(FloatBuffer listenerOrigin, int currentEffectIndex) { + static void playAllSounds(FloatBuffer listenerOrigin, int currentEffectIndex, int currentFilterIndex) { FloatBuffer sourceOrigin = sourceOriginBuffer; Channel ch; int sourceId; @@ -326,6 +326,7 @@ public class Channel { AL10.alSourcef (sourceId, AL10.AL_ROLLOFF_FACTOR, ch.rolloff); AL10.alSource3f(sourceId, AL10.AL_POSITION, sourceOrigin.get(), sourceOrigin.get(), sourceOrigin.get()); AL11.alSource3i(sourceId, EFX10.AL_AUXILIARY_SEND_FILTER, currentEffectIndex, 0, EFX10.AL_FILTER_NULL); + AL10.alSourcei(sourceId, EFX10.AL_DIRECT_FILTER, currentFilterIndex); AL10.alSourcePlay(sourceId); sourceOrigin.rewind(); ch.modified = false; diff --git a/src/lwjake2/sound/lwjgl/LWJGLSoundImpl.java b/src/lwjake2/sound/lwjgl/LWJGLSoundImpl.java index a55eb94..664c7bc 100644 --- a/src/lwjake2/sound/lwjgl/LWJGLSoundImpl.java +++ b/src/lwjake2/sound/lwjgl/LWJGLSoundImpl.java @@ -43,6 +43,7 @@ import java.nio.IntBuffer; import java.nio.ShortBuffer; import com.flibitijibibo.flibitEFX.EFXEffectUnderwater; +import com.flibitijibibo.flibitEFX.EFXFilterUnderwater; import org.lwjgl.LWJGLException; import org.lwjgl.openal.AL; import org.lwjgl.openal.AL10; @@ -68,7 +69,9 @@ public final class LWJGLSoundImpl implements Sound { /** EFX Variables */ private int currentEffectIndex; + private int currentFilterIndex; private EFXEffectUnderwater underwaterEffect; + private EFXFilterUnderwater underwaterFilter; // singleton private LWJGLSoundImpl() { @@ -154,6 +157,7 @@ public final class LWJGLSoundImpl implements Sound { { Com.Printf("... using EFX effects:\n"); underwaterEffect = new EFXEffectUnderwater(); + underwaterFilter = new EFXFilterUnderwater(); } @@ -161,6 +165,7 @@ public final class LWJGLSoundImpl implements Sound { { // Unload EFX Effects underwaterEffect.killEffect(); + underwaterFilter.killFilter(); // Release the context and the device. AL.destroy(); @@ -260,14 +265,18 @@ public final class LWJGLSoundImpl implements Sound { AL10.alListenerf(AL10.AL_GAIN, s_volume.value); // Detect EFX Conditions - if ((GameBase.gi.pointcontents.pointcontents(origin)& Defines.MASK_WATER)!= 0) + if ((GameBase.gi.pointcontents.pointcontents(origin)& Defines.MASK_WATER)!= 0) { currentEffectIndex = underwaterEffect.getIndex(); - else + currentFilterIndex = underwaterFilter.getIndex(); + } + else { currentEffectIndex = EFX10.AL_EFFECTSLOT_NULL; + currentFilterIndex = EFX10.AL_FILTER_NULL; + } Channel.addLoopSounds(); Channel.addPlaySounds(); - Channel.playAllSounds(listenerOrigin, currentEffectIndex); + Channel.playAllSounds(listenerOrigin, currentEffectIndex, currentFilterIndex); } /* (non-Javadoc)