You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(134) |
Sep
(52) |
Oct
(13) |
Nov
(342) |
Dec
(163) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(44) |
Feb
(62) |
Mar
(158) |
Apr
(38) |
May
(70) |
Jun
(58) |
Jul
(104) |
Aug
(207) |
Sep
(83) |
Oct
(122) |
Nov
(23) |
Dec
(49) |
| 2004 |
Jan
(119) |
Feb
(132) |
Mar
(192) |
Apr
(140) |
May
(77) |
Jun
(74) |
Jul
(201) |
Aug
(63) |
Sep
(102) |
Oct
(70) |
Nov
(173) |
Dec
(78) |
| 2005 |
Jan
(174) |
Feb
(197) |
Mar
(105) |
Apr
(59) |
May
(77) |
Jun
(43) |
Jul
(21) |
Aug
(18) |
Sep
(47) |
Oct
(37) |
Nov
(74) |
Dec
(50) |
| 2006 |
Jan
(44) |
Feb
(19) |
Mar
(32) |
Apr
(24) |
May
(31) |
Jun
(55) |
Jul
(138) |
Aug
(28) |
Sep
(12) |
Oct
(41) |
Nov
(58) |
Dec
(24) |
| 2007 |
Jan
(28) |
Feb
(14) |
Mar
(10) |
Apr
(68) |
May
(30) |
Jun
(26) |
Jul
(18) |
Aug
(63) |
Sep
(19) |
Oct
(29) |
Nov
(20) |
Dec
(10) |
| 2008 |
Jan
(38) |
Feb
(7) |
Mar
(37) |
Apr
(120) |
May
(41) |
Jun
(36) |
Jul
(39) |
Aug
(24) |
Sep
(28) |
Oct
(30) |
Nov
(36) |
Dec
(75) |
| 2009 |
Jan
(46) |
Feb
(22) |
Mar
(50) |
Apr
(70) |
May
(134) |
Jun
(105) |
Jul
(75) |
Aug
(34) |
Sep
(38) |
Oct
(34) |
Nov
(19) |
Dec
(20) |
| 2010 |
Jan
(11) |
Feb
(20) |
Mar
(65) |
Apr
(83) |
May
(104) |
Jun
(73) |
Jul
(78) |
Aug
(57) |
Sep
(43) |
Oct
(35) |
Nov
(9) |
Dec
(4) |
| 2011 |
Jan
(21) |
Feb
(11) |
Mar
(18) |
Apr
(10) |
May
(18) |
Jun
(15) |
Jul
(48) |
Aug
(25) |
Sep
(17) |
Oct
(45) |
Nov
(15) |
Dec
(12) |
| 2012 |
Jan
(21) |
Feb
(9) |
Mar
(12) |
Apr
(9) |
May
(9) |
Jun
(5) |
Jul
(1) |
Aug
(10) |
Sep
(12) |
Oct
(1) |
Nov
(28) |
Dec
(5) |
| 2013 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2014 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
| 2016 |
Jan
(2) |
Feb
(1) |
Mar
(1) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
|
1
|
2
|
3
(2) |
|
4
|
5
(2) |
6
(5) |
7
|
8
(7) |
9
(1) |
10
|
|
11
|
12
(4) |
13
|
14
|
15
|
16
|
17
|
|
18
|
19
|
20
(36) |
21
(5) |
22
|
23
|
24
|
|
25
|
26
(8) |
27
(1) |
28
(4) |
29
|
30
(25) |
31
(19) |
|
From: Brian M. <ma...@us...> - 2004-01-06 20:00:54
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/openal In directory sc8-pr-cvs1:/tmp/cvs-serv15407 Modified Files: PositionTest.java Log Message: better handling of minimized mode Index: PositionTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/openal/PositionTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/openal/PositionTest.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- PositionTest.java 27 Dec 2003 15:28:17 -0000 1.6 +++ PositionTest.java 6 Jan 2004 19:44:29 -0000 1.7 @@ -39,6 +39,9 @@ /** Whether the demo is done */ private boolean finished = false; + + /** Whether in pause mode */ + private boolean pauseMode = false; // OpenAL stuff // =================================================== @@ -243,30 +246,62 @@ while (!finished) { // handle any input handleInput(); - - // render the scene - render(); - + + // render and paint if !minimized and not dirty + if(!Window.isMinimized() || Window.isDirty()) { + render(); + Window.paint(); + } else { + // sleeeeeep + pause(100); + } + // allow window to process internal messages Window.update(); - // paint the content and flip buffer - Window.paint(); - + // act on pause mode + paused(Window.isMinimized()); + // start sound after first paint, since we don't want // the delay before something is painted on the screen - if (firstRun) { + if (firstRun && !pauseMode) { firstRun = false; // start sounds with delays - AL.alSourcePlay(soundSources.get(LEFT)); - pause(300); - AL.alSourcePlay(soundSources.get(CENTER)); - pause(500); - AL.alSourcePlay(soundSources.get(RIGHT)); + startSounds(); } } } + + /** + * Starts playing the sounds at different times + */ + private void startSounds() { + AL.alSourcePlay(soundSources.get(LEFT)); + pause(300); + AL.alSourcePlay(soundSources.get(CENTER)); + pause(500); + AL.alSourcePlay(soundSources.get(RIGHT)); + } + + /** + * Handles any changes in pause mode + * + * @param paused Which pause mode to enter + */ + private void paused(boolean paused) { + // if requesting pause, and not paused - pause and stop sound + if(paused && !pauseMode) { + pauseMode = true; + AL.alSourcePause(soundSources); + } + + // else go out of pause mode and start sounds + else if(!paused && pauseMode) { + pauseMode = false; + startSounds(); + } + } /** * Handles any input @@ -374,6 +409,7 @@ { GL.glRotatef(20.0f, 1.0f, 1.0f, 0.0f); + // left GL.glPushMatrix(); { GL.glTranslatef(leftPosition.get(0), leftPosition.get(1), leftPosition.get(2)); @@ -382,6 +418,7 @@ } GL.glPopMatrix(); + // center GL.glPushMatrix(); { GL.glTranslatef(centerPosition.get(0), centerPosition.get(1), centerPosition.get(2)); @@ -390,6 +427,7 @@ } GL.glPopMatrix(); + // right GL.glPushMatrix(); { GL.glTranslatef(rightPosition.get(0), rightPosition.get(1), rightPosition.get(2)); @@ -398,7 +436,7 @@ } GL.glPopMatrix(); - //the listener + // listener GL.glPushMatrix(); { GL.glTranslatef(listenerPosition.get(0), listenerPosition.get(1), listenerPosition.get(2)); |
|
From: Brian M. <ma...@us...> - 2004-01-06 20:00:53
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal In directory sc8-pr-cvs1:/tmp/cvs-serv15654 Modified Files: CoreAL.java Log Message: fixed small bug in alSourcePlay Index: CoreAL.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/CoreAL.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/CoreAL.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- CoreAL.java 27 Dec 2003 02:10:56 -0000 1.24 +++ CoreAL.java 6 Jan 2004 19:45:32 -0000 1.25 @@ -495,7 +495,7 @@ * * @param sources array of sources to play */ - public static void alSourcePlay(int n, IntBuffer sources) { + public static void alSourcePlay(IntBuffer sources) { nalSourcePlayv(sources.remaining(), sources, sources.position()); } private static native void nalSourcePlayv(int n, IntBuffer sources, int offset); |
|
From: Brian M. <ma...@us...> - 2004-01-06 19:22:16
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/eax In directory sc8-pr-cvs1:/tmp/cvs-serv10107/java/org/lwjgl/openal/eax Modified Files: BaseEAX.java CoreEAX.java EAXBufferProperties.java EAXListenerProperties.java Log Message: New EAX model implemented - needs more testing Index: BaseEAX.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/eax/BaseEAX.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/eax/BaseEAX.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- BaseEAX.java 17 Aug 2003 16:38:57 -0000 1.7 +++ BaseEAX.java 6 Jan 2004 19:22:12 -0000 1.8 @@ -53,12 +53,6 @@ } /** - * Override to provide any initialization code after creation. - */ - protected static void init() { - } - - /** * Static initialization */ private static void initialize() { @@ -79,7 +73,7 @@ throw new Exception("EAX instance could not be created."); } created = true; - init(); + CoreEAX.init(); } /** @@ -104,4 +98,11 @@ * Native method the destroy the EAX */ protected static native void nDestroy(); + + /** + * @return true if EAX has been created + */ + public static boolean isCreated() { + return created; + } } Index: CoreEAX.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/eax/CoreEAX.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/eax/CoreEAX.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- CoreEAX.java 17 Aug 2003 16:38:57 -0000 1.5 +++ CoreEAX.java 6 Jan 2004 19:22:12 -0000 1.6 @@ -44,17 +44,16 @@ public class CoreEAX extends BaseEAX implements BaseEAXConstants { /** GUID for buffer */ - public static int BUFFER_GUID; + public static final int BUFFER_GUID = 1; /** GUID for listener */ - public static int LISTENER_GUID; + public static final int LISTENER_GUID = 2; /** * Load extensions */ - protected static void init() { + protected static void init() { determineAvailableExtensions(); - setGUID(); } /** @@ -63,11 +62,6 @@ protected static native void determineAvailableExtensions(); /** - * Sets the GUID's for the buffer and listener objects - */ - protected static native void setGUID(); - - /** * Retrieves an EAX Value * * @param propertySetID adress to the property set GUID of the object being queried (a listener or a source) @@ -77,7 +71,10 @@ * @param size size of area being written to * @return OpenAL Error code */ - public static native int eaxGet(int propertySetID, int property, int source, Buffer data, int size); + public static int eaxGet(int propertySetID, int property, int source, Buffer data, int size) { + return neaxGet(propertySetID, property, source, data, data.position(), size); + } + private static native int neaxGet(int propertySetID, int property, int source, Buffer data, int position, int size); /** * Sets an EAX Value @@ -89,5 +86,8 @@ * @param size size of area being written to * @return OpenAL Error code */ - public static native int eaxSet(int propertySetID, int property, int source, Buffer data, int size); + public static int eaxSet(int propertySetID, int property, int source, Buffer data, int size) { + return neaxSet(propertySetID, property, source, data, data.position(), size); + } + private static native int neaxSet(int propertySetID, int property, int source, Buffer data, int position, int size); } Index: EAXBufferProperties.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/eax/EAXBufferProperties.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/eax/EAXBufferProperties.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- EAXBufferProperties.java 17 Aug 2003 16:38:57 -0000 1.10 +++ EAXBufferProperties.java 6 Jan 2004 19:22:12 -0000 1.11 @@ -45,12 +45,21 @@ * @version $Revision$ */ public class EAXBufferProperties { + + /** Whether auto commit has been anabled */ + private boolean autoCommit = true; + + /** Current source being operated on */ + private int currentSource = -1; /** ByteBuffer representing EAXBUFFERPROPERTIES */ protected ByteBuffer eaxBufferProperties; /** size needed by ByteBuffer to contain EAXBUFFERPROPERTIES */ protected static int EAXBUFFERPROPERTIES_SIZE; + + // EAX values and offsets + // ======================================================== /** direct path level offset */ protected static int direct_offset; @@ -181,48 +190,193 @@ (EAXBUFFER_FLAGS_DIRECTHFAUTO | EAXBUFFER_FLAGS_ROOMAUTO | EAXBUFFER_FLAGS_ROOMHFAUTO); + + // ------------------------------------------------------- static { System.loadLibrary(org.lwjgl.Sys.getLibraryName()); EAXBUFFERPROPERTIES_SIZE = sizeOfEaxBufferProperties(); assignOffsets(); } - + + /** + * Creates a new EAXBufferProperties object + */ public EAXBufferProperties() { eaxBufferProperties = ByteBuffer.allocateDirect(EAXBUFFERPROPERTIES_SIZE); eaxBufferProperties.order(ByteOrder.nativeOrder()); } - + /** - * Sets an EAX Value - * - * @param property property being queried - * @param source the source to be queried + * Sets the current source on which to perform effects + * + * @param source Source on which to perform effects */ - public void eaxSet(int property, int source) { - EAX.eaxSet( - CoreEAX.BUFFER_GUID, - property, - source, - eaxBufferProperties, - EAXBUFFERPROPERTIES_SIZE); + public void setCurrentSource(int source) { + currentSource = source; } - + /** - * Sets an EAX Value - * - * @param property property being queried - * @param source the source to be queried + * Retrieves the current source + * + * @return Source on which effects are being performed */ - public void eaxGet(int property, int source) { + public int getCurrentSource() { + return currentSource; + } + + /** + * Loads current EAX values from current source + */ + public void loadEAXValues() { EAX.eaxGet( - CoreEAX.BUFFER_GUID, - property, - source, - eaxBufferProperties, - EAXBUFFERPROPERTIES_SIZE); + CoreEAX.BUFFER_GUID, + EAXBUFFER_ALLPARAMETERS, + currentSource, + eaxBufferProperties, + EAXBUFFERPROPERTIES_SIZE); } + + /** + * Resets this buffer property to default values + */ + public void reset() { + boolean commitValue = autoCommit; + + // disable autocommit + autoCommit = false; + + // set values + setDirect(EAXBUFFER_DEFAULTDIRECT); + setDirectHF(EAXBUFFER_DEFAULTDIRECTHF); + setRoom(EAXBUFFER_DEFAULTROOM); + setRoomHF(EAXBUFFER_DEFAULTROOMHF); + setRoomRolloffFactor(EAXBUFFER_DEFAULTROOMROLLOFFFACTOR); + setObstruction(EAXBUFFER_DEFAULTOBSTRUCTION); + setObstructionLFRatio(EAXBUFFER_DEFAULTOBSTRUCTIONLFRATIO); + setOcclusion(EAXBUFFER_DEFAULTOCCLUSION); + setOcclusionLFRatio(EAXBUFFER_DEFAULTOCCLUSIONLFRATIO); + setOcclusionRoomRatio(EAXBUFFER_DEFAULTOCCLUSIONROOMRATIO); + setOutsideVolumeHF(EAXBUFFER_DEFAULTOUTSIDEVOLUMEHF); + setAirAbsorptionFactor(EAXBUFFER_DEFAULTAIRABSORPTIONFACTOR); + setFlags(EAXBUFFER_DEFAULTFLAGS); + + // reset auto commit + autoCommit = commitValue; + } + + + /** + * Commits any changes + */ + public void commit() { + // call eaxSet with Buffer guid, setting all parameters + EAX.eaxSet( + CoreEAX.BUFFER_GUID, EAXBUFFER_ALLPARAMETERS, + currentSource, eaxBufferProperties, EAXBUFFERPROPERTIES_SIZE); + } + + /** + * Tests whether auto commit is enabled or not + * + * @return true if auto commit is inabled + */ + public boolean isAutoCommitEnabled() { + return autoCommit; + } + + /** + * Enabled or disables auto commit + * + * @param enabled True to enable, false to disable + */ + public void setAutoCommit(boolean enabled) { + autoCommit = enabled; + } + + /** + * Performs auto commit, if enabled + */ + private final void autoCommit() { + if(autoCommit) { + commit(); + } + } + + /** + * Retrieves the size of the containing ByteBuffer + */ + public static int getSize() { + return EAXBUFFERPROPERTIES_SIZE; + } + + /** + * Returns a String representation of the EAXBufferProperties object + * + * @return String representation of the EAXBufferProperties object + */ + public String toString() { + StringBuffer sb = new StringBuffer(); + sb.append("EAXBufferProperties ["); + + sb.append("lDirect = "); + sb.append(getDirect()); + sb.append(", "); + + sb.append("lDirectHF = "); + sb.append(getDirectHF()); + sb.append(", "); + + sb.append("lRoom = "); + sb.append(getRoom()); + sb.append(", "); + + sb.append("lRoomHF = "); + sb.append(getRoomHF()); + sb.append(", "); + + sb.append("flRoomRolloffFactor = "); + sb.append(getRoomRolloffFactor()); + sb.append(", "); + + sb.append("lObstruction = "); + sb.append(getObstruction()); + sb.append(", "); + + sb.append("flObstructionLFRatio = "); + sb.append(getObstructionLFRatio()); + sb.append(", "); + + sb.append("lOcclusion = "); + sb.append(getOcclusion()); + sb.append(", "); + + sb.append("flOcclusionLFRatio = "); + sb.append(getOcclusionLFRatio()); + sb.append(", "); + + sb.append("flOcclusionRoomRatio = "); + sb.append(getOcclusionRoomRatio()); + sb.append(", "); + + sb.append("lOutsideVolumeHF = "); + sb.append(getOutsideVolumeHF()); + sb.append(", "); + + sb.append("flAirAbsorptionFactor = "); + sb.append(getAirAbsorptionFactor()); + sb.append(", "); + + sb.append("dwFlags = "); + sb.append(getFlags()); + + sb.append("]"); + return sb.toString(); + } + // Getters and Setters of struct + // ========================================================================== + /** * Retireves the direct path level * @@ -239,6 +393,7 @@ */ public void setDirect(int direct) { eaxBufferProperties.putInt(direct_offset, direct); + autoCommit(); } /** @@ -257,6 +412,7 @@ */ public void setDirectHF(int directHF) { eaxBufferProperties.putInt(directHF_offset, directHF); + autoCommit(); } /** @@ -275,6 +431,7 @@ */ public void setRoom(int room) { eaxBufferProperties.putInt(room_offset, room); + autoCommit(); } /** @@ -293,6 +450,7 @@ */ public void setRoomHF(int roomHF) { eaxBufferProperties.putInt(roomHF_offset, roomHF); + autoCommit(); } /** @@ -311,6 +469,7 @@ */ public void setRoomRolloffFactor(float roomRolloffFactor) { eaxBufferProperties.putFloat(roomRolloffFactor_offset, roomRolloffFactor); + autoCommit(); } /** @@ -329,6 +488,7 @@ */ public void setObstruction(int obstruction) { eaxBufferProperties.putInt(obstruction_offset, obstruction); + autoCommit(); } /** @@ -347,6 +507,7 @@ */ public void setObstructionLFRatio(float obstructionLFRatio) { eaxBufferProperties.putFloat(obstructionLFRatio_offset, obstructionLFRatio); + autoCommit(); } /** @@ -365,6 +526,7 @@ */ public void setOcclusion(int occlusion) { eaxBufferProperties.putInt(occlusion_offset, occlusion); + autoCommit(); } /** @@ -383,6 +545,7 @@ */ public void setOcclusionLFRatio(float occlusionLFRatio) { eaxBufferProperties.putFloat(occlusionLFRatio_offset, occlusionLFRatio); + autoCommit(); } /** @@ -401,6 +564,7 @@ */ public void setOcclusionRoomRatio(float occlusionRoomRatio) { eaxBufferProperties.putFloat(occlusionRoomRatio_offset, occlusionRoomRatio); + autoCommit(); } /** @@ -419,6 +583,7 @@ */ public void setOutsideVolumeHF(int outsideVolumeHF) { eaxBufferProperties.putInt(outsideVolumeHF_offset, outsideVolumeHF); + autoCommit(); } /** @@ -436,9 +601,8 @@ * @param airAbsorptionFactor multiplier for DSPROPERTY_EAXLISTENER_AIRABSORPTIONHF to set to */ public void setAirAbsorptionFactor(float airAbsorptionFactor) { - eaxBufferProperties.putFloat( - airAbsorptionFactor_offset, - airAbsorptionFactor); + eaxBufferProperties.putFloat(airAbsorptionFactor_offset, airAbsorptionFactor); + autoCommit(); } /** @@ -457,15 +621,11 @@ */ public void setFlags(int flags) { eaxBufferProperties.putInt(flags_offset, flags); + autoCommit(); } - - /** - * Retrieves the size of the containing ByteBuffer - */ - public static int getSize() { - return EAXBUFFERPROPERTIES_SIZE; - } - + + // -------------------------------------------------------------------------- + /** * Retrieves the size of the EAXBUFFERPROPERTIES */ @@ -474,46 +634,5 @@ /** * Sets the offsets to the fields */ - protected static native void assignOffsets(); - - /** - * Retrieves the size of the property - * - * @param property Property to determine size of - * @return size of property - */ - private static int getSizeOfProperty(int property) { - switch (property) { - case EAXBufferProperties.EAXBUFFER_NONE : - return 0; - - /* long */ - case EAXBufferProperties.EAXBUFFER_DIRECT : - case EAXBufferProperties.EAXBUFFER_DIRECTHF : - case EAXBufferProperties.EAXBUFFER_ROOM : - case EAXBufferProperties.EAXBUFFER_ROOMHF : - case EAXBufferProperties.EAXBUFFER_OBSTRUCTION : - case EAXBufferProperties.EAXBUFFER_OCCLUSION : - case EAXBufferProperties.EAXBUFFER_OUTSIDEVOLUMEHF : - - /* float */ - case EAXBufferProperties.EAXBUFFER_ROOMROLLOFFFACTOR : - case EAXBufferProperties.EAXBUFFER_OBSTRUCTIONLFRATIO : - case EAXBufferProperties.EAXBUFFER_OCCLUSIONLFRATIO : - case EAXBufferProperties.EAXBUFFER_OCCLUSIONROOMRATIO : - case EAXBufferProperties.EAXBUFFER_AIRABSORPTIONFACTOR : - - /* unsigned long */ - case EAXBufferProperties.EAXBUFFER_FLAGS : - return 4; - - case EAXBufferProperties.EAXBUFFER_ALLPARAMETERS : - return EAXBufferProperties.EAXBUFFERPROPERTIES_SIZE; - - default : - throw new IllegalArgumentException( - "No such property '" + property + "'"); - - } - } + protected static native void assignOffsets(); } Index: EAXListenerProperties.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/eax/EAXListenerProperties.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/eax/EAXListenerProperties.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- EAXListenerProperties.java 17 Aug 2003 16:38:57 -0000 1.9 +++ EAXListenerProperties.java 6 Jan 2004 19:22:12 -0000 1.10 @@ -43,12 +43,18 @@ * @version $Revision$ */ public class EAXListenerProperties { + + /** Whether auto commit has been anabled */ + private boolean autoCommit = true; /** ByteBuffer representing EAXLISTENERPROPERTIES */ protected ByteBuffer eaxListenerProperties; /** size needed by ByteBuffer to contain EAXLISTENERPROPERTIES */ protected static int EAXLISTENERPROPERTIES_SIZE; + + // EAX values and offsets + // ======================================================== /** room effect level offset */ protected static int room_offset; @@ -201,6 +207,9 @@ | EAXLISTENERFLAGS_REVERBSCALE | EAXLISTENERFLAGS_REVERBDELAYSCALE | EAXLISTENERFLAGS_DECAYHFLIMIT); + + // ------------------------------------------------------- + static { System.loadLibrary(org.lwjgl.Sys.getLibraryName()); EAXLISTENERPROPERTIES_SIZE = sizeOfEaxListenerProperties(); @@ -212,36 +221,163 @@ ByteBuffer.allocateDirect(EAXLISTENERPROPERTIES_SIZE); eaxListenerProperties.order(ByteOrder.nativeOrder()); } + + /** + * Loads current EAX values + */ + public void loadEAXValues() { + EAX.eaxGet( + CoreEAX.LISTENER_GUID, + EAXLISTENER_ALLPARAMETERS, + 0, + eaxListenerProperties, + EAXLISTENERPROPERTIES_SIZE ); + } /** - * Sets an EAX Value - * - * @param property property being queried - * @param source the source to be queried + * Resets this buffer property to default values */ - public void eaxSet(int property, int source) { + public void reset() { + boolean commitValue = autoCommit; + + // disable autocommit + autoCommit = false; + + // set values + setRoom(EAXLISTENER_DEFAULTROOM); + setRoomHF(EAXLISTENER_DEFAULTROOMHF); + setRoomRolloffFactor(EAXLISTENER_DEFAULTROOMROLLOFFFACTOR); + setDecayTime(EAXLISTENER_DEFAULTDECAYTIME); + setDecayTimeHFRatio(EAXLISTENER_DEFAULTDECAYHFRATIO); + setReflections(EAXLISTENER_DEFAULTREFLECTIONS); + setReflectionsDelay(EAXLISTENER_DEFAULTREFLECTIONSDELAY); + setReverb(EAXLISTENER_DEFAULTREVERB); + setReverbDelay(EAXLISTENER_DEFAULTREVERBDELAY); + setEnvironment(EAXLISTENER_DEFAULTENVIRONMENT); + setEnvironmentSize(EAXLISTENER_DEFAULTENVIRONMENTSIZE); + setEnvironmentDiffusion(EAXLISTENER_DEFAULTENVIRONMENTDIFFUSION); + setAirAbsorptionFactor(EAXLISTENER_DEFAULTAIRABSORPTIONHF); + setFlags(EAXLISTENER_DEFAULTFLAGS); + + // reset auto commit + autoCommit = commitValue; + } + + + /** + * Commits any changes + */ + public void commit() { + // call eaxSet with Listener guid, setting all parameters EAX.eaxSet( - CoreEAX.LISTENER_GUID, - property, - source, - eaxListenerProperties, - EAXLISTENERPROPERTIES_SIZE); + CoreEAX.LISTENER_GUID, EAXLISTENER_ALLPARAMETERS | EAXLISTENER_IMMEDIATE, + 0, eaxListenerProperties, EAXLISTENERPROPERTIES_SIZE); + } + + /** + * Tests whether auto commit is enabled or not + * + * @return true if auto commit is inabled + */ + public boolean isAutoCommitEnabled() { + return autoCommit; + } + + /** + * Enabled or disables auto commit + * + * @param enabled True to enable, false to disable + */ + public void setAutoCommit(boolean enabled) { + autoCommit = enabled; + } + + /** + * Performs auto commit, if enabled + */ + private final void autoCommit() { + if(autoCommit) { + commit(); + } } /** - * Gets an EAX Value - * - * @param property property being queried - * @param source the source to be queried + * Retrieves the size of the containing ByteBuffer */ - public void eaxGet(int property, int source) { - EAX.eaxGet( - CoreEAX.LISTENER_GUID, - property, - source, - eaxListenerProperties, - EAXLISTENERPROPERTIES_SIZE); + public int getSize() { + return EAXLISTENERPROPERTIES_SIZE; } + + /** + * Returns a String representation of the EAXBufferProperties object + * + * @return String representation of the EAXBufferProperties object + */ + public String toString() { + StringBuffer sb = new StringBuffer(); + sb.append("EAXListenerProperties ["); + + sb.append("lRoom = "); + sb.append(getRoom()); + sb.append(", "); + + sb.append("lRoomHF = "); + sb.append(getRoomHF()); + sb.append(", "); + + sb.append("flRoomRolloffFactor = "); + sb.append(getRoomRolloffFactor()); + sb.append(", "); + + sb.append("flDecayTime = "); + sb.append(getDecayTime()); + sb.append(", "); + + sb.append("flDecayHFRatio = "); + sb.append(getDecayTimeHFRatio()); + sb.append(", "); + + sb.append("lReflections = "); + sb.append(getReflections()); + sb.append(", "); + + sb.append("flReflectionsDelay = "); + sb.append(getReflectionsDelay()); + sb.append(", "); + + sb.append("lReverb = "); + sb.append(getReverb()); + sb.append(", "); + + sb.append("flReverbDelay = "); + sb.append(getReverbDelay()); + sb.append(", "); + + sb.append("dwEnvironment = "); + sb.append(getEnvironment()); + sb.append(", "); + + sb.append("flEnvironmentSize = "); + sb.append(getEnvironmentSize()); + sb.append(", "); + + sb.append("flEnvironmentDiffusion = "); + sb.append(getEnvironmentDiffusion()); + sb.append(", "); + + sb.append("flAirAbsorptionHF = "); + sb.append(getAirAbsorptionHF()); + sb.append(", "); + + sb.append("dwFlags = "); + sb.append(getFlags()); + + sb.append("]"); + return sb.toString(); + } + + // Getters and Setters of struct + // ========================================================================== /** * Retireves the room effect level @@ -259,6 +395,7 @@ */ public void setRoom(int room) { eaxListenerProperties.putInt(room_offset, room); + autoCommit(); } /** @@ -277,6 +414,7 @@ */ public void setRoomHF(int roomHF) { eaxListenerProperties.putInt(roomHF_offset, roomHF); + autoCommit(); } /** @@ -295,6 +433,7 @@ */ public void setRoomRolloffFactor(float roomRolloffFactor) { eaxListenerProperties.putFloat(roomRolloffFactor_offset, roomRolloffFactor); + autoCommit(); } /** @@ -313,6 +452,7 @@ */ public void setDecayTime(float decayTime) { eaxListenerProperties.putFloat(decayTime_offset, decayTime); + autoCommit(); } /** @@ -331,6 +471,7 @@ */ public void setDecayTimeHFRatio(float decayTimeHFRatio) { eaxListenerProperties.putFloat(decayHFRatio_offset, decayTimeHFRatio); + autoCommit(); } /** @@ -349,6 +490,7 @@ */ public void setReflections(int reflections) { eaxListenerProperties.putInt(reflections_offset, reflections); + autoCommit(); } /** @@ -367,6 +509,7 @@ */ public void setReflectionsDelay(float reflectionsDelay) { eaxListenerProperties.putFloat(reflectionsDelay_offset, reflectionsDelay); + autoCommit(); } /** @@ -385,6 +528,7 @@ */ public void setReverb(int reverb) { eaxListenerProperties.putInt(reverb_offset, reverb); + autoCommit(); } /** @@ -403,6 +547,7 @@ */ public void setReverbDelay(float reverbDelay) { eaxListenerProperties.putFloat(reverbDelay_offset, reverbDelay); + autoCommit(); } /** @@ -421,6 +566,22 @@ */ public void setEnvironment(int environment) { eaxListenerProperties.putInt(environment_offset, environment); + + // we need to handle environment differently than all other + // values on auto commit, since it cannot be single handely set + // using ALLPARAMETERS + // + // To set the environment specifically we need to pass + // only the environment value and its size. Also pass the + // EAXLISTENER_ENVIRONMENT value (and since we're committing IMMEDIATE too) + if (autoCommit) { + EAX.eaxSet( + CoreEAX.LISTENER_GUID, EAXLISTENER_ENVIRONMENT | EAXLISTENER_IMMEDIATE, + 0, eaxListenerProperties.position(environment_offset), 4); + + // rewind buffer + eaxListenerProperties.rewind(); + } } /** @@ -439,6 +600,22 @@ */ public void setEnvironmentSize(float environmentSize) { eaxListenerProperties.putFloat(environmentSize_offset, environmentSize); + + // we need to handle environment size differently than all other + // values on auto commit, since it cannot be single handely set + // using ALLPARAMETERS + // + // To set the environment size specifically we need to pass + // only the environment size value and its size. Also pass the + // EAXLISTENER_ENVIRONMENTSIZE value (and since we're committing IMMEDIATE too) + if (autoCommit) { + EAX.eaxSet( + CoreEAX.LISTENER_GUID, EAXLISTENER_ENVIRONMENTSIZE | EAXLISTENER_IMMEDIATE, + 0, eaxListenerProperties.position(environmentSize_offset), 4); + + // rewind buffer + eaxListenerProperties.rewind(); + } } /** @@ -456,9 +633,8 @@ * @param environmentDiffusion environment diffusion to set to */ public void setEnvironmentDiffusion(float environmentDiffusion) { - eaxListenerProperties.putFloat( - environmentDiffusion_offset, - environmentDiffusion); + eaxListenerProperties.putFloat(environmentDiffusion_offset, environmentDiffusion); + autoCommit(); } /** @@ -477,6 +653,7 @@ */ public void setAirAbsorptionFactor(float airAbsorptionHF) { eaxListenerProperties.putFloat(airAbsorptionHF_offset, airAbsorptionHF); + autoCommit(); } /** @@ -495,14 +672,10 @@ */ public void setFlags(int flags) { eaxListenerProperties.putInt(flags_offset, flags); + autoCommit(); } - /** - * Retrieves the size of the containing ByteBuffer - */ - public int getSize() { - return EAXLISTENERPROPERTIES_SIZE; - } + // -------------------------------------------------------------------------- /** * Retrieves the size of the EAXLISTENERPROPERTIES |
|
From: Brian M. <ma...@us...> - 2004-01-06 19:22:15
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1:/tmp/cvs-serv10107/native/common Modified Files: extal.h org_lwjgl_openal_eax_CoreEAX.cpp org_lwjgl_openal_eax_CoreEAX.h Log Message: New EAX model implemented - needs more testing Index: extal.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/extal.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/extal.h,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- extal.h 22 Oct 2003 10:57:18 -0000 1.22 +++ extal.h 6 Jan 2004 19:22:12 -0000 1.23 @@ -128,17 +128,12 @@ #endif #ifdef _WIN32 -DEFINE_GUID(DSPROPSETID_EAX20_ListenerProperties, - 0x306a6a8, - 0xb224, - 0x11d2, - 0x99, 0xe5, 0x0, 0x0, 0xe8, 0xd8, 0xc7, 0x22); +// EAX 2.0 GUIDs +const GUID DSPROPSETID_EAX20_ListenerProperties + = { 0x306a6a8, 0xb224, 0x11d2, { 0x99, 0xe5, 0x0, 0x0, 0xe8, 0xd8, 0xc7, 0x22 } }; -DEFINE_GUID(DSPROPSETID_EAX20_BufferProperties, - 0x306a6a7, - 0xb224, - 0x11d2, - 0x99, 0xe5, 0x0, 0x0, 0xe8, 0xd8, 0xc7, 0x22); +const GUID DSPROPSETID_EAX20_BufferProperties + = { 0x306a6a7, 0xb224, 0x11d2, {0x99, 0xe5, 0x0, 0x0, 0xe8, 0xd8, 0xc7, 0x22 } }; #endif #define INITGUID Index: org_lwjgl_openal_eax_CoreEAX.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/org_lwjgl_openal_eax_CoreEAX.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/org_lwjgl_openal_eax_CoreEAX.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- org_lwjgl_openal_eax_CoreEAX.cpp 16 Jul 2003 21:16:36 -0000 1.7 +++ org_lwjgl_openal_eax_CoreEAX.cpp 6 Jan 2004 19:22:12 -0000 1.8 @@ -42,26 +42,20 @@ /* OpenAL includes */ #include "checkALerror.h" +#include "common_tools.h" #include "extal.h" -/** - * Throws an OAL exception with the specified message - */ -void ThrowException(JNIEnv *env, const char* message) { - jclass cls = env->FindClass("org/lwjgl/openal/OpenALException"); - env->ThrowNew(cls, message); -} - /* * Determines available EAX extensions */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_eax_CoreEAX_determineAvailableExtensions (JNIEnv *env, jclass clazz) { #ifdef _WIN32 + bool EAXSupported = false; //check that we have a current context if(alcGetCurrentContext() == NULL) { - ThrowException(env, "Unable to determine EAX Extensions: No current context"); + throwOpenALException(env, "Unable to determine EAX Extensions: No current context"); } //check for extension, and assign if available @@ -73,25 +67,10 @@ //throw exception if no EAX support if(EAXSupported != true) { - ThrowException(env, "Unable to determine EAX Extensions"); + throwOpenALException(env, "Unable to determine EAX Extensions"); } #else - ThrowException(env, "EAX extensions not supported"); -#endif -} - -JNIEXPORT void JNICALL Java_org_lwjgl_openal_eax_CoreEAX_setGUID (JNIEnv *env, jclass clazz) { -#ifdef _WIN32 - //get class/fields - jclass eax_class = env->FindClass("org/lwjgl/openal/eax/CoreEAX"); - jfieldID eaxBuffer_field = env->GetStaticFieldID(eax_class, "BUFFER_GUID", "I"); - jfieldID eaxListener_field = env->GetStaticFieldID(eax_class, "LISTENER_GUID", "I"); - - //set fields - env->SetStaticIntField(eax_class, eaxBuffer_field, (jint) &DSPROPSETID_EAX20_BufferProperties); - env->SetStaticIntField(eax_class, eaxListener_field, (jint) &DSPROPSETID_EAX20_ListenerProperties); -#else - ThrowException(env, "EAX extensions not supported"); + throwOpenALException(env, "EAX extensions not supported"); #endif } @@ -102,18 +81,20 @@ * ALenum EAXGet(const struct _GUID *propertySetID,ALuint property,ALuint source,ALvoid * *value,ALuint size); */ -JNIEXPORT jint JNICALL Java_org_lwjgl_openal_eax_CoreEAX_eaxGet (JNIEnv *env, jclass clazz, jint propertySetID, jint property, jint source, jobject value, jint size) { +JNIEXPORT jint JNICALL Java_org_lwjgl_openal_eax_CoreEAX_neaxGet (JNIEnv *env, jclass clazz, jint propertySetID, jint property, jint source, jobject value, jint offset, jint size) { #ifdef _WIN32 - /* - jint result = (jint) eaxGet((const struct _GUID*)propertySetID, (ALuint) property, (ALuint) source, (ALvoid*) env->GetDirectBufferAddress(value), (ALuint) size); - CHECK_AL_ERROR + jint result = 0; + // determine buffer or listener + if (propertySetID == org_lwjgl_openal_eax_CoreEAX_BUFFER_GUID) { + result = (jint) eaxGet(&DSPROPSETID_EAX20_BufferProperties, (ALuint) property, (ALuint) source, (ALvoid*) (offset + (const char*) env->GetDirectBufferAddress(value)), (ALuint) size); + } else if (propertySetID == org_lwjgl_openal_eax_CoreEAX_LISTENER_GUID) { + result = (jint) eaxGet(&DSPROPSETID_EAX20_ListenerProperties, (ALuint) property, (ALuint) source, (ALvoid*) (offset + (const char*) env->GetDirectBufferAddress(value)), (ALuint) size); + } + CHECK_AL_ERROR return result; - */ - printf("Method currently deactivated. Fixed soon\n"); - return -1; #else - ThrowException(env, "EAX extensions not supported"); + throwOpenALException(env, "EAX extensions not supported"); return 0; #endif } @@ -125,18 +106,20 @@ * ALenum EAXSet(const struct _GUID *propertySetID,ALuint property,ALuint source,ALvoid * *value,ALuint size); */ -JNIEXPORT jint JNICALL Java_org_lwjgl_openal_eax_CoreEAX_eaxSet (JNIEnv *env, jclass clazz, jint propertySetID, jint property, jint source, jobject value, jint size) { +JNIEXPORT jint JNICALL Java_org_lwjgl_openal_eax_CoreEAX_neaxSet (JNIEnv *env, jclass clazz, jint propertySetID, jint property, jint source, jobject value, jint offset, jint size) { #ifdef _WIN32 - /* - jint result = (jint) eaxSet((const struct _GUID*)propertySetID, (ALuint) property, (ALuint) source, env->GetDirectBufferAddress(value), (ALuint) size); - CHECK_AL_ERROR - + jint result = 0; + + // determine buffer or listener + if (propertySetID == org_lwjgl_openal_eax_CoreEAX_BUFFER_GUID) { + result = (jint) eaxSet(&DSPROPSETID_EAX20_BufferProperties, (ALuint) (property), source, (ALvoid*) (offset + (const char*) env->GetDirectBufferAddress(value)), (ALuint) size); + } else if (propertySetID == org_lwjgl_openal_eax_CoreEAX_LISTENER_GUID) { + result = (jint) eaxSet(&DSPROPSETID_EAX20_ListenerProperties, (ALuint) (property), source, (ALvoid*) (offset + (const char*) env->GetDirectBufferAddress(value)), (ALuint) size); + } + CHECK_AL_ERROR return result; - */ - printf("Method currently deactivated. Fixed soon\n"); - return -1; #else - ThrowException(env, "EAX extensions not supported"); + throwOpenALException(env, "EAX extensions not supported"); return 0; #endif } Index: org_lwjgl_openal_eax_CoreEAX.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/org_lwjgl_openal_eax_CoreEAX.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/org_lwjgl_openal_eax_CoreEAX.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- org_lwjgl_openal_eax_CoreEAX.h 25 Nov 2003 22:28:28 -0000 1.3 +++ org_lwjgl_openal_eax_CoreEAX.h 6 Jan 2004 19:22:12 -0000 1.4 @@ -8,8 +8,10 @@ extern "C" { #endif /* Inaccessible static: created */ -/* Inaccessible static: BUFFER_GUID */ -/* Inaccessible static: LISTENER_GUID */ +#undef org_lwjgl_openal_eax_CoreEAX_BUFFER_GUID +#define org_lwjgl_openal_eax_CoreEAX_BUFFER_GUID 1L +#undef org_lwjgl_openal_eax_CoreEAX_LISTENER_GUID +#define org_lwjgl_openal_eax_CoreEAX_LISTENER_GUID 2L /* * Class: org_lwjgl_openal_eax_CoreEAX * Method: determineAvailableExtensions @@ -20,27 +22,19 @@ /* * Class: org_lwjgl_openal_eax_CoreEAX - * Method: setGUID - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_org_lwjgl_openal_eax_CoreEAX_setGUID - (JNIEnv *, jclass); - -/* - * Class: org_lwjgl_openal_eax_CoreEAX - * Method: eaxGet - * Signature: (IIILjava/nio/Buffer;I)I + * Method: neaxGet + * Signature: (IIILjava/nio/Buffer;II)I */ -JNIEXPORT jint JNICALL Java_org_lwjgl_openal_eax_CoreEAX_eaxGet - (JNIEnv *, jclass, jint, jint, jint, jobject, jint); +JNIEXPORT jint JNICALL Java_org_lwjgl_openal_eax_CoreEAX_neaxGet + (JNIEnv *, jclass, jint, jint, jint, jobject, jint, jint); /* * Class: org_lwjgl_openal_eax_CoreEAX - * Method: eaxSet - * Signature: (IIILjava/nio/Buffer;I)I + * Method: neaxSet + * Signature: (IIILjava/nio/Buffer;II)I */ -JNIEXPORT jint JNICALL Java_org_lwjgl_openal_eax_CoreEAX_eaxSet - (JNIEnv *, jclass, jint, jint, jint, jobject, jint); +JNIEXPORT jint JNICALL Java_org_lwjgl_openal_eax_CoreEAX_neaxSet + (JNIEnv *, jclass, jint, jint, jint, jobject, jint, jint); #ifdef __cplusplus } |
|
From: Brian M. <ma...@us...> - 2004-01-06 19:22:15
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/openal In directory sc8-pr-cvs1:/tmp/cvs-serv10107/java/org/lwjgl/test/openal Modified Files: EAXTest.java MovingSoundTest.java Log Message: New EAX model implemented - needs more testing Index: EAXTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/openal/EAXTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/openal/EAXTest.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- EAXTest.java 17 Aug 2003 16:58:18 -0000 1.8 +++ EAXTest.java 6 Jan 2004 19:22:12 -0000 1.9 @@ -31,7 +31,14 @@ */ package org.lwjgl.test.openal; -import org.lwjgl.openal.eax.EAX; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.nio.IntBuffer; + +import org.lwjgl.openal.eax.*; +import org.lwjgl.openal.*; +import org.lwjgl.Sys; /** * $Id$ @@ -42,39 +49,240 @@ * @version $Revision$ */ public class EAXTest extends BasicTest { + + /** OpenAL buffers */ + private IntBuffer soundBuffers = createIntBuffer(1); + + /** OpenAL sources */ + private IntBuffer soundSources = createIntBuffer(1); + + /** Listener EAX property object */ + private EAXListenerProperties listenerProperties; + + /** Buffer EAX property object */ + private EAXBufferProperties bufferProperties; + + /** + * Creates an instance of EAXTest + */ + public EAXTest() { + super(); + } + + /** + * Runs the actual test, using supplied arguments + */ + protected void execute(String[] args) { + try { + System.out.print("Testing EAX support..."); + EAX.create(); + System.out.println("supported!"); + } catch (Exception e) { + System.out.println("not supported!"); + } - /** - * Creates an instance of EAXTest - */ - public EAXTest() { - super(); + try { + AL.create(); + AL.alGetError(); // clear any errors + } catch(Exception e) { + System.out.println("Unable to initialize OpenAL"); } - /** - * Runs the actual test, using supplied arguments - */ - protected void execute(String[] args) { - try { - System.out.print("Testing EAX support..."); - EAX.create(); - System.out.println("supported!"); - } catch (Exception e) { - System.out.println("no supported!"); + // continue with test if EAX is supported + if (EAX.isCreated() && AL.isCreated() && initialize()) { + runTest(); + + // kill sources and buffers + AL.alSourceStop(soundSources.get(0)); + AL.alDeleteSources(soundSources); + AL.alDeleteBuffers(soundBuffers); + + EAX.destroy(); + } + + //shutdown + alExit(); + + System.out.println("test done."); + } + + private boolean initialize() { + // creating buffers + Sys.log("Creating buffers"); + AL.alGenBuffers(soundBuffers); + soundBuffers.rewind(); + + // creating sources + Sys.log("Creating sources"); + AL.alGenSources(soundSources); + soundSources.rewind(); + + // load sound files (left, center, right).wav + Sys.log("Loading Footsteps.wav"); + WaveData footsteps = WaveData.create("Footsteps.wav"); + AL.alBufferData(soundBuffers.get(0), footsteps.format, footsteps.data, footsteps.data.capacity(), footsteps.samplerate); + AL.alSourcef(soundSources.get(0), AL.AL_PITCH, 1.0f); + AL.alSourcef(soundSources.get(0), AL.AL_GAIN, 1.0f); + AL.alSourcei(soundSources.get(0), AL.AL_BUFFER, soundBuffers.get(0)); + AL.alSourcei(soundSources.get(0), AL.AL_LOOPING, AL.AL_TRUE); + + // create eax property objects + listenerProperties = new EAXListenerProperties(); + bufferProperties = new EAXBufferProperties(); + + // set buffer to work on source 0 + bufferProperties.setCurrentSource(soundSources.get(0)); + + return AL.alGetError() == AL.AL_NO_ERROR; + } + + /** + * Runs the actual EAXTest + */ + private void runTest() { + boolean running = true; + char key; + + assert AL.alIsBuffer(soundBuffers.get(0)) : "Failed to validate buffer"; + + // handle menu + do { + printMenu(); + key = readInput(); + + switch (key) { + // play sound + case '1' : { + AL.alSourcePlay(soundSources.get(0)); + break; + } + + // stop sound + case '2' : { + AL.alSourceStop(soundSources.get(0)); + break; + } + + // add reverb + case '3' : { + listenerProperties.setEnvironment(EAX.EAX_ENVIRONMENT_HANGAR); + break; + } + + // remove reverb + case '4' : { + listenerProperties.setEnvironment(EAX.EAX_ENVIRONMENT_GENERIC); + break; + } + + // add occlusion + case '5' : { + bufferProperties.setOcclusion(bufferProperties.getOcclusion()-5000); + break; + } + + // remove occlusion + case '6' : { + bufferProperties.setOcclusion(bufferProperties.getOcclusion()+5000); + break; + } + + // add obstruction + case '7' : { + bufferProperties.setObstruction(bufferProperties.getObstruction()-5000); + break; + } + + // remove obstruction + case '8' : { + bufferProperties.setObstruction(bufferProperties.getObstruction()+5000); + break; + } + + // commit eax values + case 'c' : { + bufferProperties.commit(); + listenerProperties.commit(); + break; + } + + // toggle autocommit + case 't' : { + bufferProperties.setAutoCommit(!bufferProperties.isAutoCommitEnabled()); + listenerProperties.setAutoCommit(!listenerProperties.isAutoCommitEnabled()); + System.out.println("\n[Buffer] Auto Commit is now: " + bufferProperties.isAutoCommitEnabled()); + System.out.println("\n[Listen] Auto Commit is now: " + listenerProperties.isAutoCommitEnabled()); + break; } - //shutdown - alExit(); + // show current eax values + case 's' : { + System.out.println(bufferProperties); + System.out.println(listenerProperties); + break; + } - System.out.println("test done."); - } + // load current eax values + case 'l' : { + bufferProperties.loadEAXValues(); + listenerProperties.loadEAXValues(); + break; + } + + // reset to default values + case 'r' : { + bufferProperties.reset(); + listenerProperties.reset(); + break; + } + + // quit demo + case 'q' : { + running = false; + break; + } + } + } while (running); + } + + private void printMenu() { + System.out.println(""); + System.out.println("EAXTest menu, please select an option from the following list:"); + System.out.println("1: Play looping sound"); + System.out.println("2: Stop looping sound"); + System.out.println("3: Add reverberation effect"); + System.out.println("4: Remove reverberation effect"); + System.out.println("5: Add occlusion effect"); + System.out.println("6: Remove occlusion effect"); + System.out.println("7: Add obstruction effect"); + System.out.println("8: Remove obstruction effect"); + + System.out.println("C: Commit current eax values"); + System.out.println("L: Load current values"); + System.out.println("T: Toggle autocomit"); + System.out.println("R: Reset to inital values"); + System.out.println("S: Show current values"); - /** - * main entry point - * - * @param args String array containing arguments - */ - public static void main(String[] args) { - EAXTest eaxTest = new EAXTest(); - eaxTest.execute(args); + System.out.println("Q: Quit demo"); + System.out.print("Input: "); + } + + private char readInput() { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + try { + return br.readLine().toLowerCase().charAt(0); + } catch (IOException ioe) { + return 'q'; } + } + + /** + * main entry point + * + * @param args String array containing arguments + */ + public static void main(String[] args) { + EAXTest eaxTest = new EAXTest(); + eaxTest.execute(args); + } } Index: MovingSoundTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/openal/MovingSoundTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/openal/MovingSoundTest.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- MovingSoundTest.java 17 Aug 2003 18:40:58 -0000 1.23 +++ MovingSoundTest.java 6 Jan 2004 19:22:12 -0000 1.24 @@ -185,10 +185,8 @@ if(Keyboard.isKeyDown(Keyboard.KEY_E)) { if(eaxApplied) { eaxListenerProp.setEnvironment(EAX.EAX_ENVIRONMENT_GENERIC); - eaxListenerProp.eaxSet(EAXListenerProperties.EAXLISTENER_ENVIRONMENT, 0); } else { eaxListenerProp.setEnvironment(EAX.EAX_ENVIRONMENT_HANGAR); - eaxListenerProp.eaxSet(EAXListenerProperties.EAXLISTENER_ENVIRONMENT, 0); } eaxApplied = !eaxApplied; } |