|
From: Brian M. <ma...@us...> - 2003-04-27 18:37:42
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/openal In directory sc8-pr-cvs1:/tmp/cvs-serv21877a/java/org/lwjgl/test/openal Modified Files: ALCTest.java ALTest.java BasicTest.java EAXTest.java MovingSoundTest.java OpenALCreationTest.java PlayTest.java PlayTestMemory.java SourceLimitTest.java StressTest.java Log Message: New OpenAL programming model: no context/device fiddling easier initialization Index: ALCTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/openal/ALCTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/openal/ALCTest.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- ALCTest.java 6 Feb 2003 18:18:46 -0000 1.5 +++ ALCTest.java 27 Apr 2003 18:37:38 -0000 1.6 @@ -32,8 +32,6 @@ package org.lwjgl.test.openal; import org.lwjgl.openal.ALC; -import org.lwjgl.openal.ALCcontext; -import org.lwjgl.openal.ALCdevice; import org.lwjgl.Sys; import java.nio.IntBuffer; @@ -47,102 +45,73 @@ * @version $Revision$ */ public class ALCTest extends BasicTest { - - /** - * Creates an instance of ALCTest - */ - public ALCTest() { - super(); - } - - /** - * Runs the actual test, using supplied arguments - */ - protected void execute(String[] args) { - //error stuff - int lastError = ALC.NO_ERROR; - - //create a device - device = alc.openDevice(null); - if(device == null) { - System.out.println("Unable to create device"); - System.exit(-1); - } - - //create attribute list for context creation - IntBuffer buffer = createIntBuffer(7); - buffer.put(ALC.FREQUENCY); - buffer.put(44100); - buffer.put(ALC.REFRESH); - buffer.put(15); - buffer.put(ALC.SYNC); - buffer.put(ALC.FALSE); - buffer.put(0); //terminating int - - //create a context, using above attributes - context = alc.createContext(device, Sys.getDirectBufferAddress(buffer)); - if(context == null) { - System.out.println("Unable to create context"); - System.exit(-1); - } - - if((lastError = alc.getError(device)) != ALC.NO_ERROR) { - System.out.println("ALC Error: " + alc.getString(device, lastError)); - System.exit(-1); - } - - //make current - alc.makeContextCurrent(context); - - //process - alc.processContext(context); - //suspend - // alc.suspendContext(context); - - //query - System.out.println("DEFAULT_DEVICE_SPECIFIER: " + alc.getString(device, ALC.DEFAULT_DEVICE_SPECIFIER)); - System.out.println("DEVICE_SPECIFIER: " + alc.getString(device, ALC.DEVICE_SPECIFIER)); - System.out.println("EXTENSIONS: " + alc.getString(device, ALC.EXTENSIONS)); - - //mo query - buffer.rewind(); - alc.getIntegerv(device, ALC.MAJOR_VERSION, 4, Sys.getDirectBufferAddress(buffer)); - alc.getIntegerv(device, ALC.MINOR_VERSION, 4, Sys.getDirectBufferAddress(buffer)+4); + /** instance of alc */ + private ALC alc; - System.out.println("ALC_MAJOR_VERSION: " + buffer.get(0)); - System.out.println("ALC_MINOR_VERSION: " + buffer.get(1)); - - //no check for ALC_ALL_ATTRIBUTES / ALC_ATTRIBUTES_SIZE since it - //is buggy on win32 - my dev platform + /** + * Creates an instance of ALCTest + */ + public ALCTest() { + super(); + alc = al.getALC(); + } - //check current context - ALCcontext currentContext = alc.getCurrentContext(); - if(context.context != currentContext.context) { - System.out.println("Serious error! - context copy != current context"); - System.exit(-1); - } + /** + * Runs the actual test, using supplied arguments + */ + protected void execute(String[] args) { + //error stuff + int lastError = ALC.NO_ERROR; - //check contexts device - ALCdevice currentDevice = alc.getContextsDevice(context); - if(device.device != currentDevice.device) { - System.out.println("Serious error! - device copy != current contexts device"); - System.exit(-1); - } - - //get an enumerstion value - System.out.println("Value of ALC_MAJOR_VERSION: " + alc.getEnumValue(device, "ALC_MAJOR_VERSION")); - - alExit(); - } - - /** - * main entry point - * - * @param args String array containing arguments - */ - public static void main(String[] args) { - ALCTest alcTest = new ALCTest(); - alcTest.execute(args); - } + //create attribute list for context creation + IntBuffer buffer = createIntBuffer(7); + + if ((lastError = alc.getError()) != ALC.NO_ERROR) { + System.out.println("ALC Error: " + alc.getString(lastError)); + System.exit(-1); + } + + //query + System.out.println( + "DEFAULT_DEVICE_SPECIFIER: " + + alc.getString(ALC.DEFAULT_DEVICE_SPECIFIER)); + System.out.println( + "DEVICE_SPECIFIER: " + alc.getString(ALC.DEVICE_SPECIFIER)); + System.out.println("EXTENSIONS: " + alc.getString(ALC.EXTENSIONS)); + + //mo query + buffer.rewind(); + alc.getIntegerv( + ALC.MAJOR_VERSION, + 4, + Sys.getDirectBufferAddress(buffer)); + alc.getIntegerv( + ALC.MINOR_VERSION, + 4, + Sys.getDirectBufferAddress(buffer) + 4); + + System.out.println("ALC_MAJOR_VERSION: " + buffer.get(0)); + System.out.println("ALC_MINOR_VERSION: " + buffer.get(1)); + + //no check for ALC_ALL_ATTRIBUTES / ALC_ATTRIBUTES_SIZE since it + //is buggy on win32 - my dev platform + + //get an enumerstion value + System.out.println( + "Value of ALC_MAJOR_VERSION: " + + alc.getEnumValue("ALC_MAJOR_VERSION")); + + alExit(); + } + + /** + * main entry point + * + * @param args String array containing arguments + */ + public static void main(String[] args) { + ALCTest alcTest = new ALCTest(); + alcTest.execute(args); + } } Index: ALTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/openal/ALTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/openal/ALTest.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- ALTest.java 24 Mar 2003 11:56:04 -0000 1.5 +++ ALTest.java 27 Apr 2003 18:37:38 -0000 1.6 @@ -33,8 +33,6 @@ import org.lwjgl.openal.AL; import org.lwjgl.openal.ALC; -import org.lwjgl.openal.ALCcontext; -import org.lwjgl.openal.ALCdevice; import org.lwjgl.openal.eax.EAX; import org.lwjgl.openal.eax.EAXBufferProperties; import org.lwjgl.openal.eax.EAXListenerProperties; @@ -280,8 +278,6 @@ String szFnName; int ch = -1; int error; - ALCcontext context; - ALCdevice device; FloatBuffer listenerPos = createFloatBuffer(3); listenerPos.put(new float[] {0.0f, 0.0f, 0.0f}); @@ -296,17 +292,6 @@ System.out.print("=======================\n\n"); // Initialize Open AL manually - //Open device - device = alc.openDevice(null); - if (device == null) { - System.out.println("Could not create ALC device"); - System.exit(-1); - } - //Create context(s) - context = alc.createContext(device, 0); - //Set active context - alc.makeContextCurrent(context); - // Clear Error Code al.getError(); @@ -518,16 +503,16 @@ System.out.print("\nQ to quit\n\n\n"); try { - ch = System.in.read(); + ch = Character.toLowerCase((char) System.in.read()); eatInput(); } catch (IOException ioe) { } switch (ch) { - case 'A': + case 'a': fullAutoTests(); break; - case 'B': + case 'b': semiAutoTests(); break; case '1': @@ -567,7 +552,7 @@ default: break; } - } while (ch != 'Q'); + } while (ch != 'q'); } protected void fullAutoTests() { @@ -963,7 +948,7 @@ while (true) { ch = CRToContinue(); - if ((ch == 'S') || (ch == 's')) { + if (ch == 's') { return 0; } if (ch == 10) { @@ -976,7 +961,7 @@ int current = -1; try { //read one, and eat the rest - current = System.in.read(); + current = Character.toLowerCase((char) System.in.read()); eatInput(); } catch (Exception e) { } @@ -1004,11 +989,7 @@ String tempString; - ALCcontext pContext; - ALCdevice pDevice; - pContext = alc.getCurrentContext(); - pDevice = alc.getContextsDevice(pContext); - tempString = alc.getString(pDevice, ALC.DEVICE_SPECIFIER); + tempString = alc.getString(ALC.DEVICE_SPECIFIER); System.out.print("OpenAL Context Device Specifier is '" + tempString + "'\n"); tempString = al.getString(AL.RENDERER); System.out.print("OpenAL Renderer is '" + tempString + "'\n"); @@ -1869,7 +1850,7 @@ do { try { - ch = System.in.read(); + ch = Character.toLowerCase((char) System.in.read()); } catch (IOException ioe) { } @@ -1895,7 +1876,7 @@ displayALError("alSourceStop source 1 : ", error); break; } - } while (ch != 'Q'); + } while (ch != 'q'); // Release resources al.sourceStopv(2, Sys.getDirectBufferAddress(source)); @@ -2006,7 +1987,7 @@ System.out.print("\nSource 0 : Not looping Source 1 : Not looping\n"); do { try { - ch = System.in.read(); + ch = Character.toLowerCase((char) System.in.read()); } catch (IOException ioe) { } @@ -2056,7 +2037,7 @@ al.sourcei(source.get(1), AL.LOOPING, bLooping1); break; } - } while (ch != 'Q'); + } while (ch != 'q'); System.out.print("\n"); @@ -2171,12 +2152,12 @@ System.out.print("Press '8' to remove occlusion from source 0 (DEFERRED)\n"); System.out.print("Press '9' to obstruct source 1 (IMMEDIATE)\n"); System.out.print("Press '0' to remove obstruction from source 1 (IMMEDIATE)\n"); - System.out.print("Press 'c' to COMMIT EAX settings\n"); - System.out.print("Press 'q' to quit\n\n"); + System.out.print("Press 'C' to COMMIT EAX settings\n"); + System.out.print("Press 'Q' to quit\n\n"); do { try { - ch = System.in.read(); + ch = Character.toLowerCase((char) System.in.read()); } catch (IOException ioe) { } switch (ch) { @@ -2244,7 +2225,7 @@ displayALError("eaxSet EAXBUFFER_OBSTRUCTION : \n", error); break; - case 'C': + case 'c': // Commit settings on source 0 eax.eaxSet(EAX.BUFFER_GUID, EAXBufferProperties.COMMITDEFERREDSETTINGS, source.get(0), 0, 0); @@ -2258,7 +2239,7 @@ displayALError("eaxSet EAXLISTENER_COMMITDEFERREDSETTINGSENVIRONMENT : \n", error); break; } - } while (ch != 'Q'); + } while (ch != 'q'); // reset EAX level Room.put(0, -10000); @@ -2363,7 +2344,7 @@ do { try { - ch = System.in.read(); + ch = Character.toLowerCase((char) System.in.read()); } catch (IOException ioe) { } switch (ch) { @@ -2423,7 +2404,7 @@ if ((error = al.getError()) != AL.NO_ERROR) displayALError("alSourceQueueBuffers 1 (buffer 0) : ", error); break; - case 'A': + case 'a': // Unqueue first Buffer al.sourceUnqueueBuffers(source.get(0), 1, Sys.getDirectBufferAddress(buffersremoved)); @@ -2446,7 +2427,7 @@ System.out.print("\nRemoved Buffer " + buffersremoved.get(0) + " from queue\n"); } break; - case 'B': + case 'b': // Unqueue first 2 Buffers al.sourceUnqueueBuffers(source.get(0), 2, Sys.getDirectBufferAddress(buffersremoved)); @@ -2472,7 +2453,7 @@ System.out.print("\nRemoved Buffers " + buffersremoved.get(0) + " and " + buffersremoved.get(1) + " from queue\n"); } break; - case 'C': + case 'c': // Unqueue first 3 Buffers al.sourceUnqueueBuffers(source.get(0), 3, Sys.getDirectBufferAddress(buffersremoved)); if ((error = al.getError()) != AL.NO_ERROR) @@ -2499,7 +2480,7 @@ buffersremoved.get(2) +" from queue\n"); } break; - case 'D': + case 'd': // Unqueue first 4 Buffers al.sourceUnqueueBuffers(source.get(0), 4, Sys.getDirectBufferAddress(buffersremoved)); @@ -2529,7 +2510,7 @@ " from queue\n"); } break; - case 'E': + case 'e': // Unqueue first 5 Buffers al.sourceUnqueueBuffers(source.get(0), 5, Sys.getDirectBufferAddress(buffersremoved)); @@ -2560,7 +2541,7 @@ " from queue\n"); } break; - case 'F': + case 'f': al.sourcei(source.get(0), AL.BUFFER, 0); if ((error = al.getError()) != AL.NO_ERROR) displayALError("alSource AL_BUFFER NULL : ", error); @@ -2593,7 +2574,7 @@ BuffersInQueue.clear(); break; } - } while (ch != 'Q'); + } while (ch != 'q'); // Release resources al.sourceStop(source.get(0)); @@ -2650,7 +2631,7 @@ do { try { - ch = System.in.read(); + ch = Character.toLowerCase((char) System.in.read()); } catch (IOException ioe) { } @@ -2690,7 +2671,7 @@ displayALError("alSourceStop 0 : ", error); break; } - } while (ch != 'Q'); + } while (ch != 'q'); // Release resources al.sourceStopv(1, Sys.getDirectBufferAddress(source)); @@ -2751,7 +2732,7 @@ do { try { - ch = System.in.read(); + ch = Character.toLowerCase((char) System.in.read()); } catch (IOException ioe) { } @@ -2773,7 +2754,7 @@ displayALError("alSourcef source 0 AL PITCH 0.5: ", error); break; } - } while (ch != 'Q'); + } while (ch != 'q'); // Release resources al.sourceStopv(1, Sys.getDirectBufferAddress(source)); @@ -2824,7 +2805,7 @@ do { try { - ch = System.in.read(); + ch = Character.toLowerCase((char) System.in.read()); } catch (IOException ioe) { } @@ -2964,7 +2945,7 @@ break; } - } while (ch != 'Q'); + } while (ch != 'q'); // Release resources al.sourceStop(source.get(0)); @@ -3066,7 +3047,7 @@ do { try { - ch = System.in.read(); + ch = Character.toLowerCase((char) System.in.read()); } catch (IOException ioe) { } @@ -3111,28 +3092,28 @@ if ((error = al.getError()) != AL.NO_ERROR) displayALError("alSourcef 0 AL_GAIN 0.0 : \n", error); break; - case 'A': + case 'a': al.listenerf(AL.GAIN,1.0f); if ((error = al.getError()) != AL.NO_ERROR) displayALError("alListenerf AL_GAIN 1.0 : \n", error); break; - case 'B': + case 'b': al.listenerf(AL.GAIN,0.5f); if ((error = al.getError()) != AL.NO_ERROR) displayALError("alListenerf AL_GAIN 0.5 : \n", error); break; - case 'C': + case 'c': al.listenerf(AL.GAIN,0.25f); if ((error = al.getError()) != AL.NO_ERROR) displayALError("alListenerf AL_GAIN 0.25 : \n", error); break; - case 'D': + case 'd': al.listenerf(AL.GAIN,0.0f); if ((error = al.getError()) != AL.NO_ERROR) displayALError("alListenerf AL_GAIN 0.0 : \n", error); break; } - } while (ch != 'Q'); + } while (ch != 'q'); // Reset & Release resources al.listenerf(AL.GAIN,1.0f); @@ -3207,7 +3188,7 @@ do { try { - ch = System.in.read(); + ch = Character.toLowerCase((char) System.in.read()); } catch (IOException ioe) { } switch (ch) { @@ -3227,7 +3208,7 @@ displayALError("alSourceStopv : ", error); break; } - } while (ch != 'Q'); + } while (ch != 'q'); // Delete the Sources al.deleteSources(numSources, Sys.getDirectBufferAddress(Sources)); Index: BasicTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/openal/BasicTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/openal/BasicTest.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- BasicTest.java 21 Dec 2002 12:37:20 -0000 1.4 +++ BasicTest.java 27 Apr 2003 18:37:38 -0000 1.5 @@ -33,8 +33,6 @@ import org.lwjgl.openal.AL; import org.lwjgl.openal.ALC; -import org.lwjgl.openal.ALCcontext; -import org.lwjgl.openal.ALCdevice; import java.nio.ByteBuffer; import java.nio.ByteOrder; @@ -53,79 +51,27 @@ /** OpenAL instance */ protected AL al; - /** OpenAL Context instance */ + /** OpenALC instance */ protected ALC alc; - - /** OpenAL context */ - protected ALCcontext context; - - /** OpenAL device */ - protected ALCdevice device; - + /** * Creates an instance of PlayTest */ public BasicTest() { - al = new AL(); + al = new AL(null, 44100, 40, false); try { al.create(); } catch (Exception e) { e.printStackTrace(); return; - } - - alc = new ALC(); - try { - alc.create(); - } catch (Exception e) { - e.printStackTrace(); - return; } } /** - * Initializes OpenAL - */ - protected void alInitialize() { - - //get default device - device = alc.openDevice(null); - if(device == null) { - throw new RuntimeException("Error creating device"); - } - - //create context (no attributes specified) - context = alc.createContext(device, 0); - if(context == null) { - throw new RuntimeException("Error creating context"); - } - - //make context current - alc.makeContextCurrent(context); - if(alc.getError(device) != ALC.NO_ERROR) { - throw new RuntimeException("An error occurred while making context current"); - } - } - - /** * Shutdowns OpenAL */ protected void alExit() { - - //Get active context - context = alc.getCurrentContext(); - - //Get device for active context - device = alc.getContextsDevice(context); - - //Disable context - alc.makeContextCurrent(null); - - //Release context(s) - alc.destroyContext(context); - - //Close device - alc.closeDevice(device); + al.destroy(); } /** 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.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- EAXTest.java 21 Dec 2002 12:37:20 -0000 1.4 +++ EAXTest.java 27 Apr 2003 18:37:38 -0000 1.5 @@ -54,8 +54,6 @@ * Runs the actual test, using supplied arguments */ protected void execute(String[] args) { - alInitialize(); - EAX eax = new EAX(); try { eax.create(); 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.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- MovingSoundTest.java 28 Mar 2003 22:12:43 -0000 1.8 +++ MovingSoundTest.java 27 Apr 2003 18:37:38 -0000 1.9 @@ -83,10 +83,6 @@ IntBuffer Env = null; EAXBufferProperties eaxBufferProp = null; - - //initialize AL, using ALC - alInitialize(); - //initialize keyboard try { Keyboard.create(); Index: OpenALCreationTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/openal/OpenALCreationTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/openal/OpenALCreationTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- OpenALCreationTest.java 16 Mar 2003 22:52:35 -0000 1.1 +++ OpenALCreationTest.java 27 Apr 2003 18:37:38 -0000 1.2 @@ -35,8 +35,6 @@ import org.lwjgl.openal.AL; import org.lwjgl.openal.ALC; -import org.lwjgl.openal.ALCcontext; -import org.lwjgl.openal.ALCdevice; import java.nio.ByteBuffer; import java.nio.ByteOrder; @@ -59,18 +57,11 @@ /** OpenAL Context instance */ protected ALC alc; - /** OpenAL context */ - protected ALCcontext context; - - /** OpenAL device */ - protected ALCdevice device; - /** * Creates an instance of OpenALCreationTest */ public OpenALCreationTest() { - al = new AL(); - alc = new ALC(); + al = new AL(null, 44100, 15, false); } public void alInitialize() { @@ -80,51 +71,9 @@ e.printStackTrace(); return; } - - try { - alc.create(); - } catch (Exception e) { - e.printStackTrace(); - return; - } - - // get default device - device = alc.openDevice(null); - if (device == null) { - throw new RuntimeException("Error creating device"); - } - - //create context (no attributes specified) - context = alc.createContext(device, 0); - if (context == null) { - throw new RuntimeException("Error creating context"); - } - - //make context current - alc.makeContextCurrent(context); - if (alc.getError(device) != ALC.NO_ERROR) { - throw new RuntimeException("An error occurred while making context current"); - } } public void alExit() { - //Get active context - context = alc.getCurrentContext(); - - //Get device for active context - device = alc.getContextsDevice(context); - - //Disable context - alc.makeContextCurrent(null); - - //Release context(s) - alc.destroyContext(context); - - //Close device - alc.closeDevice(device); - - // destroy al/c - alc.destroy(); al.destroy(); } Index: PlayTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/openal/PlayTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/openal/PlayTest.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- PlayTest.java 21 Dec 2002 12:37:20 -0000 1.4 +++ PlayTest.java 27 Apr 2003 18:37:38 -0000 1.5 @@ -64,10 +64,7 @@ } int lastError; - - //initialize AL, using ALC - alInitialize(); - + //create 1 buffer and 1 source IntBuffer buffers = createIntBuffer(1); IntBuffer sources = createIntBuffer(1); Index: PlayTestMemory.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/openal/PlayTestMemory.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/openal/PlayTestMemory.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- PlayTestMemory.java 21 Dec 2002 12:37:20 -0000 1.4 +++ PlayTestMemory.java 27 Apr 2003 18:37:38 -0000 1.5 @@ -71,9 +71,6 @@ int lastError; - //initialize AL, using ALC - alInitialize(); - //create 1 buffer and 1 source IntBuffer buffers = createIntBuffer(1); IntBuffer sources = createIntBuffer(1); Index: SourceLimitTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/openal/SourceLimitTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/openal/SourceLimitTest.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- SourceLimitTest.java 21 Dec 2002 12:37:20 -0000 1.4 +++ SourceLimitTest.java 27 Apr 2003 18:37:38 -0000 1.5 @@ -70,9 +70,6 @@ } } - //initialize AL - alInitialize(); - System.out.print("Creating " + sourcesToCreate + " in one go..."); CreateAllSources(); Index: StressTest.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/test/openal/StressTest.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/test/openal/StressTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- StressTest.java 22 Dec 2002 21:43:07 -0000 1.3 +++ StressTest.java 27 Apr 2003 18:37:38 -0000 1.4 @@ -63,8 +63,6 @@ */ protected void execute(String[] args) { - alInitialize(); - createSources(); createBuffers(); @@ -134,7 +132,7 @@ al.sourcei(sources.get(0), AL.BUFFER, buffers.get(0)); al.sourcePlay(sources.get(0)); - while (System.currentTimeMillis() - startTime < (60000 * 60)) { + while (System.currentTimeMillis() - startTime < (2000)) { randomBuffer = getRandomBuffer(); System.out.println("random:" + randomBuffer); @@ -175,6 +173,12 @@ System.out.println("========================"); } } + + //stop all sources + for (int i = 0; i < 4; i++) { + al.sourceStop(sources.get(i)); + System.out.println("Stopping source " + (i+1)); + } //test done - ask for user input try { @@ -188,10 +192,6 @@ } catch (Exception e) { } - //stop all sources - for (int i = 0; i < 4; i++) { - al.sourceStop(sources.get(i)); - } al.deleteSources(4, Sys.getDirectBufferAddress(sources)); al.deleteBuffers(10, Sys.getDirectBufferAddress(buffers)); } |