summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmake/build.xml6
-rwxr-xr-xsrc/java/demos/efx/EFXFilter.java53
2 files changed, 31 insertions, 28 deletions
diff --git a/make/build.xml b/make/build.xml
index ef3064c..3a895da 100755
--- a/make/build.xml
+++ b/make/build.xml
@@ -65,7 +65,7 @@
<property name="gluegen-rt.jar" value="${gluegen.build}/gluegen-rt.jar" />
<property name="joal.jar" value="${joal.build}/joal.jar" />
- <property name="src.dir" value="../src" />
+ <property name="src.dir" value="../src/java" />
<property name="classes.dir" value="${build}/classes" />
<property name="joal.demos.jar" value="${build}/joal-demos.jar" />
@@ -113,7 +113,7 @@
<target name="jar" depends="compile" description="Build JOAL demos jar file">
<jar destfile="${joal.demos.jar}">
<fileset dir="${classes.dir}" />
- <fileset dir="${src.dir}/java">
+ <fileset dir="${src.dir}">
<include name="demos/data/**" />
</fileset>
</jar>
@@ -123,7 +123,7 @@
<mkdir dir="${classes.dir}" />
<copy todir="${build}">
- <fileset dir="${src.dir}/java/demos/lib" includes="j-ogg-*.jar" />
+ <fileset dir="${src.dir}/demos/lib" includes="j-ogg-*.jar" />
</copy>
<path id="joal.classpath">
diff --git a/src/java/demos/efx/EFXFilter.java b/src/java/demos/efx/EFXFilter.java
index c66ab2f..94bcdea 100755
--- a/src/java/demos/efx/EFXFilter.java
+++ b/src/java/demos/efx/EFXFilter.java
@@ -4,6 +4,7 @@ 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.ALFactory;
import com.jogamp.openal.util.WAVData;
import com.jogamp.openal.util.WAVLoader;
@@ -20,6 +21,7 @@ public class EFXFilter {
private static ALCcontext context;
private static ALC alc;
private static AL al;
+ private static ALExt alExt;
private static String wavefile = "demos/data/Footsteps.wav";
@@ -86,6 +88,7 @@ public class EFXFilter {
alc.alcMakeContextCurrent(context);
al = ALFactory.getAL();
+ alExt = ALFactory.getALExt();
}
/**
@@ -122,13 +125,13 @@ public class EFXFilter {
System.out.println("Source played through a direct lowpass filter");
// Attach a lowpass filter to the source
- int filter = createFilter(AL.AL_FILTER_LOWPASS, 1f, 0.5f);
- al.alSourcei(source, AL.AL_DIRECT_FILTER, filter);
+ int filter = createFilter(ALExt.AL_FILTER_LOWPASS, 1f, 0.5f);
+ al.alSourcei(source, ALExt.AL_DIRECT_FILTER, filter);
play(source);
// Cleanup
- al.alSourcei(source, AL.AL_DIRECT_FILTER, AL.AL_FILTER_NULL);
+ al.alSourcei(source, ALExt.AL_DIRECT_FILTER, ALExt.AL_FILTER_NULL);
deleteFilter(filter);
}
@@ -143,23 +146,23 @@ public class EFXFilter {
// Create auxiliary effect slots & effects
int[] effectslots = new int[1];
- al.alGenAuxiliaryEffectSlots(1, effectslots, 0);
+ alExt.alGenAuxiliaryEffectSlots(1, effectslots, 0);
int[] effects = new int[1];
- al.alGenEffects(1, effects, 0);
+ alExt.alGenEffects(1, effects, 0);
// Configure the effect to be a reverb, load it to the effect slot
- al.alEffecti(effects[0], AL.AL_EFFECT_TYPE, AL.AL_EFFECT_REVERB);
- al.alAuxiliaryEffectSloti(effectslots[0], AL.AL_EFFECTSLOT_EFFECT, effects[0]);
+ alExt.alEffecti(effects[0], ALExt.AL_EFFECT_TYPE, ALExt.AL_EFFECT_REVERB);
+ alExt.alAuxiliaryEffectSloti(effectslots[0], ALExt.AL_EFFECTSLOT_EFFECT, effects[0]);
// Enable Send 0 from the Source to the Auxiliary Effect Slot without filtering
- al.alSource3i(source, AL.AL_AUXILIARY_SEND_FILTER, effectslots[0], 0, AL.AL_FILTER_NULL);
+ al.alSource3i(source, ALExt.AL_AUXILIARY_SEND_FILTER, effectslots[0], 0, ALExt.AL_FILTER_NULL);
play(source);
// Cleanup
- al.alSource3i(source, AL.AL_AUXILIARY_SEND_FILTER, AL.AL_EFFECTSLOT_NULL, 0, AL.AL_FILTER_NULL);
- al.alDeleteAuxiliaryEffectSlots(1, effectslots, 0);
- al.alDeleteEffects(1, effects, 0);
+ al.alSource3i(source, ALExt.AL_AUXILIARY_SEND_FILTER, ALExt.AL_EFFECTSLOT_NULL, 0, ALExt.AL_FILTER_NULL);
+ alExt.alDeleteAuxiliaryEffectSlots(1, effectslots, 0);
+ alExt.alDeleteEffects(1, effects, 0);
}
/**
@@ -172,24 +175,24 @@ public class EFXFilter {
System.out.println("Source played through an auxiliary reverb with lowpass filter");
// Create a lowpass filter, attach it to a reverb effect
- int filter = createFilter(AL.AL_FILTER_LOWPASS, 1f, 0.5f);
+ int filter = createFilter(ALExt.AL_FILTER_LOWPASS, 1f, 0.5f);
int[] effectslots = new int[1];
- al.alGenAuxiliaryEffectSlots(1, effectslots, 0);
+ alExt.alGenAuxiliaryEffectSlots(1, effectslots, 0);
int[] effects = new int[1];
- al.alGenEffects(1, effects, 0);
- al.alEffecti(effects[0], AL.AL_EFFECT_TYPE, AL.AL_EFFECT_REVERB);
- al.alAuxiliaryEffectSloti(effectslots[0], AL.AL_EFFECTSLOT_EFFECT, effects[0]);
+ alExt.alGenEffects(1, effects, 0);
+ alExt.alEffecti(effects[0], ALExt.AL_EFFECT_TYPE, ALExt.AL_EFFECT_REVERB);
+ alExt.alAuxiliaryEffectSloti(effectslots[0], ALExt.AL_EFFECTSLOT_EFFECT, effects[0]);
// Enable Send 0 from the Source to the Auxiliary Effect Slot with filtering
- al.alSource3i(source, AL.AL_AUXILIARY_SEND_FILTER, effectslots[0], 0, filter);
+ al.alSource3i(source, ALExt.AL_AUXILIARY_SEND_FILTER, effectslots[0], 0, filter);
play(source);
// Cleanup
- al.alSource3i(source, AL.AL_AUXILIARY_SEND_FILTER, AL.AL_EFFECTSLOT_NULL, 0, AL.AL_FILTER_NULL);
- al.alDeleteAuxiliaryEffectSlots(1, effectslots, 0);
- al.alDeleteEffects(1, effects, 0);
+ al.alSource3i(source, ALExt.AL_AUXILIARY_SEND_FILTER, ALExt.AL_EFFECTSLOT_NULL, 0, ALExt.AL_FILTER_NULL);
+ alExt.alDeleteAuxiliaryEffectSlots(1, effectslots, 0);
+ alExt.alDeleteEffects(1, effects, 0);
}
/**
@@ -231,11 +234,11 @@ public class EFXFilter {
private static int createFilter(int filtertype, float gain, float gainlimit) {
int filters[] = new int[1];
- al.alGenFilters(1, filters, 0);
+ alExt.alGenFilters(1, filters, 0);
- al.alFilteri(filters[0], AL.AL_FILTER_TYPE, filtertype);
- al.alFilterf(filters[0], filtertype, gain);
- al.alFilterf(filters[0], filtertype, gainlimit);
+ alExt.alFilteri(filters[0], ALExt.AL_FILTER_TYPE, filtertype);
+ alExt.alFilterf(filters[0], filtertype, gain);
+ alExt.alFilterf(filters[0], filtertype, gainlimit);
return filters[0];
}
@@ -247,6 +250,6 @@ public class EFXFilter {
*/
private static void deleteFilter(int filter) {
- al.alDeleteFilters(1, new int[]{ filter }, 0);
+ alExt.alDeleteFilters(1, new int[]{ filter }, 0);
}
}