From f19ef56df94c7ce641ba74ed9bdcebf0965aec5b Mon Sep 17 00:00:00 2001 From: Brian Matzon Date: Wed, 13 Aug 2003 21:03:57 +0000 Subject: [PATCH] fix: updated to 0.7 --- .../org/lwjgl/test/WindowCreationTest.java | 4 ++ src/java/org/lwjgl/test/openal/ALCTest.java | 11 ++--- .../lwjgl/test/openal/MovingSoundTest.java | 42 ++++++++++--------- .../lwjgl/test/openal/OpenALCreationTest.java | 12 ++++-- src/java/org/lwjgl/test/openal/PlayTest.java | 12 ++++-- .../org/lwjgl/test/openal/PlayTestMemory.java | 12 ++++-- .../lwjgl/test/openal/SourceLimitTest.java | 12 ++++-- .../org/lwjgl/test/openal/StressTest.java | 22 ++++++---- 8 files changed, 77 insertions(+), 50 deletions(-) diff --git a/src/java/org/lwjgl/test/WindowCreationTest.java b/src/java/org/lwjgl/test/WindowCreationTest.java index 22270bb7..b24dff0e 100644 --- a/src/java/org/lwjgl/test/WindowCreationTest.java +++ b/src/java/org/lwjgl/test/WindowCreationTest.java @@ -18,11 +18,15 @@ public class WindowCreationTest { DisplayMode[] modes = Display.getAvailableDisplayModes(); System.out.println("Found " + modes.length + " display modes"); + try { Window.create("WindowCreationTest", 50, 50, 320, 240, 16, 0, 0, 0); } catch (Exception e) { e.printStackTrace(); } + + System.out.println(Window.getHeight() + ", " + Window.getWidth() + ", " + Window.getTitle()); + System.out.println("Display created"); diff --git a/src/java/org/lwjgl/test/openal/ALCTest.java b/src/java/org/lwjgl/test/openal/ALCTest.java index 390e189b..aecc25f2 100644 --- a/src/java/org/lwjgl/test/openal/ALCTest.java +++ b/src/java/org/lwjgl/test/openal/ALCTest.java @@ -77,14 +77,9 @@ public class ALCTest extends BasicTest { //mo query buffer.rewind(); - ALC.alcGetIntegerv( - ALC.ALC_MAJOR_VERSION, - 4, - buffer); - ALC.alcGetIntegerv( - ALC.ALC_MINOR_VERSION, - 4, - ((IntBuffer)buffer.position(4)).slice()); + buffer.limit(1); + ALC.alcGetInteger(ALC.ALC_MAJOR_VERSION, buffer); + ALC.alcGetInteger(ALC.ALC_MINOR_VERSION, (IntBuffer) buffer.position(1).limit(2)); System.out.println("ALC_MAJOR_VERSION: " + buffer.get(0)); System.out.println("ALC_MINOR_VERSION: " + buffer.get(1)); diff --git a/src/java/org/lwjgl/test/openal/MovingSoundTest.java b/src/java/org/lwjgl/test/openal/MovingSoundTest.java index 8cf77eeb..0f8c7106 100644 --- a/src/java/org/lwjgl/test/openal/MovingSoundTest.java +++ b/src/java/org/lwjgl/test/openal/MovingSoundTest.java @@ -35,9 +35,9 @@ import org.lwjgl.openal.AL; import org.lwjgl.openal.eax.*; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.Window; +import org.lwjgl.vector.Vector3f; import java.nio.IntBuffer; -import java.nio.FloatBuffer; /** * $Id$ @@ -76,8 +76,8 @@ public class MovingSoundTest extends BasicTest { int lastError; - FloatBuffer sourcePosition = createFloatBuffer(3); - FloatBuffer listenerPosition = createFloatBuffer(3); + Vector3f sourcePosition = new Vector3f(); + Vector3f listenerPosition = new Vector3f(); boolean eaxApplied = false; EAXListenerProperties eaxListenerProp = null; @@ -94,12 +94,14 @@ public class MovingSoundTest extends BasicTest { IntBuffer sources = createIntBuffer(1); // al generate buffers and sources - AL.alGenBuffers(1, buffers); + buffers.position(0).limit(1); + AL.alGenBuffers(buffers); if ((lastError = AL.alGetError()) != AL.AL_NO_ERROR) { exit(lastError); } - AL.alGenSources(1, sources); + sources.position(0).limit(1); + AL.alGenSources(sources); if ((lastError = AL.alGetError()) != AL.AL_NO_ERROR) { exit(lastError); } @@ -159,24 +161,24 @@ public class MovingSoundTest extends BasicTest { Keyboard.poll(); if(Keyboard.isKeyDown(Keyboard.KEY_LEFT)) { if(Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) { - listenerPosition.put(0, listenerPosition.get(0) - MOVEMENT); - AL.alListenerfv(AL.AL_POSITION, listenerPosition); - System.out.println("listenerx: " + listenerPosition.get(0)); + listenerPosition.x -= MOVEMENT; + AL.alListener3f(AL.AL_POSITION, listenerPosition.x, listenerPosition.y, listenerPosition.z); + System.out.println("listenerx: " + listenerPosition.x); } else { - sourcePosition.put(0, sourcePosition.get(0) - MOVEMENT); - AL.alSourcefv(sources.get(0), AL.AL_POSITION, sourcePosition); - System.out.println("sourcex: " + sourcePosition.get(0)); + sourcePosition.x -= MOVEMENT; + AL.alSource3f(sources.get(0), AL.AL_POSITION, sourcePosition.x, sourcePosition.y, sourcePosition.z); + System.out.println("sourcex: " + sourcePosition.x); } } if(Keyboard.isKeyDown(Keyboard.KEY_RIGHT)) { if(Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) { - listenerPosition.put(0, listenerPosition.get(0) + MOVEMENT); - AL.alListenerfv(AL.AL_POSITION, listenerPosition); - System.out.println("listenerx: " + listenerPosition.get(0)); + listenerPosition.x += MOVEMENT; + AL.alListener3f(AL.AL_POSITION, listenerPosition.x, listenerPosition.y, listenerPosition.z); + System.out.println("listenerx: " + listenerPosition.x); } else { - sourcePosition.put(0, sourcePosition.get(0) + MOVEMENT); - AL.alSourcefv(sources.get(0), AL.AL_POSITION, sourcePosition); - System.out.println("sourcex: " + sourcePosition.get(0)); + sourcePosition.x += MOVEMENT; + AL.alSource3f(sources.get(0), AL.AL_POSITION, sourcePosition.x, sourcePosition.y, sourcePosition.z); + System.out.println("sourcex: " + sourcePosition.x); } } @@ -208,12 +210,14 @@ public class MovingSoundTest extends BasicTest { } //delete buffers and sources - AL.alDeleteSources(1, sources); + sources.position(0).limit(1); + AL.alDeleteSources(sources); if ((lastError = AL.alGetError()) != AL.AL_NO_ERROR) { exit(lastError); } - AL.alDeleteBuffers(1, buffers); + buffers.position(0).limit(1); + AL.alDeleteBuffers(buffers); if ((lastError = AL.alGetError()) != AL.AL_NO_ERROR) { exit(lastError); } diff --git a/src/java/org/lwjgl/test/openal/OpenALCreationTest.java b/src/java/org/lwjgl/test/openal/OpenALCreationTest.java index 81685360..3db9ff64 100644 --- a/src/java/org/lwjgl/test/openal/OpenALCreationTest.java +++ b/src/java/org/lwjgl/test/openal/OpenALCreationTest.java @@ -136,12 +136,14 @@ public class OpenALCreationTest { IntBuffer sources = createIntBuffer(1); // al generate buffers and sources - AL.alGenBuffers(1, buffers); + buffers.position(0).limit(1); + AL.alGenBuffers(buffers); if ((lastError = AL.alGetError()) != AL.AL_NO_ERROR) { exit(lastError); } - AL.alGenSources(1, sources); + sources.position(0).limit(1); + AL.alGenSources(sources); if ((lastError = AL.alGetError()) != AL.AL_NO_ERROR) { exit(lastError); } @@ -196,12 +198,14 @@ public class OpenALCreationTest { } //delete buffers and sources - AL.alDeleteSources(1, sources); + sources.position(0).limit(1); + AL.alDeleteSources(sources); if ((lastError = AL.alGetError()) != AL.AL_NO_ERROR) { exit(lastError); } - AL.alDeleteBuffers(1, buffers); + buffers.position(0).limit(1); + AL.alDeleteBuffers(buffers); if ((lastError = AL.alGetError()) != AL.AL_NO_ERROR) { exit(lastError); } diff --git a/src/java/org/lwjgl/test/openal/PlayTest.java b/src/java/org/lwjgl/test/openal/PlayTest.java index f2dc4cd7..4fd42db7 100644 --- a/src/java/org/lwjgl/test/openal/PlayTest.java +++ b/src/java/org/lwjgl/test/openal/PlayTest.java @@ -69,12 +69,14 @@ public class PlayTest extends BasicTest { IntBuffer sources = createIntBuffer(1); // al generate buffers and sources - AL.alGenBuffers(1, buffers); + buffers.position(0).limit(1); + AL.alGenBuffers(buffers); if((lastError = AL.alGetError()) != AL.AL_NO_ERROR) { exit(lastError); } - AL.alGenSources(1, sources); + sources.position(0).limit(1); + AL.alGenSources(sources); if((lastError = AL.alGetError()) != AL.AL_NO_ERROR) { exit(lastError); } @@ -123,12 +125,14 @@ public class PlayTest extends BasicTest { } //delete buffers and sources - AL.alDeleteSources(1, sources); + sources.position(0).limit(1); + AL.alDeleteSources(sources); if((lastError = AL.alGetError()) != AL.AL_NO_ERROR) { exit(lastError); } - AL.alDeleteBuffers(1, buffers); + buffers.position(0).limit(1); + AL.alDeleteBuffers(buffers); if((lastError = AL.alGetError()) != AL.AL_NO_ERROR) { exit(lastError); } diff --git a/src/java/org/lwjgl/test/openal/PlayTestMemory.java b/src/java/org/lwjgl/test/openal/PlayTestMemory.java index 18e93945..f20274a2 100644 --- a/src/java/org/lwjgl/test/openal/PlayTestMemory.java +++ b/src/java/org/lwjgl/test/openal/PlayTestMemory.java @@ -73,12 +73,14 @@ public class PlayTestMemory extends BasicTest { IntBuffer sources = createIntBuffer(1); // al generate buffers and sources - AL.alGenBuffers(1, buffers); + buffers.position(0).limit(1); + AL.alGenBuffers(buffers); if((lastError = AL.alGetError()) != AL.AL_NO_ERROR) { exit(lastError); } - AL.alGenSources(1, sources); + sources.position(0).limit(1); + AL.alGenSources(sources); if((lastError = AL.alGetError()) != AL.AL_NO_ERROR) { exit(lastError); } @@ -135,12 +137,14 @@ public class PlayTestMemory extends BasicTest { } //delete buffers and sources - AL.alDeleteSources(1, sources); + sources.position(0).limit(1); + AL.alDeleteSources(sources); if((lastError = AL.alGetError()) != AL.AL_NO_ERROR) { exit(lastError); } - AL.alDeleteBuffers(1, buffers); + buffers.position(0).limit(1); + AL.alDeleteBuffers(buffers); if((lastError = AL.alGetError()) != AL.AL_NO_ERROR) { exit(lastError); } diff --git a/src/java/org/lwjgl/test/openal/SourceLimitTest.java b/src/java/org/lwjgl/test/openal/SourceLimitTest.java index 378ba909..140059da 100644 --- a/src/java/org/lwjgl/test/openal/SourceLimitTest.java +++ b/src/java/org/lwjgl/test/openal/SourceLimitTest.java @@ -96,14 +96,16 @@ public class SourceLimitTest extends BasicTest { IntBuffer sources = createIntBuffer(sourcesToCreate); //Create sourcesToCreate sources in one fell swoop - AL.alGenSources(sourcesToCreate, sources); + sources.position(0).limit(sourcesToCreate); + AL.alGenSources(sources); if ((lastError = AL.alGetError()) != AL.AL_NO_ERROR) { System.out.println("failed to create " + sourcesToCreate + " sources (" + AL.alGetString(lastError) + ")"); return; } //delete sources - AL.alDeleteSources(sourcesToCreate, sources); + sources.position(0).limit(sourcesToCreate); + AL.alDeleteSources(sources); System.out.println("created " + sourcesToCreate + " sources successfully!"); } @@ -121,7 +123,8 @@ public class SourceLimitTest extends BasicTest { //create the sources for (int i = 0; i <= sourcesToCreate; i++) { sources[i] = createIntBuffer(1); - AL.alGenSources(1, sources[i]); + sources[i].position(0).limit(1); + AL.alGenSources(sources[i]); if ((lastError = AL.alGetError()) != AL.AL_NO_ERROR) { System.out.println("failed to create source: " + (i + 1)); break; @@ -132,7 +135,8 @@ public class SourceLimitTest extends BasicTest { //delete allocated sources for (int i = 0; i < sourcesCreated; i++) { //delete buffers and sources - AL.alDeleteSources(1, sources[i]); + sources[i].position(0).limit(1); + AL.alDeleteSources(sources[i]); if ((lastError = AL.alGetError()) != AL.AL_NO_ERROR) { System.out.println("failed to delete source: " + i + "(" + AL.alGetString(lastError) + ")"); break; diff --git a/src/java/org/lwjgl/test/openal/StressTest.java b/src/java/org/lwjgl/test/openal/StressTest.java index 2b4007d6..6fe8ccc2 100644 --- a/src/java/org/lwjgl/test/openal/StressTest.java +++ b/src/java/org/lwjgl/test/openal/StressTest.java @@ -79,7 +79,8 @@ public class StressTest extends BasicTest { private void createSources() { sources = createIntBuffer(4); - AL.alGenSources(4, sources); + sources.position(0).limit(4); + AL.alGenSources(sources); if (AL.alGetError() != AL.AL_NO_ERROR) { System.out.println("Unable to create 4 sources"); alExit(); @@ -88,10 +89,12 @@ public class StressTest extends BasicTest { private void createBuffers() { buffers = createIntBuffer(10); - AL.alGenBuffers(10, buffers); + buffers.position(0).limit(10); + AL.alGenBuffers(buffers); if (AL.alGetError() != AL.AL_NO_ERROR) { System.out.println("Unable to create 10 buffers"); - AL.alDeleteSources(4, sources); + sources.position(0).limit(4); + AL.alDeleteSources(sources); alExit(); } } @@ -109,8 +112,11 @@ public class StressTest extends BasicTest { if (AL.alGetError() != AL.AL_NO_ERROR) { System.out.println("Failed to load " + i + ".wav into buffer"); - AL.alDeleteSources(4, sources); - AL.alDeleteBuffers(10, buffers); + sources.position(0).limit(4); + AL.alDeleteSources(sources); + buffers.position(0).limit(10); + AL.alDeleteBuffers(buffers); + alExit(); } } @@ -191,8 +197,10 @@ public class StressTest extends BasicTest { } catch (Exception e) { } - AL.alDeleteSources(4, sources); - AL.alDeleteBuffers(10, buffers); + sources.position(0).limit(4); + AL.alDeleteSources(sources); + buffers.position(0).limit(10); + AL.alDeleteBuffers(buffers); } private int getRandomBuffer() {