diff options
author | kbr <[email protected]> | 2006-12-22 00:40:23 +0000 |
---|---|---|
committer | kbr <[email protected]> | 2006-12-22 00:40:23 +0000 |
commit | 0b450846c34ca9fe2ac3d462e6e6f1eb1744ae31 (patch) | |
tree | 1ef4365d562ebdf68f25edabce366354a3a01e65 | |
parent | fe96056b559fdcae63b36c1692bc114a49acf11a (diff) |
Improved error reporting and workaround for problem seen with NVidia's
OpenAL implementation with only this demo
git-svn-id: file:///home/mbien/NetBeansProjects/JOGAMP/joal-sync/svn-server-sync-demos/joal-demos/trunk@54 235fdd13-0e8c-4fed-b5ee-0a390d04b286
-rwxr-xr-x | src/java/demos/devmaster/lesson1/SingleStaticSource.java | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/src/java/demos/devmaster/lesson1/SingleStaticSource.java b/src/java/demos/devmaster/lesson1/SingleStaticSource.java index 32834cb..97be01a 100755 --- a/src/java/demos/devmaster/lesson1/SingleStaticSource.java +++ b/src/java/demos/devmaster/lesson1/SingleStaticSource.java @@ -199,8 +199,13 @@ public class SingleStaticSource { return false; } // Load the wav data. - if (loadALData() == AL.AL_FALSE) + try { + if (loadALData() == AL.AL_FALSE) + return false; + } catch (ALException e) { + e.printStackTrace(); return false; + } setListenerValues(); @@ -221,7 +226,7 @@ public class SingleStaticSource { // Load wav data into a buffer. al.alGenBuffers(1, buffer, 0); if (al.alGetError() != AL.AL_NO_ERROR) - return AL.AL_FALSE; + throw new ALException("Error generating OpenAL buffers"); ALut.alutLoadWAVFile( SingleStaticSource.class.getClassLoader().getResourceAsStream("demos/data/FancyPants.wav"), @@ -241,20 +246,25 @@ public class SingleStaticSource { al.alGenSources(1, source, 0); if (al.alGetError() != AL.AL_NO_ERROR) - return AL.AL_FALSE; + throw new ALException("Error generating OpenAL source"); al.alSourcei(source[0], AL.AL_BUFFER, buffer[0]); al.alSourcef(source[0], AL.AL_PITCH, 1.0f); al.alSourcef(source[0], AL.AL_GAIN, 1.0f); - al.alSourcefv(source[0], AL.AL_POSITION, sourcePos, 0); - al.alSourcefv(source[0], AL.AL_VELOCITY, sourceVel, 0); al.alSourcei(source[0], AL.AL_LOOPING, loop[0]); - // Do another error check and return. - if (al.alGetError() == AL.AL_NO_ERROR) - return AL.AL_TRUE; + // Do another error check + if (al.alGetError() != AL.AL_NO_ERROR) + throw new ALException("Error setting up OpenAL source"); + + // Note: for some reason the following two calls are producing an + // error on one machine with NVidia's OpenAL implementation. This + // appears to be harmless, so just continue past the error if one + // occurs. + al.alSourcefv(source[0], AL.AL_POSITION, sourcePos, 0); + al.alSourcefv(source[0], AL.AL_VELOCITY, sourceVel, 0); - return AL.AL_FALSE; + return AL.AL_TRUE; } private void setListenerValues() { |