diff options
author | Sven Gothel <[email protected]> | 2014-07-03 16:27:25 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-07-03 16:27:25 +0200 |
commit | 0430708fbcbdc5572affb45318eb782adffd13f1 (patch) | |
tree | 61ac401ea90e07ae0a7ac639da1e6a240f1b87cd | |
parent | 21cd5206625aaa8914e53bdfaab8e7ae4e497a08 (diff) |
Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74)
- Change non static accesses to static members using declaring type
- Change indirect accesses to static members to direct accesses (accesses through subtypes)
- Add final modifier to private fields
- Add final modifier to method parameters
- Add final modifier to local variables
- Remove unnecessary casts
- Remove unnecessary '$NON-NLS$' tags
- Remove trailing white spaces on all lines
32 files changed, 602 insertions, 590 deletions
diff --git a/src/java/com/jogamp/openal/ALException.java b/src/java/com/jogamp/openal/ALException.java index 7f0dcd3..228faac 100755 --- a/src/java/com/jogamp/openal/ALException.java +++ b/src/java/com/jogamp/openal/ALException.java @@ -4,17 +4,17 @@ * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * - * -Redistribution of source code must retain the above copyright notice, + * -Redistribution of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * - * -Redistribution in binary form must reproduce the above copyright notice, + * -Redistribution in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * - * Neither the name of Sun Microsystems, Inc. or the names of contributors may - * be used to endorse or promote products derived from this software without + * Neither the name of Sun Microsystems, Inc. or the names of contributors may + * be used to endorse or promote products derived from this software without * specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR @@ -44,19 +44,19 @@ public class ALException extends RuntimeException { /** Constructs an ALException object with the specified detail message. */ - public ALException(String message) { + public ALException(final String message) { super(message); } /** Constructs an ALException object with the specified detail message and root cause. */ - public ALException(String message, Throwable cause) { + public ALException(final String message, final Throwable cause) { super(message, cause); } /** Constructs an ALException object with the specified root cause. */ - public ALException(Throwable cause) { + public ALException(final Throwable cause) { super(cause); } } diff --git a/src/java/com/jogamp/openal/ALFactory.java b/src/java/com/jogamp/openal/ALFactory.java index cb1c0cd..ecfdb2b 100644 --- a/src/java/com/jogamp/openal/ALFactory.java +++ b/src/java/com/jogamp/openal/ALFactory.java @@ -39,6 +39,7 @@ import jogamp.openal.ALImpl; import jogamp.openal.Debug; import com.jogamp.common.os.Platform; +import com.jogamp.common.util.PropertyAccess; /** * This class provides factory methods for generating AL and ALC objects. @@ -65,7 +66,7 @@ public class ALFactory { static { Platform.initSingleton(); - final String choice = Debug.getProperty("joal.openal.lib", true); + final String choice = PropertyAccess.getProperty("joal.openal.lib", true); boolean useSystem = false; // default on all systems if( null != choice ) { if( choice.equals("system") ) { @@ -95,9 +96,9 @@ public class ALFactory { System.err.println("AL initialized"); } } - } catch (UnsatisfiedLinkError e) { + } catch (final UnsatisfiedLinkError e) { throw new ALException(e); - } catch (ExceptionInInitializerError er) { + } catch (final ExceptionInInitializerError er) { throw new ALException(er); } } diff --git a/src/java/com/jogamp/openal/JoalVersion.java b/src/java/com/jogamp/openal/JoalVersion.java index 41c333a..0d756cc 100644 --- a/src/java/com/jogamp/openal/JoalVersion.java +++ b/src/java/com/jogamp/openal/JoalVersion.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.openal; import com.jogamp.common.GlueGenVersion; @@ -39,7 +39,7 @@ import java.util.jar.Manifest; public class JoalVersion extends JogampVersion { protected static volatile JoalVersion jogampCommonVersionInfo; - protected JoalVersion(String packageName, Manifest mf) { + protected JoalVersion(final String packageName, final Manifest mf) { super(packageName, mf); } @@ -66,7 +66,7 @@ public class JoalVersion extends JogampVersion { return toString(null).toString(); } - public StringBuilder getBriefOSALBuildInfo(StringBuilder sb) { + public StringBuilder getBriefOSALBuildInfo(StringBuilder sb) { if(null==sb) { sb = new StringBuilder(); } @@ -76,8 +76,8 @@ public class JoalVersion extends JogampVersion { sb.append(Platform.getNewline()); return sb; } - - public static void main(String args[]) { + + public static void main(final String args[]) { System.err.println(VersionUtil.getPlatformInfo()); System.err.println(GlueGenVersion.getInstance()); // System.err.println(NativeWindowVersion.getInstance()); diff --git a/src/java/com/jogamp/openal/UnsupportedAudioFileException.java b/src/java/com/jogamp/openal/UnsupportedAudioFileException.java index a371191..c400479 100644 --- a/src/java/com/jogamp/openal/UnsupportedAudioFileException.java +++ b/src/java/com/jogamp/openal/UnsupportedAudioFileException.java @@ -2,20 +2,20 @@ package com.jogamp.openal; public class UnsupportedAudioFileException extends Exception { - public UnsupportedAudioFileException (String message) { + public UnsupportedAudioFileException (final String message) { super(message); } public UnsupportedAudioFileException () { super(); } - - public UnsupportedAudioFileException (String message, Throwable cause) { + + public UnsupportedAudioFileException (final String message, final Throwable cause) { super(message, cause); } - - public UnsupportedAudioFileException (Throwable cause) { + + public UnsupportedAudioFileException (final Throwable cause) { super(cause); } - + } diff --git a/src/java/com/jogamp/openal/eax/EAX.java b/src/java/com/jogamp/openal/eax/EAX.java index 45bdfe3..b64e04c 100644 --- a/src/java/com/jogamp/openal/eax/EAX.java +++ b/src/java/com/jogamp/openal/eax/EAX.java @@ -39,10 +39,10 @@ import java.nio.Buffer; * */ public class EAX implements EAXConstants { - + public static final int SOURCE = 0; public static final int LISTENER = 1; - + private final int sourceGUID; private final int listenerGUID; @@ -50,7 +50,7 @@ public class EAX implements EAXConstants { * @param sourceGUID * @param listenerGUID */ - EAX(int sourceGUID, int listenerGUID) { + EAX(final int sourceGUID, final int listenerGUID) { this.sourceGUID = sourceGUID; this.listenerGUID = listenerGUID; } @@ -60,9 +60,9 @@ public class EAX implements EAXConstants { * <br> * <b>Interface to C Language function:</b> * <pre>ALenum EAXSet(const struct _GUID *propertySetID, ALuint property, ALuint source, ALvoid *value, ALuint size)</pre> - * + * * @param objectFlag a flag indicating a LISTENER or a SOURCE - * @param pname the property being set + * @param pname the property being set * @param source the ID of the source, or 0 for Listener properties * @param value a direct Buffer to hold the value retrieved * @param size the size of the Buffer @@ -74,9 +74,9 @@ public class EAX implements EAXConstants { * <br> * <b>Interface to C Language function:</b> * <pre>ALenum EAXGet(const struct _GUID *propertySetID, ALuint property, ALuint source, ALvoid *value, ALuint size)</pre> - * + * * @param objectFlag a flag indicating a LISTENER or a SOURCE - * @param pname the property being queried + * @param pname the property being queried * @param source the ID of the source, or 0 for Listener properties * @param value a direct Buffer to hold the value retrieved * @param size the size of the Buffer @@ -84,40 +84,40 @@ public class EAX implements EAXConstants { public native void EAXGet(int objectFlag, int pname, int source, Buffer value, int size); /** - * This method sets a source property. + * This method sets a source property. * @param sourceID the ID of the source whose property is being set. * @param pname the name of the property being set * @param value a direct Buffer containing the value to be set */ - public void setSourceProperty(int sourceID, int pname, Buffer value) { + public void setSourceProperty(final int sourceID, final int pname, final Buffer value) { EAXSet(sourceGUID, pname, sourceID, value, value.capacity()); } /** - * This method retrieves a source property. + * This method retrieves a source property. * @param sourceID the ID of the source whose property is being retrieved. * @param pname the name of the property being retrieved * @param value a direct Buffer to hold the value to be retrieved */ - public void getSourceProperty(int pname, int sourceID, Buffer value) { + public void getSourceProperty(final int pname, final int sourceID, final Buffer value) { EAXGet(sourceGUID, pname, sourceID, value, value.capacity()); } /** - * This method sets a Listener property. + * This method sets a Listener property. * @param pname the name of the property being set * @param value a direct Buffer containing the value to be set */ - public void setListenerProperty(int pname, Buffer value) { + public void setListenerProperty(final int pname, final Buffer value) { EAXSet(listenerGUID, pname, 0, value, value.capacity()); } /** - * This method retrieves a Listener property. + * This method retrieves a Listener property. * @param pname the name of the property being retrieved * @param value a direct Buffer to hold the value to be retrieved */ - public void getListenerProperty(int pname, Buffer value) { + public void getListenerProperty(final int pname, final Buffer value) { EAXGet(listenerGUID, pname, 0, value, value.capacity()); } } diff --git a/src/java/com/jogamp/openal/eax/EAXConstants.java b/src/java/com/jogamp/openal/eax/EAXConstants.java index 106932d..fae7bd2 100644 --- a/src/java/com/jogamp/openal/eax/EAXConstants.java +++ b/src/java/com/jogamp/openal/eax/EAXConstants.java @@ -4,17 +4,17 @@ * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * -* -Redistribution of source code must retain the above copyright notice, +* -Redistribution of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * -* -Redistribution in binary form must reproduce the above copyright notice, +* -Redistribution in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * -* Neither the name of Sun Microsystems, Inc. or the names of contributors may -* be used to endorse or promote products derived from this software without +* Neither the name of Sun Microsystems, Inc. or the names of contributors may +* be used to endorse or promote products derived from this software without * specific prior written permission. -* +* * This software is provided "AS IS," without a warranty of any kind. * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR @@ -56,15 +56,15 @@ public interface EAXConstants { public final static int DSPROPERTY_EAXLISTENER_ENVIRONMENTDIFFUSION = 13; public final static int DSPROPERTY_EAXLISTENER_AIRABSORPTIONHF = 14; public final static int DSPROPERTY_EAXLISTENER_FLAGS = 15; - -// OR these flags with property id // + +// OR these flags with property id // /** changes take effect immediately */ public static final int DSPROPERTY_EAXLISTENER_IMMEDIATE = 0x00000000; /** changes take effect later */ public static final int DSPROPERTY_EAXLISTENER_DEFERRED = 0x80000000; - public static final int DSPROPERTY_EAXLISTENER_COMMITDEFERREDSETTINGS = + public static final int DSPROPERTY_EAXLISTENER_COMMITDEFERREDSETTINGS = DSPROPERTY_EAXLISTENER_NONE | DSPROPERTY_EAXLISTENER_IMMEDIATE; @@ -125,15 +125,15 @@ public interface EAXConstants { // These flags determine what properties are affected by environment size. /** reverberation decay time */ - public final static int EAXLISTENERFLAGS_DECAYTIMESCALE = 0x00000001; + public final static int EAXLISTENERFLAGS_DECAYTIMESCALE = 0x00000001; /** reflection level */ public final static int EAXLISTENERFLAGS_REFLECTIONSSCALE = 0x00000002; /** initial reflection delay time */ - public final static int EAXLISTENERFLAGS_REFLECTIONSDELAYSCALE = 0x00000004; + public final static int EAXLISTENERFLAGS_REFLECTIONSDELAYSCALE = 0x00000004; /** reflections level */ - public final static int EAXLISTENERFLAGS_REVERBSCALE = 0x00000008; + public final static int EAXLISTENERFLAGS_REVERBSCALE = 0x00000008; /** late reverberation delay time */ - public final static int EAXLISTENERFLAGS_REVERBDELAYSCALE = 0x00000010; + public final static int EAXLISTENERFLAGS_REVERBDELAYSCALE = 0x00000010; /** This flag limits high-frequency decay time according to air absorption.*/ public final static int EAXLISTENERFLAGS_DECAYHFLIMIT = 0x00000020; @@ -194,9 +194,9 @@ public interface EAXConstants { public final static float EAXLISTENER_MAXAIRABSORPTIONHF = 0.0f; public final static float EAXLISTENER_DEFAULTAIRABSORPTIONHF = -5.0f; - public final static int EAXLISTENER_DEFAULTFLAGS = - EAXLISTENERFLAGS_DECAYTIMESCALE | - EAXLISTENERFLAGS_REFLECTIONSSCALE | + public final static int EAXLISTENER_DEFAULTFLAGS = + EAXLISTENERFLAGS_DECAYTIMESCALE | + EAXLISTENERFLAGS_REFLECTIONSSCALE | EAXLISTENERFLAGS_REFLECTIONSDELAYSCALE | EAXLISTENERFLAGS_REVERBSCALE | EAXLISTENERFLAGS_REVERBDELAYSCALE | @@ -221,9 +221,9 @@ public interface EAXConstants { // OR these flags with property id /** changes take effect immediately */ public final static int DSPROPERTY_EAXBUFFER_IMMEDIATE = 0x00000000; - /** changes take effect later */ + /** changes take effect later */ public final static int DSPROPERTY_EAXBUFFER_DEFERRED = 0x80000000; - public final static int DSPROPERTY_EAXBUFFER_COMMITDEFERREDSETTINGS = + public final static int DSPROPERTY_EAXBUFFER_COMMITDEFERREDSETTINGS = DSPROPERTY_EAXBUFFER_NONE | DSPROPERTY_EAXBUFFER_IMMEDIATE; @@ -239,7 +239,7 @@ public interface EAXConstants { // myFlags = 0x00000003; // /** affects DSPROPERTY_EAXBUFFER_DIRECTHF */ - public final static int EAXBUFFERFLAGS_DIRECTHFAUTO = 0x00000001; + public final static int EAXBUFFERFLAGS_DIRECTHFAUTO = 0x00000001; /** affects DSPROPERTY_EAXBUFFER_ROOM */ public final static int EAXBUFFERFLAGS_ROOMAUTO = 0x00000002; /** affects DSPROPERTY_EAXBUFFER_ROOMHF */ @@ -297,7 +297,7 @@ public interface EAXConstants { public final static float EAXBUFFER_MAXAIRABSORPTIONFACTOR = 10.0f; public final static float EAXBUFFER_DEFAULTAIRABSORPTIONFACTOR = 1.0f; - public final static int EAXBUFFER_DEFAULTFLAGS = + public final static int EAXBUFFER_DEFAULTFLAGS = EAXBUFFERFLAGS_DIRECTHFAUTO | EAXBUFFERFLAGS_ROOMAUTO | EAXBUFFERFLAGS_ROOMHFAUTO; diff --git a/src/java/com/jogamp/openal/eax/EAXFactory.java b/src/java/com/jogamp/openal/eax/EAXFactory.java index 01d336c..fb81739 100644 --- a/src/java/com/jogamp/openal/eax/EAXFactory.java +++ b/src/java/com/jogamp/openal/eax/EAXFactory.java @@ -46,7 +46,7 @@ public final class EAXFactory { ALFactory.getAL(); DEBUG = ALFactory.DEBUG; } - + private static EAX eax = null; private static boolean eaxTried = false; @@ -62,7 +62,7 @@ public final class EAXFactory { System.err.println("EAX initialized"); } } - } catch (UnsatisfiedLinkError e) { + } catch (final UnsatisfiedLinkError e) { if(DEBUG) { e.printStackTrace(); } diff --git a/src/java/com/jogamp/openal/sound3d/AudioSystem3D.java b/src/java/com/jogamp/openal/sound3d/AudioSystem3D.java index 4d7b2b1..7c6d725 100644 --- a/src/java/com/jogamp/openal/sound3d/AudioSystem3D.java +++ b/src/java/com/jogamp/openal/sound3d/AudioSystem3D.java @@ -4,17 +4,17 @@ * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * - * -Redistribution of source code must retain the above copyright notice, + * -Redistribution of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * - * -Redistribution in binary form must reproduce the above copyright notice, + * -Redistribution in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * - * Neither the name of Sun Microsystems, Inc. or the names of contributors may - * be used to endorse or promote products derived from this software without + * Neither the name of Sun Microsystems, Inc. or the names of contributors may + * be used to endorse or promote products derived from this software without * specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR @@ -74,9 +74,9 @@ public class AudioSystem3D { * * @return The new Sound3D context. */ - public static Context createContext(Device device) { + public static Context createContext(final Device device) { Context result = null; - ALCcontext realContext = alc.alcCreateContext(device.realDevice, null); + final ALCcontext realContext = alc.alcCreateContext(device.realDevice, null); result = new Context(alc, realContext, device); return result; } @@ -86,7 +86,7 @@ public class AudioSystem3D { * * @param context the context to make current. */ - public static void makeContextCurrent(Context context) { + public static void makeContextCurrent(final Context context) { ALCcontext realContext = null; if (context != null) { @@ -97,17 +97,17 @@ public class AudioSystem3D { } /** - * Opens the specifified audio device. + * Opens the specifified audio device. * - * @param deviceName The specified device name, On windows this will be + * @param deviceName The specified device name, On windows this will be * DirectSound3D. We will be automating device discovery in upcoming versions * of this class. * * @return The device described by the specifed name. */ - public static Device openDevice(String deviceName) { + public static Device openDevice(final String deviceName) { Device result = null; - ALCdevice realDevice = alc.alcOpenDevice(deviceName); + final ALCdevice realDevice = alc.alcOpenDevice(deviceName); result = new Device(alc, realDevice); return result; @@ -120,9 +120,9 @@ public class AudioSystem3D { * * @return an array of (initially enpty) Sound3D buffers. */ - public static Buffer[] generateBuffers(int numBuffers) { - Buffer[] result = new Buffer[numBuffers]; - int[] arr = new int[numBuffers]; + public static Buffer[] generateBuffers(final int numBuffers) { + final Buffer[] result = new Buffer[numBuffers]; + final int[] arr = new int[numBuffers]; al.alGenBuffers(numBuffers, arr, 0); for (int i = 0; i < numBuffers; i++) { @@ -141,17 +141,17 @@ public class AudioSystem3D { * specified file. * * @throws IOException If the file cannot be found or some other IO error - * occurs. + * occurs. * @throws UnsupportedAudioFileException If the format of the audio data is * not supported */ - public static Buffer loadBuffer(String filename) + public static Buffer loadBuffer(final String filename) throws IOException, UnsupportedAudioFileException { Buffer result; - Buffer[] tmp = generateBuffers(1); + final Buffer[] tmp = generateBuffers(1); result = tmp[0]; - WAVData wd = WAVLoader.loadFromFile(filename); + final WAVData wd = WAVLoader.loadFromFile(filename); result.configure(wd.data, wd.format, wd.freq); return result; @@ -166,23 +166,23 @@ public class AudioSystem3D { * passed stream. * * @throws IOException If the stream cannot be read or some other IO error - * occurs. + * occurs. * @throws UnsupportedAudioFileException If the format of the audio data is * not supported */ public static Buffer loadBuffer(InputStream stream) throws IOException, UnsupportedAudioFileException { Buffer result; - Buffer[] tmp = generateBuffers(1); + final Buffer[] tmp = generateBuffers(1); result = tmp[0]; - + if (!(stream instanceof BufferedInputStream)) { stream = new BufferedInputStream(stream); } - WAVData wd = WAVLoader.loadFromStream(stream); - + final WAVData wd = WAVLoader.loadFromStream(stream); + result.configure(wd.data, wd.format, wd.freq); - + return result; } @@ -196,13 +196,13 @@ public class AudioSystem3D { * specified file. * * @throws IOException If the file cannot be found or some other IO error - * occurs. + * occurs. * @throws UnsupportedAudioFileException If the format of the audio data is * not supported */ - public static Source loadSource(String filename) + public static Source loadSource(final String filename) throws IOException, UnsupportedAudioFileException { - Buffer buffer = loadBuffer(filename); + final Buffer buffer = loadBuffer(filename); return generateSource(buffer); } @@ -217,13 +217,13 @@ public class AudioSystem3D { * passed stream. * * @throws IOException If the file cannot be found or some other IO error - * occurs. + * occurs. * @throws UnsupportedAudioFileException If the format of the audio data is * not supported */ - public static Source loadSource(InputStream stream) + public static Source loadSource(final InputStream stream) throws IOException, UnsupportedAudioFileException { - Buffer buffer = loadBuffer(stream); + final Buffer buffer = loadBuffer(stream); return generateSource(buffer); } @@ -235,9 +235,9 @@ public class AudioSystem3D { * * @return an array of uninitialized sources. */ - public static Source[] generateSources(int numSources) { - Source[] result = new Source[numSources]; - int[] arr = new int[numSources]; + public static Source[] generateSources(final int numSources) { + final Source[] result = new Source[numSources]; + final int[] arr = new int[numSources]; al.alGenSources(numSources, arr, 0); for (int i = 0; i < numSources; i++) { @@ -254,9 +254,9 @@ public class AudioSystem3D { * * @return the newly generated Source. */ - public static Source generateSource(Buffer buff) { + public static Source generateSource(final Buffer buff) { Source result = null; - Source[] tmp = generateSources(1); + final Source[] tmp = generateSources(1); result = tmp[0]; result.setBuffer(buff); diff --git a/src/java/com/jogamp/openal/sound3d/Buffer.java b/src/java/com/jogamp/openal/sound3d/Buffer.java index 54d120e..8fad7d0 100644 --- a/src/java/com/jogamp/openal/sound3d/Buffer.java +++ b/src/java/com/jogamp/openal/sound3d/Buffer.java @@ -4,17 +4,17 @@ * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * -* -Redistribution of source code must retain the above copyright notice, +* -Redistribution of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * -* -Redistribution in binary form must reproduce the above copyright notice, +* -Redistribution in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * -* Neither the name of Sun Microsystems, Inc. or the names of contributors may -* be used to endorse or promote products derived from this software without +* Neither the name of Sun Microsystems, Inc. or the names of contributors may +* be used to endorse or promote products derived from this software without * specific prior written permission. -* +* * This software is provided "AS IS," without a warranty of any kind. * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR @@ -34,6 +34,7 @@ package com.jogamp.openal.sound3d; import com.jogamp.openal.AL; +import com.jogamp.openal.ALConstants; import java.nio.ByteBuffer; @@ -54,10 +55,10 @@ public class Buffer { public final static int FORMAT_STEREO16 = AL.AL_FORMAT_STEREO16; final int bufferID; private ByteBuffer data; - private boolean isConfigured = false; + private final boolean isConfigured = false; private final AL al; - Buffer(AL al, int bufferID) { + Buffer(final AL al, final int bufferID) { this.bufferID = bufferID; this.al = al; } @@ -70,7 +71,7 @@ public class Buffer { * FORMAT_STEREO8</code> and <code>FORMAT_STEREO16</code> * @param freq the frequency of the data */ - public void configure(ByteBuffer data, int format, int freq) { + public void configure(final ByteBuffer data, final int format, final int freq) { if (!isConfigured) { this.data = data; al.alBufferData(bufferID, format, data, data.capacity(), freq); @@ -91,8 +92,8 @@ public class Buffer { * @return the bit-depth of the data */ public int getBitDepth() { - int[] i = new int[1]; - al.alGetBufferi(bufferID, AL.AL_BITS, i, 0); + final int[] i = new int[1]; + al.alGetBufferi(bufferID, ALConstants.AL_BITS, i, 0); return i[0]; } @@ -103,8 +104,8 @@ public class Buffer { * @return the number of audio channels. */ public int getNumChannels() { - int[] i = new int[1]; - al.alGetBufferi(bufferID, AL.AL_CHANNELS, i, 0); + final int[] i = new int[1]; + al.alGetBufferi(bufferID, ALConstants.AL_CHANNELS, i, 0); return i[0]; } @@ -124,8 +125,8 @@ public class Buffer { * @return the frequency of the data */ public int getFrequency() { - int[] i = new int[1]; - al.alGetBufferi(bufferID, AL.AL_FREQUENCY, i, 0); + final int[] i = new int[1]; + al.alGetBufferi(bufferID, ALConstants.AL_FREQUENCY, i, 0); return i[0]; } @@ -136,8 +137,8 @@ public class Buffer { * @return the size of the data. */ public int getSize() { - int[] i = new int[1]; - al.alGetBufferi(bufferID, AL.AL_SIZE, i, 0); + final int[] i = new int[1]; + al.alGetBufferi(bufferID, ALConstants.AL_SIZE, i, 0); return i[0]; } diff --git a/src/java/com/jogamp/openal/sound3d/Context.java b/src/java/com/jogamp/openal/sound3d/Context.java index 5562153..7657d98 100644 --- a/src/java/com/jogamp/openal/sound3d/Context.java +++ b/src/java/com/jogamp/openal/sound3d/Context.java @@ -4,17 +4,17 @@ * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * -* -Redistribution of source code must retain the above copyright notice, +* -Redistribution of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * -* -Redistribution in binary form must reproduce the above copyright notice, +* -Redistribution in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * -* Neither the name of Sun Microsystems, Inc. or the names of contributors may -* be used to endorse or promote products derived from this software without +* Neither the name of Sun Microsystems, Inc. or the names of contributors may +* be used to endorse or promote products derived from this software without * specific prior written permission. -* +* * This software is provided "AS IS," without a warranty of any kind. * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR @@ -46,7 +46,7 @@ public class Context { final ALCcontext realContext; final Device device; - Context(ALC alc, ALCcontext realContext, Device device) { + Context(final ALC alc, final ALCcontext realContext, final Device device) { this.alc = alc; this.realContext = realContext; this.device = device; @@ -69,7 +69,7 @@ public class Context { /** * Gets the device associated with this context. * - * @return the device associated with this context. + * @return the device associated with this context. */ public Device getDevice() { return device; diff --git a/src/java/com/jogamp/openal/sound3d/Device.java b/src/java/com/jogamp/openal/sound3d/Device.java index 086d3ad..3000faf 100644 --- a/src/java/com/jogamp/openal/sound3d/Device.java +++ b/src/java/com/jogamp/openal/sound3d/Device.java @@ -4,17 +4,17 @@ * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * -* -Redistribution of source code must retain the above copyright notice, +* -Redistribution of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * -* -Redistribution in binary form must reproduce the above copyright notice, +* -Redistribution in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * -* Neither the name of Sun Microsystems, Inc. or the names of contributors may -* be used to endorse or promote products derived from this software without +* Neither the name of Sun Microsystems, Inc. or the names of contributors may +* be used to endorse or promote products derived from this software without * specific prior written permission. -* +* * This software is provided "AS IS," without a warranty of any kind. * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR @@ -45,7 +45,7 @@ public class Device { private final ALC alc; final ALCdevice realDevice; - Device(ALC alc, ALCdevice realDevice) { + Device(final ALC alc, final ALCdevice realDevice) { this.alc = alc; this.realDevice = realDevice; } diff --git a/src/java/com/jogamp/openal/sound3d/Listener.java b/src/java/com/jogamp/openal/sound3d/Listener.java index fe8b869..27b2745 100644 --- a/src/java/com/jogamp/openal/sound3d/Listener.java +++ b/src/java/com/jogamp/openal/sound3d/Listener.java @@ -4,17 +4,17 @@ * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * -* -Redistribution of source code must retain the above copyright notice, +* -Redistribution of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * -* -Redistribution in binary form must reproduce the above copyright notice, +* -Redistribution in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * -* Neither the name of Sun Microsystems, Inc. or the names of contributors may -* be used to endorse or promote products derived from this software without +* Neither the name of Sun Microsystems, Inc. or the names of contributors may +* be used to endorse or promote products derived from this software without * specific prior written permission. -* +* * This software is provided "AS IS," without a warranty of any kind. * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR @@ -34,10 +34,11 @@ package com.jogamp.openal.sound3d; import com.jogamp.openal.AL; +import com.jogamp.openal.ALConstants; /** - * This class represents the human listener in the Sound3D environment. It + * This class represents the human listener in the Sound3D environment. It * provides methods for controlling the position, orientation as well as other * properties associated with the listener. * @@ -46,7 +47,7 @@ import com.jogamp.openal.AL; public class Listener { private final AL al; - Listener(AL al) { + Listener(final AL al) { this.al = al; } @@ -56,8 +57,8 @@ public class Listener { * * @param gain the gain, or volume */ - public void setGain(float gain) { - al.alListenerf(AL.AL_GAIN, gain); + public void setGain(final float gain) { + al.alListenerf(ALConstants.AL_GAIN, gain); } /** @@ -67,8 +68,8 @@ public class Listener { * @return the gain value. */ public float getGain() { - float[] f = new float[1]; - al.alGetListenerf(AL.AL_GAIN, f, 0); + final float[] f = new float[1]; + al.alGetListenerf(ALConstants.AL_GAIN, f, 0); return f[0]; } @@ -84,32 +85,32 @@ public class Listener { * @param z The position of the listener along the Z-axis in the Sound3D * environment */ - public void setPosition(float x, float y, float z) { - al.alListener3f(AL.AL_POSITION, x, y, z); + public void setPosition(final float x, final float y, final float z) { + al.alListener3f(ALConstants.AL_POSITION, x, y, z); } /** * Sets the position in (x-y-z coordinates) of the Listener in the Sound3D * environment. * - * @param position a Vec3f object containing the x,y and z coordinates of + * @param position a Vec3f object containing the x,y and z coordinates of * Listener. */ - public void setPosition(Vec3f position) { - al.alListener3f(AL.AL_POSITION, position.v1, position.v2, position.v3); + public void setPosition(final Vec3f position) { + al.alListener3f(ALConstants.AL_POSITION, position.v1, position.v2, position.v3); } /** * Gets the position in (x-y-z coordinates) of the Listener in the Sound3D * environment. * - * @return a Vec3f object containing the x,y and z coordinates of + * @return a Vec3f object containing the x,y and z coordinates of * Listener. */ public Vec3f getPosition() { Vec3f result = null; - float[] tmp = new float[3]; - al.alGetListenerfv(AL.AL_POSITION, tmp, 0); + final float[] tmp = new float[3]; + al.alGetListenerfv(ALConstants.AL_POSITION, tmp, 0); result = new Vec3f(tmp[0], tmp[1], tmp[2]); return result; @@ -122,8 +123,8 @@ public class Listener { * @param velocity a Vec3f object containing the velicity in * x,y and z coordinates of Listener. */ - public void setVelocity(Vec3f velocity) { - al.alListener3f(AL.AL_VELOCITY, velocity.v1, velocity.v2, velocity.v3); + public void setVelocity(final Vec3f velocity) { + al.alListener3f(ALConstants.AL_VELOCITY, velocity.v1, velocity.v2, velocity.v3); } /** @@ -135,28 +136,28 @@ public class Listener { */ public Vec3f getVelocity() { Vec3f result = null; - float[] tmp = new float[3]; - al.alGetListenerfv(AL.AL_VELOCITY, tmp, 0); + final float[] tmp = new float[3]; + al.alGetListenerfv(ALConstants.AL_VELOCITY, tmp, 0); result = new Vec3f(tmp[0], tmp[1], tmp[2]); return result; } /** - * Sets the orientation of the Listener in the Sound3D environment. - * Orientation is expressed as "up" and "at" vectors. + * Sets the orientation of the Listener in the Sound3D environment. + * Orientation is expressed as "up" and "at" vectors. * * @param orientation The first 3 elements of the array should contain * the x,y,z up-vector, the second 3 elements should contain the x,z,z * look-at vector. */ - public void setOrientation(float[] orientation) { - al.alListenerfv(AL.AL_ORIENTATION, orientation, 0); + public void setOrientation(final float[] orientation) { + al.alListenerfv(ALConstants.AL_ORIENTATION, orientation, 0); } /** - * Gets the orientation of the Listener in the Sound3D environment. - * Orientation is expressed as "up" and "at" vectors. + * Gets the orientation of the Listener in the Sound3D environment. + * Orientation is expressed as "up" and "at" vectors. * * @return an array containing the orientation of the listener. * The first 3 elements of the array contain @@ -164,8 +165,8 @@ public class Listener { * look-at vector. */ public float[] getOrientation() { - float[] tmp = new float[6]; - al.alGetListenerfv(AL.AL_ORIENTATION, tmp, 0); + final float[] tmp = new float[6]; + al.alGetListenerfv(ALConstants.AL_ORIENTATION, tmp, 0); return tmp; } } diff --git a/src/java/com/jogamp/openal/sound3d/Source.java b/src/java/com/jogamp/openal/sound3d/Source.java index 873ad12..5926d9b 100644 --- a/src/java/com/jogamp/openal/sound3d/Source.java +++ b/src/java/com/jogamp/openal/sound3d/Source.java @@ -4,17 +4,17 @@ * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * -* -Redistribution of source code must retain the above copyright notice, +* -Redistribution of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * -* -Redistribution in binary form must reproduce the above copyright notice, +* -Redistribution in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * -* Neither the name of Sun Microsystems, Inc. or the names of contributors may -* be used to endorse or promote products derived from this software without +* Neither the name of Sun Microsystems, Inc. or the names of contributors may +* be used to endorse or promote products derived from this software without * specific prior written permission. -* +* * This software is provided "AS IS," without a warranty of any kind. * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR @@ -34,6 +34,7 @@ package com.jogamp.openal.sound3d; import com.jogamp.openal.AL; +import com.jogamp.openal.ALConstants; /** * This class is used to represent sound-producing objects in the Sound3D @@ -48,7 +49,7 @@ public final class Source { private final int sourceID; private Buffer buffer; - Source(AL al, int sourceID) { + Source(final AL al, final int sourceID) { this.al = al; this.sourceID = sourceID; } @@ -94,9 +95,9 @@ public final class Source { * @return {@code true} if this source is playing. */ public boolean isPlaying() { - int[] result = new int[1]; - al.alGetSourcei(sourceID, AL.AL_SOURCE_STATE, result, 0); - return result[0] == AL.AL_PLAYING; + final int[] result = new int[1]; + al.alGetSourcei(sourceID, ALConstants.AL_SOURCE_STATE, result, 0); + return result[0] == ALConstants.AL_PLAYING; } /** @@ -105,8 +106,8 @@ public final class Source { * * @param pitch the pitch value of this source. */ - public void setPitch(float pitch) { - al.alSourcef(sourceID, AL.AL_PITCH, pitch); + public void setPitch(final float pitch) { + al.alSourcef(sourceID, ALConstants.AL_PITCH, pitch); } /** @@ -116,8 +117,8 @@ public final class Source { * @return the pitch value of this source. */ public float getPitch() { - float[] result = new float[1]; - al.alGetSourcef(sourceID, AL.AL_PITCH, result, 0); + final float[] result = new float[1]; + al.alGetSourcef(sourceID, ALConstants.AL_PITCH, result, 0); return result[0]; } @@ -128,8 +129,8 @@ public final class Source { * * @param gain the gain of the audio on this source */ - public void setGain(float gain) { - al.alSourcef(sourceID, AL.AL_GAIN, gain); + public void setGain(final float gain) { + al.alSourcef(sourceID, ALConstants.AL_GAIN, gain); } /** @@ -139,8 +140,8 @@ public final class Source { * @return the gain of the audio on this source */ public float getGain() { - float[] result = new float[1]; - al.alGetSourcef(sourceID, AL.AL_GAIN, result, 0); + final float[] result = new float[1]; + al.alGetSourcef(sourceID, ALConstants.AL_GAIN, result, 0); return result[0]; } @@ -151,8 +152,8 @@ public final class Source { * * @param maxDistance the max ditance for source attentuation. */ - public void setMaxDistance(float maxDistance) { - al.alSourcef(sourceID, AL.AL_MAX_DISTANCE, maxDistance); + public void setMaxDistance(final float maxDistance) { + al.alSourcef(sourceID, ALConstants.AL_MAX_DISTANCE, maxDistance); } /** @@ -162,8 +163,8 @@ public final class Source { * @return the max ditance for source attentuation. */ public float getMaxDistance() { - float[] result = new float[1]; - al.alGetSourcef(sourceID, AL.AL_MAX_DISTANCE, result, 0); + final float[] result = new float[1]; + al.alGetSourcef(sourceID, ALConstants.AL_MAX_DISTANCE, result, 0); return result[0]; } @@ -173,8 +174,8 @@ public final class Source { * * @param rolloffFactor the rolloff rate of the source. */ - public void setRolloffFactor(float rolloffFactor) { - al.alSourcef(sourceID, AL.AL_ROLLOFF_FACTOR, rolloffFactor); + public void setRolloffFactor(final float rolloffFactor) { + al.alSourcef(sourceID, ALConstants.AL_ROLLOFF_FACTOR, rolloffFactor); } /** @@ -183,8 +184,8 @@ public final class Source { * @return the rolloff rate of the source. */ public float getRolloffFactor() { - float[] result = new float[1]; - al.alGetSourcef(sourceID, AL.AL_ROLLOFF_FACTOR, result, 0); + final float[] result = new float[1]; + al.alGetSourcef(sourceID, ALConstants.AL_ROLLOFF_FACTOR, result, 0); return result[0]; } @@ -195,8 +196,8 @@ public final class Source { * * @param referenceDistance the reference distance for the source. */ - public void setReferenceDistance(float referenceDistance) { - al.alSourcef(sourceID, AL.AL_REFERENCE_DISTANCE, referenceDistance); + public void setReferenceDistance(final float referenceDistance) { + al.alSourcef(sourceID, ALConstants.AL_REFERENCE_DISTANCE, referenceDistance); } /** @@ -206,8 +207,8 @@ public final class Source { * @return the reference distance for the source. */ public float getReferenceDistance() { - float[] result = new float[1]; - al.alGetSourcef(sourceID, AL.AL_REFERENCE_DISTANCE, result, 0); + final float[] result = new float[1]; + al.alGetSourcef(sourceID, ALConstants.AL_REFERENCE_DISTANCE, result, 0); return result[0]; } @@ -217,8 +218,8 @@ public final class Source { * * @param minGain the minimum gain for this source. */ - public void setMinGain(float minGain) { - al.alSourcef(sourceID, AL.AL_MIN_GAIN, minGain); + public void setMinGain(final float minGain) { + al.alSourcef(sourceID, ALConstants.AL_MIN_GAIN, minGain); } /** @@ -227,8 +228,8 @@ public final class Source { * @return the minimum gain for this source. */ public float getMinGain() { - float[] result = new float[1]; - al.alGetSourcef(sourceID, AL.AL_MIN_GAIN, result, 0); + final float[] result = new float[1]; + al.alGetSourcef(sourceID, ALConstants.AL_MIN_GAIN, result, 0); return result[0]; } @@ -238,8 +239,8 @@ public final class Source { * * @param maxGain the maximum gain for this source */ - public void setMaxGain(float maxGain) { - al.alSourcef(sourceID, AL.AL_MAX_GAIN, maxGain); + public void setMaxGain(final float maxGain) { + al.alSourcef(sourceID, ALConstants.AL_MAX_GAIN, maxGain); } /** @@ -248,8 +249,8 @@ public final class Source { * @return the maximum gain for this source */ public float getMaxGain() { - float[] result = new float[1]; - al.alGetSourcef(sourceID, AL.AL_MAX_GAIN, result, 0); + final float[] result = new float[1]; + al.alGetSourcef(sourceID, ALConstants.AL_MAX_GAIN, result, 0); return result[0]; } @@ -259,8 +260,8 @@ public final class Source { * * @param coneOuterGain the gain when outside the oriented cone. */ - public void setConeOuterGain(float coneOuterGain) { - al.alSourcef(sourceID, AL.AL_CONE_OUTER_GAIN, coneOuterGain); + public void setConeOuterGain(final float coneOuterGain) { + al.alSourcef(sourceID, ALConstants.AL_CONE_OUTER_GAIN, coneOuterGain); } /** @@ -269,8 +270,8 @@ public final class Source { * @return the gain when outside the oriented cone. */ public float getConeOuterGain() { - float[] result = new float[1]; - al.alGetSourcef(sourceID, AL.AL_CONE_OUTER_GAIN, result, 0); + final float[] result = new float[1]; + al.alGetSourcef(sourceID, ALConstants.AL_CONE_OUTER_GAIN, result, 0); return result[0]; } @@ -281,10 +282,10 @@ public final class Source { * @param position a Vec3f object containing the x,y,z position of the * source. */ - public void setPosition(Vec3f position) { + public void setPosition(final Vec3f position) { al.alSource3f( sourceID, - AL.AL_POSITION, + ALConstants.AL_POSITION, position.v1, position.v2, position.v3); @@ -297,8 +298,8 @@ public final class Source { * @param y the y position of the source. * @param z the z position of the source. */ - public void setPosition(float x, float y, float z) { - al.alSource3f(sourceID, AL.AL_POSITION, x, y, z); + public void setPosition(final float x, final float y, final float z) { + al.alSource3f(sourceID, ALConstants.AL_POSITION, x, y, z); } /** @@ -309,8 +310,8 @@ public final class Source { */ public Vec3f getPosition() { Vec3f result = null; - float[] pos = new float[3]; - al.alGetSourcefv(sourceID, AL.AL_POSITION, pos, 0); + final float[] pos = new float[3]; + al.alGetSourcefv(sourceID, ALConstants.AL_POSITION, pos, 0); result = new Vec3f(pos[0], pos[1], pos[2]); return result; @@ -321,10 +322,10 @@ public final class Source { * * @param velocity the velocity vector of the source */ - public void setVelocity(Vec3f velocity) { + public void setVelocity(final Vec3f velocity) { al.alSource3f( sourceID, - AL.AL_VELOCITY, + ALConstants.AL_VELOCITY, velocity.v1, velocity.v2, velocity.v3); @@ -337,8 +338,8 @@ public final class Source { * @param y the y velocity of the source. * @param z the z velocity of the source. */ - public void setVelocity(float x, float y, float z) { - al.alSource3f(sourceID, AL.AL_VELOCITY, x, y, z); + public void setVelocity(final float x, final float y, final float z) { + al.alSource3f(sourceID, ALConstants.AL_VELOCITY, x, y, z); } /** @@ -348,8 +349,8 @@ public final class Source { */ public Vec3f getVelocity() { Vec3f result = null; - float[] vel = new float[3]; - al.alGetSourcefv(sourceID, AL.AL_VELOCITY, vel, 0); + final float[] vel = new float[3]; + al.alGetSourcefv(sourceID, ALConstants.AL_VELOCITY, vel, 0); result = new Vec3f(vel[0], vel[1], vel[2]); return result; @@ -360,10 +361,10 @@ public final class Source { * * @param direction the direction vector of the source. */ - public void setDirection(Vec3f direction) { + public void setDirection(final Vec3f direction) { al.alSource3f( sourceID, - AL.AL_DIRECTION, + ALConstants.AL_DIRECTION, direction.v1, direction.v2, direction.v3); @@ -376,8 +377,8 @@ public final class Source { * @param y the y direction of the source. * @param z the z direction of the source. */ - public void setDirection(float x, float y, float z) { - al.alSource3f(sourceID, AL.AL_DIRECTION, x, y, z); + public void setDirection(final float x, final float y, final float z) { + al.alSource3f(sourceID, ALConstants.AL_DIRECTION, x, y, z); } /** @@ -387,80 +388,80 @@ public final class Source { */ public Vec3f getDirection() { Vec3f result = null; - float[] dir = new float[3]; - al.alGetSourcefv(sourceID, AL.AL_DIRECTION, dir, 0); + final float[] dir = new float[3]; + al.alGetSourcefv(sourceID, ALConstants.AL_DIRECTION, dir, 0); result = new Vec3f(dir[0], dir[1], dir[2]); return result; } /** - * Determines if the position of the source is relative to the listener. + * Determines if the position of the source is relative to the listener. * The default is false. * @param isRelative true if the position of the source is relative - * to the listener, false if the position of the source is relative to the + * to the listener, false if the position of the source is relative to the * world. */ - public void setSourceRelative(boolean isRelative) { - int rel = isRelative ? 1 : 0; - al.alSourcei(sourceID, AL.AL_SOURCE_RELATIVE, rel); + public void setSourceRelative(final boolean isRelative) { + final int rel = isRelative ? 1 : 0; + al.alSourcei(sourceID, ALConstants.AL_SOURCE_RELATIVE, rel); } /** - * Determines if the position of the source is relative to the listener. + * Determines if the position of the source is relative to the listener. * The default is false. * @return true if the position of the source is relative - * to the listener, false if the position of the source is relative to the + * to the listener, false if the position of the source is relative to the * world. */ public boolean isSourceRelative() { - int[] result = new int[1]; - al.alGetSourcei(sourceID, AL.AL_SOURCE_RELATIVE, result, 0); + final int[] result = new int[1]; + al.alGetSourcei(sourceID, ALConstants.AL_SOURCE_RELATIVE, result, 0); return result[0] == 1; } /** - * turns looping on or off. + * turns looping on or off. * * @param isLooping true-looping is on, false-looping is off */ - public void setLooping(boolean isLooping) { - int loop = isLooping ? 1 : 0; - al.alSourcei(sourceID, AL.AL_LOOPING, loop); + public void setLooping(final boolean isLooping) { + final int loop = isLooping ? 1 : 0; + al.alSourcei(sourceID, ALConstants.AL_LOOPING, loop); } /** - * indicates whether looping is turned on or off. + * indicates whether looping is turned on or off. * * @return true-looping is on, false-looping is off */ public boolean getLooping() { - boolean result = false; - int[] tmp = new int[1]; - al.alGetSourcei(sourceID, AL.AL_LOOPING, tmp, 0); - return tmp[0] == AL.AL_TRUE; + final boolean result = false; + final int[] tmp = new int[1]; + al.alGetSourcei(sourceID, ALConstants.AL_LOOPING, tmp, 0); + return tmp[0] == ALConstants.AL_TRUE; } - + /** - * Gets the number of buffers currently queued on this source. + * Gets the number of buffers currently queued on this source. * @return the number of buffers currently queued on this source. */ public int getBuffersQueued() { - int[] result = new int[1]; - al.alGetSourcei(sourceID, AL.AL_BUFFERS_QUEUED, result, 0); + final int[] result = new int[1]; + al.alGetSourcei(sourceID, ALConstants.AL_BUFFERS_QUEUED, result, 0); return result[0]; } /** - * Gets the number of buffers already processed on this source. + * Gets the number of buffers already processed on this source. * @return the number of buffers already processed on this source. */ public int getBuffersProcessed() { - int[] result = new int[1]; - al.alGetSourcei(sourceID, AL.AL_BUFFERS_PROCESSED, result, 0); + final int[] result = new int[1]; + al.alGetSourcei(sourceID, ALConstants.AL_BUFFERS_PROCESSED, result, 0); return result[0]; } @@ -470,8 +471,8 @@ public final class Source { * * @param buffer the buffer associated with this source */ - public void setBuffer(Buffer buffer) { - al.alSourcei(sourceID, AL.AL_BUFFER, buffer.bufferID); + public void setBuffer(final Buffer buffer) { + al.alSourcei(sourceID, ALConstants.AL_BUFFER, buffer.bufferID); this.buffer = buffer; } @@ -485,14 +486,14 @@ public final class Source { } /** - * Queues one or more buffers on a source. Useful for streaming audio, + * Queues one or more buffers on a source. Useful for streaming audio, * buffers will be played in the order they are queued. * * @param buffers a set of initialized (loaded) buffers. */ - public void queueBuffers(Buffer[] buffers) { - int numBuffers = buffers.length; - int[] arr = new int[numBuffers]; + public void queueBuffers(final Buffer[] buffers) { + final int numBuffers = buffers.length; + final int[] arr = new int[numBuffers]; for (int i = 0; i < numBuffers; i++) { arr[i] = buffers[i].bufferID; @@ -506,9 +507,9 @@ public final class Source { * * @param buffers a set of previously queued buffers. */ - public void unqueueBuffers(Buffer[] buffers) { - int numBuffers = buffers.length; - int[] arr = new int[numBuffers]; + public void unqueueBuffers(final Buffer[] buffers) { + final int numBuffers = buffers.length; + final int[] arr = new int[numBuffers]; for (int i = 0; i < numBuffers; i++) { arr[i] = buffers[i].bufferID; diff --git a/src/java/com/jogamp/openal/sound3d/Vec3f.java b/src/java/com/jogamp/openal/sound3d/Vec3f.java index 3a5aea2..8112a15 100644 --- a/src/java/com/jogamp/openal/sound3d/Vec3f.java +++ b/src/java/com/jogamp/openal/sound3d/Vec3f.java @@ -4,17 +4,17 @@ * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * -* -Redistribution of source code must retain the above copyright notice, +* -Redistribution of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * -* -Redistribution in binary form must reproduce the above copyright notice, +* -Redistribution in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * -* Neither the name of Sun Microsystems, Inc. or the names of contributors may -* be used to endorse or promote products derived from this software without +* Neither the name of Sun Microsystems, Inc. or the names of contributors may +* be used to endorse or promote products derived from this software without * specific prior written permission. -* +* * This software is provided "AS IS," without a warranty of any kind. * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR @@ -55,7 +55,7 @@ public final class Vec3f { * @param v2 the second element in the vector * @param v3 the third element in the vector */ - public Vec3f(float v1, float v2, float v3) { + public Vec3f(final float v1, final float v2, final float v3) { this.v1 = v1; this.v2 = v2; this.v3 = v3; diff --git a/src/java/com/jogamp/openal/util/ALHelpers.java b/src/java/com/jogamp/openal/util/ALHelpers.java index 54a5505..7c2b0d4 100644 --- a/src/java/com/jogamp/openal/util/ALHelpers.java +++ b/src/java/com/jogamp/openal/util/ALHelpers.java @@ -48,18 +48,18 @@ public class ALHelpers { * AL sample type. If <code>hasSOFTBufferSamples</code> is true, * it will be called to find the closest-matching format from * <code>AL_SOFT_buffer_samples</code>. - * <p> + * <p> * Returns {@link ALConstants#AL_NONE} if no supported format can be found. - * </p> - * + * </p> + * * @param alChannelLayout AL channel layout, see {@link #getDefaultALChannelLayout(int)} * @param alSampleType AL sample type, see {@link #getALSampleType(int, boolean, boolean)}. - * @param hasSOFTBufferSamples true if having extension <code>AL_SOFT_buffer_samples</code>, otherwise false + * @param hasSOFTBufferSamples true if having extension <code>AL_SOFT_buffer_samples</code>, otherwise false * @param al AL instance * @param alExt ALExt instance * @return AL buffer format */ - public static final int getALFormat(final int alChannelLayout, final int alSampleType, + public static final int getALFormat(final int alChannelLayout, final int alSampleType, final boolean hasSOFTBufferSamples, final AL al, final ALExt alExt) { int format = AL_NONE; @@ -226,7 +226,7 @@ public class ALHelpers { * @param fixedP true for fixed point value, false for floating point value with a sampleSize of 32 (float) or 64 (double) */ public static final int getDefaultALChannelLayout(final int channelCount) { - switch(channelCount) { + switch(channelCount) { case 1: return AL_MONO_SOFT; case 2: return AL_STEREO_SOFT; // case 2: return AL_REAR_SOFT; @@ -237,12 +237,12 @@ public class ALHelpers { } return AL_NONE; } - + /** * Returns the readable name of the given AL channel layout */ public static final String alChannelLayoutName(final int alChannelLayout) { - switch(alChannelLayout) { + switch(alChannelLayout) { case AL_MONO_SOFT: return "Mono"; case AL_STEREO_SOFT: return "Stereo"; case AL_REAR_SOFT: return "Rear"; @@ -260,7 +260,7 @@ public class ALHelpers { * @param signed true if signed number, false for unsigned * @param fixedP true for fixed point value, false for floating point value with a sampleSize of 32 (float) or 64 (double) */ - public static final int getALSampleType(final int sampleSize, boolean signed, boolean fixedP) { + public static final int getALSampleType(final int sampleSize, final boolean signed, final boolean fixedP) { if( fixedP ) { if( signed ) { switch( sampleSize ) { @@ -281,11 +281,11 @@ public class ALHelpers { case 32: return AL_FLOAT_SOFT; case 64: return AL_DOUBLE_SOFT; } - } + } } return AL_NONE; } - + /** * Returns the readable name of the given AL sample type */ @@ -304,22 +304,22 @@ public class ALHelpers { } /** - * Returns the byte size of the given AL sample type + * Returns the byte size of the given AL sample type * @throws IllegalArgumentException for unknown <code>alChannelLayout</code> or <code>alSampleType</code> values. */ public static final int sizeOfALSampleType(final int alSampleType) throws IllegalArgumentException { switch(alSampleType) { - case AL_BYTE_SOFT: - case AL_UNSIGNED_BYTE_SOFT: + case AL_BYTE_SOFT: + case AL_UNSIGNED_BYTE_SOFT: return 1; - case AL_SHORT_SOFT: - case AL_UNSIGNED_SHORT_SOFT: + case AL_SHORT_SOFT: + case AL_UNSIGNED_SHORT_SOFT: return 2; - case AL_INT_SOFT: + case AL_INT_SOFT: case AL_UNSIGNED_INT_SOFT: - case AL_FLOAT_SOFT: + case AL_FLOAT_SOFT: return 4; - case AL_DOUBLE_SOFT: + case AL_DOUBLE_SOFT: return 8; default: throw new IllegalArgumentException("Unknown al-type 0x"+Integer.toHexString(alSampleType)); @@ -349,19 +349,19 @@ public class ALHelpers { switch(alSampleType) { case AL_BYTE_SOFT: - case AL_UNSIGNED_BYTE_SOFT: + case AL_UNSIGNED_BYTE_SOFT: break; case AL_SHORT_SOFT: - case AL_UNSIGNED_SHORT_SOFT: - sampleCount *= 2; + case AL_UNSIGNED_SHORT_SOFT: + sampleCount *= 2; break; case AL_INT_SOFT: case AL_UNSIGNED_INT_SOFT: - case AL_FLOAT_SOFT: - sampleCount *= 4; + case AL_FLOAT_SOFT: + sampleCount *= 4; break; - case AL_DOUBLE_SOFT: - sampleCount *= 8; + case AL_DOUBLE_SOFT: + sampleCount *= 8; break; default: throw new IllegalArgumentException("Unknown al-type 0x"+Integer.toHexString(alSampleType)); diff --git a/src/java/com/jogamp/openal/util/ALut.java b/src/java/com/jogamp/openal/util/ALut.java index c6439d7..311b08b 100644 --- a/src/java/com/jogamp/openal/util/ALut.java +++ b/src/java/com/jogamp/openal/util/ALut.java @@ -4,17 +4,17 @@ * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * -* -Redistribution of source code must retain the above copyright notice, +* -Redistribution of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * -* -Redistribution in binary form must reproduce the above copyright notice, +* -Redistribution in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * -* Neither the name of Sun Microsystems, Inc. or the names of contributors may -* be used to endorse or promote products derived from this software without +* Neither the name of Sun Microsystems, Inc. or the names of contributors may +* be used to endorse or promote products derived from this software without * specific prior written permission. -* +* * This software is provided "AS IS," without a warranty of any kind. * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR @@ -37,6 +37,7 @@ package com.jogamp.openal.util; import java.io.*; import java.nio.ByteBuffer; + import com.jogamp.openal.*; /** @@ -62,12 +63,12 @@ public final class ALut { if (alc == null) { alc = ALFactory.getALC(); } - String deviceName = null; - ALCdevice d = alc.alcOpenDevice(deviceName); + final String deviceName = null; + final ALCdevice d = alc.alcOpenDevice(deviceName); if (d == null) { throw new ALException("Error opening default OpenAL device"); } - ALCcontext c = alc.alcCreateContext(d, null); + final ALCcontext c = alc.alcCreateContext(d, null); if (c == null) { alc.alcCloseDevice(d); throw new ALException("Error creating OpenAL context"); @@ -102,41 +103,41 @@ public final class ALut { initializingThread = null; } - public static void alutLoadWAVFile(String fileName, - int[] format, - ByteBuffer[] data, - int[] size, - int[] freq, - int[] loop) throws ALException { + public static void alutLoadWAVFile(final String fileName, + final int[] format, + final ByteBuffer[] data, + final int[] size, + final int[] freq, + final int[] loop) throws ALException { try { - WAVData wd = WAVLoader.loadFromFile(fileName); + final WAVData wd = WAVLoader.loadFromFile(fileName); format[0] = wd.format; data[0] = wd.data; size[0] = wd.size; freq[0] = wd.freq; - loop[0] = wd.loop ? AL.AL_TRUE : AL.AL_FALSE; - } catch (Exception e) { + loop[0] = wd.loop ? ALConstants.AL_TRUE : ALConstants.AL_FALSE; + } catch (final Exception e) { throw new ALException(e); } } public static void alutLoadWAVFile(InputStream stream, - int[] format, - ByteBuffer[] data, - int[] size, - int[] freq, - int[] loop) throws ALException { + final int[] format, + final ByteBuffer[] data, + final int[] size, + final int[] freq, + final int[] loop) throws ALException { try { if (!(stream instanceof BufferedInputStream)) { stream = new BufferedInputStream(stream); } - WAVData wd = WAVLoader.loadFromStream(stream); + final WAVData wd = WAVLoader.loadFromStream(stream); format[0] = wd.format; data[0] = wd.data; size[0] = wd.size; freq[0] = wd.freq; - loop[0] = wd.loop ? AL.AL_TRUE : AL.AL_FALSE; - } catch (Exception e) { + loop[0] = wd.loop ? ALConstants.AL_TRUE : ALConstants.AL_FALSE; + } catch (final Exception e) { throw new ALException(e); } } diff --git a/src/java/com/jogamp/openal/util/WAVData.java b/src/java/com/jogamp/openal/util/WAVData.java index 9fab8ba..94dd002 100644 --- a/src/java/com/jogamp/openal/util/WAVData.java +++ b/src/java/com/jogamp/openal/util/WAVData.java @@ -74,7 +74,7 @@ public final class WAVData { /** flag indicating whether or not the sound in the data should loop */ public final boolean loop; - public WAVData(ByteBuffer data, int format, int size, int freq, boolean loop) { + public WAVData(final ByteBuffer data, final int format, final int size, final int freq, final boolean loop) { this.data = data; this.format = format; this.size = size; @@ -98,7 +98,7 @@ public final class WAVData { * @throws IOException If the file can no be found or some other IO error * occurs */ - public static WAVData loadFromStream(InputStream aIn, int initialCapacity, int numChannels, int bits, int sampleRate, ByteOrder byteOrder, boolean loop) + public static WAVData loadFromStream(InputStream aIn, final int initialCapacity, final int numChannels, final int bits, final int sampleRate, final ByteOrder byteOrder, final boolean loop) throws IOException { if( !(aIn instanceof BufferedInputStream) ) { aIn = new BufferedInputStream(aIn); @@ -115,21 +115,21 @@ public final class WAVData { } else if ((bits == 16) && (numChannels == 2)) { format = ALConstants.AL_FORMAT_STEREO16; } - ByteBuffer buffer = IOUtil.copyStream2ByteBuffer(aIn, initialCapacity); - int size = buffer.limit(); + final ByteBuffer buffer = IOUtil.copyStream2ByteBuffer(aIn, initialCapacity); + final int size = buffer.limit(); // Must byte swap in case endianess mismatch if ( bits == 16 && ByteOrder.nativeOrder() != byteOrder ) { - int len = buffer.remaining(); + final int len = buffer.remaining(); for (int i = 0; i < len; i += 2) { - byte a = buffer.get(i); - byte b = buffer.get(i+1); + final byte a = buffer.get(i); + final byte b = buffer.get(i+1); buffer.put(i, b); buffer.put(i+1, a); } } - WAVData result = new WAVData(buffer, format, size, sampleRate, loop); + final WAVData result = new WAVData(buffer, format, size, sampleRate, loop); aIn.close(); return result; diff --git a/src/java/com/jogamp/openal/util/WAVLoader.java b/src/java/com/jogamp/openal/util/WAVLoader.java index 5547ed2..bb3507e 100644 --- a/src/java/com/jogamp/openal/util/WAVLoader.java +++ b/src/java/com/jogamp/openal/util/WAVLoader.java @@ -61,9 +61,9 @@ public class WAVLoader { * @throws IOException If the file can no be found or some other IO error * occurs */ - public static WAVData loadFromFile(String filename) throws ALException, IOException { - File soundFile = new File(filename); - InputStream is = new FileInputStream(soundFile); + public static WAVData loadFromFile(final String filename) throws ALException, IOException { + final File soundFile = new File(filename); + final InputStream is = new FileInputStream(soundFile); return loadFromStreamImpl(is); } @@ -78,7 +78,7 @@ public class WAVLoader { * @throws IOException If the file can no be found or some other IO error * occurs */ - public static WAVData loadFromStream(InputStream stream) throws ALException, IOException { + public static WAVData loadFromStream(final InputStream stream) throws ALException, IOException { return loadFromStreamImpl(stream); } @@ -89,7 +89,7 @@ public class WAVLoader { private static final int FMT = 0x666D7420; private static final int DATA = 0x64617461; - private static WAVData loadFromStreamImpl(InputStream aIn) throws ALException, IOException { + private static WAVData loadFromStreamImpl(final InputStream aIn) throws ALException, IOException { /** * references: * http://www.sonicspot.com/guide/wavefiles.html @@ -125,7 +125,7 @@ public class WAVLoader { long chunkLength = 0; while (!foundData) { - int chunkId = (int)bs.readUInt32(true /* msbFirst */, true /* bigEndian */); + final int chunkId = (int)bs.readUInt32(true /* msbFirst */, true /* bigEndian */); chunkLength = bs.readUInt32(true /* msbFirst */, bigEndian); switch (chunkId) { case FMT: diff --git a/src/java/jogamp/openal/ALCImpl.java b/src/java/jogamp/openal/ALCImpl.java index c5a9b7b..99494ca 100644 --- a/src/java/jogamp/openal/ALCImpl.java +++ b/src/java/jogamp/openal/ALCImpl.java @@ -16,26 +16,26 @@ import java.util.ArrayList; */ public class ALCImpl extends ALCAbstractImpl { - public String alcGetString(ALCdevice device, int param) { + public String alcGetString(final ALCdevice device, final int param) { if (device == null && param == ALC_DEVICE_SPECIFIER) { throw new ALException("Call alcGetDeviceSpecifiers to fetch all available device names"); } - ByteBuffer buf = alcGetStringImpl(device, param); + final ByteBuffer buf = alcGetStringImpl(device, param); if (buf == null) { return null; } - byte[] res = new byte[buf.capacity()]; + final byte[] res = new byte[buf.capacity()]; buf.get(res); try { return new String(res, "US-ASCII"); - } catch (UnsupportedEncodingException e) { + } catch (final UnsupportedEncodingException e) { throw new ALException(e); } } /** Entry point (through function pointer) to C language function: <br> <code> const ALCchar * alcGetString(ALCdevice * device, ALCenum param); </code> */ - public ByteBuffer alcGetStringImpl(ALCdevice device, int param) { + public ByteBuffer alcGetStringImpl(final ALCdevice device, final int param) { final long __addr_ = getALCProcAddressTable()._addressof_alcGetString; if (__addr_ == 0) { @@ -67,18 +67,18 @@ public class ALCImpl extends ALCAbstractImpl { return getDoubleNullTerminatedString(ALC_CAPTURE_DEVICE_SPECIFIER); } - private String[] getDoubleNullTerminatedString(int which) { - ByteBuffer buf = alcGetStringImpl(null, which); + private String[] getDoubleNullTerminatedString(final int which) { + final ByteBuffer buf = alcGetStringImpl(null, which); if (buf == null) { return null; } - byte[] bytes = new byte[buf.capacity()]; + final byte[] bytes = new byte[buf.capacity()]; buf.get(bytes); try { - ArrayList/*<String>*/ res = new ArrayList/*<String>*/(); + final ArrayList/*<String>*/ res = new ArrayList/*<String>*/(); int i = 0; while (i < bytes.length) { - int startIndex = i; + final int startIndex = i; while ((i < bytes.length) && (bytes[i] != 0)) { i++; } @@ -86,7 +86,7 @@ public class ALCImpl extends ALCAbstractImpl { i++; } return (String[]) res.toArray(new String[res.size()]); - } catch (UnsupportedEncodingException e) { + } catch (final UnsupportedEncodingException e) { throw new ALException(e); } } diff --git a/src/java/jogamp/openal/ALDynamicLibraryBundleInfo.java b/src/java/jogamp/openal/ALDynamicLibraryBundleInfo.java index 0859be1..ca86ed1 100644 --- a/src/java/jogamp/openal/ALDynamicLibraryBundleInfo.java +++ b/src/java/jogamp/openal/ALDynamicLibraryBundleInfo.java @@ -87,7 +87,7 @@ public final class ALDynamicLibraryBundleInfo implements DynamicLibraryBundleInf @Override public final List<List<String>> getToolLibNames() { - List<List<String>> libNamesList = new ArrayList<List<String>>(); + final List<List<String>> libNamesList = new ArrayList<List<String>>(); final List<String> alSystemLibNames = new ArrayList<String>(); { @@ -137,18 +137,18 @@ public final class ALDynamicLibraryBundleInfo implements DynamicLibraryBundleInf @Override public final List<String> getToolGetProcAddressFuncNameList() { - List<String> res = new ArrayList<String>(); + final List<String> res = new ArrayList<String>(); res.add("alGetProcAddress"); return res; } @Override - public final long toolGetProcAddress(long toolGetProcAddressHandle, String funcName) { + public final long toolGetProcAddress(final long toolGetProcAddressHandle, final String funcName) { return ALImpl.alGetProcAddress(toolGetProcAddressHandle, funcName); } @Override - public final boolean useToolGetProcAdressFirst(String funcName) { + public final boolean useToolGetProcAdressFirst(final String funcName) { return true; } diff --git a/src/java/jogamp/openal/Debug.java b/src/java/jogamp/openal/Debug.java index 4cc209e..61dcb9d 100644 --- a/src/java/jogamp/openal/Debug.java +++ b/src/java/jogamp/openal/Debug.java @@ -1,22 +1,22 @@ /* * Copyright (c) 2003-2005 Sun Microsystems, Inc. All Rights Reserved. * Copyright (c) 2012 JogAmp Community. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: - * + * * - Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * - Redistribution in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * Neither the name of Sun Microsystems, Inc. or the names of * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * + * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A @@ -29,11 +29,11 @@ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - * + * * You acknowledge that this software is not designed or intended for use * in the design, construction, operation or maintenance of any nuclear * facility. - * + * * Sun gratefully acknowledges that this software was originally authored * and developed by Kenneth Bradley Russell and Christopher John Kline. */ @@ -52,14 +52,14 @@ public class Debug extends PropertyAccess { // Some common properties private static boolean verbose; private static boolean debugAll; - + static { AccessController.doPrivileged(new PrivilegedAction<Object>() { public Object run() { PropertyAccess.addTrustedPrefix("joal."); return null; } } ); - + verbose = isPropertyDefined("joal.verbose", true); debugAll = isPropertyDefined("joal.debug", true); } @@ -67,7 +67,7 @@ public class Debug extends PropertyAccess { /** Ensures static init block has been issues, i.e. if calling through to {@link PropertyAccess#isPropertyDefined(String, boolean)}. */ public static final void initSingleton() {} - + public static final boolean verbose() { return verbose; } @@ -76,7 +76,7 @@ public class Debug extends PropertyAccess { return debugAll; } - public static final boolean debug(String subcomponent) { + public static final boolean debug(final String subcomponent) { return debugAll() || isPropertyDefined("joal.debug." + subcomponent, true); } } diff --git a/src/test/com/jogamp/openal/test/android/BaseActivity.java b/src/test/com/jogamp/openal/test/android/BaseActivity.java index 9aec18a..b7324de 100644 --- a/src/test/com/jogamp/openal/test/android/BaseActivity.java +++ b/src/test/com/jogamp/openal/test/android/BaseActivity.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -31,39 +31,39 @@ import android.app.Activity; import android.os.Bundle; import android.util.Log; -public class BaseActivity extends Activity { +public class BaseActivity extends Activity { boolean isDelegatedActivity; Activity rootActivity; boolean setThemeCalled = false; - + public BaseActivity() { super(); isDelegatedActivity = false; rootActivity = this; } - - public void setRootActivity(Activity rootActivity) { + + public void setRootActivity(final Activity rootActivity) { this.rootActivity = rootActivity; this.isDelegatedActivity = this != rootActivity; } - + public final boolean isDelegatedActivity() { return isDelegatedActivity; } - + public final Activity getActivity() { return rootActivity; - } - + } + @Override - public void onCreate(Bundle savedInstanceState) { + public void onCreate(final Bundle savedInstanceState) { Log.d(MD.TAG, "onCreate"); if(!isDelegatedActivity()) { super.onCreate(savedInstanceState); } jogamp.common.os.android.StaticContext.init(rootActivity.getApplicationContext()); } - + @Override public void onStart() { Log.d(MD.TAG, "onStart"); @@ -71,7 +71,7 @@ public class BaseActivity extends Activity { super.onStart(); } } - + @Override public void onRestart() { Log.d(MD.TAG, "onRestart"); @@ -100,7 +100,7 @@ public class BaseActivity extends Activity { public void onStop() { Log.d(MD.TAG, "onStop"); if(!isDelegatedActivity()) { - super.onStop(); + super.onStop(); } } @@ -109,7 +109,7 @@ public class BaseActivity extends Activity { Log.d(MD.TAG, "onDestroy"); jogamp.common.os.android.StaticContext.clear(); if(!isDelegatedActivity()) { - super.onDestroy(); + super.onDestroy(); } - } + } } diff --git a/src/test/com/jogamp/openal/test/android/LauncherUtil.java b/src/test/com/jogamp/openal/test/android/LauncherUtil.java index d416e5d..a0f53ac 100644 --- a/src/test/com/jogamp/openal/test/android/LauncherUtil.java +++ b/src/test/com/jogamp/openal/test/android/LauncherUtil.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -43,45 +43,45 @@ import android.util.Log; * Helper class to parse Uri's and programmatically add package names and properties to create an Uri or Intend. * <p> * The order of the Uri segments (any arguments) is preserved. - * </p> + * </p> */ public class LauncherUtil { - + /** Default launch mode. */ public static final String LAUNCH_ACTIVITY_NORMAL = "org.jogamp.launcher.action.LAUNCH_ACTIVITY_NORMAL"; - + /** Transparent launch mode. Note: This seems to be required to achieve translucency, since setTheme(..) doesn't work. */ public static final String LAUNCH_ACTIVITY_TRANSPARENT = "org.jogamp.launcher.action.LAUNCH_ACTIVITY_TRANSPARENT"; - + /** FIXME: TODO */ public static final String LAUNCH_MAIN = "org.jogamp.launcher.action.LAUNCH_MAIN"; - + /** FIXME: TODO */ public static final String LAUNCH_JUNIT = "org.jogamp.launcher.action.LAUNCH_JUNIT"; - + /** The protocol <code>launch</code> */ public static final String SCHEME = "launch"; - + /** The host <code>jogamp.org</code> */ public static final String HOST = "jogamp.org"; - + static final String SYS_PKG = "sys"; - + static final String USR_PKG = "pkg"; - + static final String ARG = "arg"; - + public static abstract class BaseActivityLauncher extends Activity { final OrderedProperties props = new OrderedProperties(); final ArrayList<String> args = new ArrayList<String>(); - /** + /** * Returns the default {@link LauncherUtil#LAUNCH_ACTIVITY_NORMAL} action. * <p> * Should be overridden for other action, eg. {@link LauncherUtil#LAUNCH_ACTIVITY_TRANSPARENT}. * </p> */ public String getAction() { return LAUNCH_ACTIVITY_NORMAL; } - + /** * Returns the properties, which are being propagated to the target activity. * <p> @@ -89,58 +89,58 @@ public class LauncherUtil { * </p> */ public final OrderedProperties getProperties() { return props; } - + /** * Returns the commandline arguments, which are being propagated to the target activity. * <p> * Maybe be used to set custom commandline arguments. * </p> */ - public final ArrayList<String> getArguments() { return args; } - + public final ArrayList<String> getArguments() { return args; } + /** Custom initialization hook which can be overriden to setup data, e.g. fill the properties retrieved by {@link #getProperties()}. */ public void init() { } - + /** Returns true if this launcher activity shall end after starting the downstream activity. Defaults to <code>true</code>, override to change behavior. */ public boolean finishAfterDelegate() { return true; } - + /** Must return the downstream Activity class name */ public abstract String getActivityName(); - + /** Must return a list of required user packages, at least one containing the activity. */ public abstract List<String> getUsrPackages(); - + /** Return a list of required system packages w/ native libraries, may return null or a zero sized list. */ public abstract List<String> getSysPackages(); @Override - public void onCreate(Bundle savedInstanceState) { + public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); - + init(); - + final DataSet data = new DataSet(); data.setActivityName(getActivityName()); data.addAllSysPackages(getSysPackages()); data.addAllUsrPackages(getUsrPackages()); data.addAllProperties(props); data.addAllArguments(args); - + final Intent intent = LauncherUtil.getIntent(getAction(), data); Log.d(getClass().getSimpleName(), "Launching Activity: "+intent); startActivity (intent); - + if(finishAfterDelegate()) { finish(); // done } - } + } } - + public static class OrderedProperties { HashMap<String, String> map = new HashMap<String, String>(); - ArrayList<String> keyList = new ArrayList<String>(); - - public final void setProperty(String key, String value) { + ArrayList<String> keyList = new ArrayList<String>(); + + public final void setProperty(final String key, final String value) { if(key.equals(SYS_PKG)) { throw new IllegalArgumentException("Illegal property key, '"+SYS_PKG+"' is reserved"); } @@ -157,36 +157,36 @@ public class LauncherUtil { } keyList.add(key); // new key } - - public final void addAll(OrderedProperties props) { - Iterator<String> argKeys = props.keyList.iterator(); + + public final void addAll(final OrderedProperties props) { + final Iterator<String> argKeys = props.keyList.iterator(); while(argKeys.hasNext()) { final String key = argKeys.next(); setProperty(key, props.map.get(key)); - } + } } - + public final void setSystemProperties() { - Iterator<String> argKeys = keyList.iterator(); + final Iterator<String> argKeys = keyList.iterator(); while(argKeys.hasNext()) { final String key = argKeys.next(); System.setProperty(key, map.get(key)); } } public final void clearSystemProperties() { - Iterator<String> argKeys = keyList.iterator(); + final Iterator<String> argKeys = keyList.iterator(); while(argKeys.hasNext()) { System.clearProperty(argKeys.next()); } } - - public final String getProperty(String key) { return map.get(key); } + + public final String getProperty(final String key) { return map.get(key); } public final Map<String, String> getProperties() { return map; } - + /** Returns the list of property keys in the order, as they were added. */ - public final List<String> getPropertyKeys() { return keyList; } + public final List<String> getPropertyKeys() { return keyList; } } - + /** * Data set to transfer from and to launch URI consisting out of: * <ul> @@ -205,56 +205,56 @@ public class LauncherUtil { static final char ASSIG = '='; static final String COLSLASH2 = "://"; static final String EMPTY = ""; - + String activityName = null; ArrayList<String> sysPackages = new ArrayList<String>(); ArrayList<String> usrPackages = new ArrayList<String>(); OrderedProperties properties = new OrderedProperties(); ArrayList<String> arguments = new ArrayList<String>(); - - public final void setActivityName(String name) { activityName = name; } + + public final void setActivityName(final String name) { activityName = name; } public final String getActivityName() { return activityName; } - - public final void addSysPackage(String p) { - sysPackages.add(p); - } - public final void addAllSysPackages(List<String> plist) { + + public final void addSysPackage(final String p) { + sysPackages.add(p); + } + public final void addAllSysPackages(final List<String> plist) { sysPackages.addAll(plist); - } + } public final List<String> getSysPackages() { return sysPackages; } - - public final void addUsrPackage(String p) { - usrPackages.add(p); - } - public final void addAllUsrPackages(List<String> plist) { + + public final void addUsrPackage(final String p) { + usrPackages.add(p); + } + public final void addAllUsrPackages(final List<String> plist) { usrPackages.addAll(plist); - } + } public final List<String> getUsrPackages() { return usrPackages; } - - public final void setProperty(String key, String value) { + + public final void setProperty(final String key, final String value) { properties.setProperty(key, value); } - public final void addAllProperties(OrderedProperties props) { + public final void addAllProperties(final OrderedProperties props) { properties.addAll(props); } public final void setSystemProperties() { properties.setSystemProperties(); - } + } public final void clearSystemProperties() { properties.clearSystemProperties(); - } - public final String getProperty(String key) { return properties.getProperty(key); } + } + public final String getProperty(final String key) { return properties.getProperty(key); } public final OrderedProperties getProperties() { return properties; } public final List<String> getPropertyKeys() { return properties.getPropertyKeys(); } - - public final void addArgument(String arg) { arguments.add(arg); } - public final void addAllArguments(List<String> args) { + + public final void addArgument(final String arg) { arguments.add(arg); } + public final void addAllArguments(final List<String> args) { arguments.addAll(args); } public final ArrayList<String> getArguments() { return arguments; } - + public final Uri getUri() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append(SCHEME).append(COLSLASH2).append(HOST).append(SLASH).append(getActivityName()); boolean needsQMark = true; boolean needsSep = false; @@ -284,7 +284,7 @@ public class LauncherUtil { needsSep = true; } } - Iterator<String> propKeys = properties.keyList.iterator(); + final Iterator<String> propKeys = properties.keyList.iterator(); while(propKeys.hasNext()) { if( needsQMark ) { sb.append(QMARK); @@ -297,7 +297,7 @@ public class LauncherUtil { sb.append(key).append(ASSIG).append(properties.map.get(key)); needsSep = true; } - Iterator<String> args = arguments.iterator(); + final Iterator<String> args = arguments.iterator(); while(args.hasNext()) { if( needsQMark ) { sb.append(QMARK); @@ -308,18 +308,18 @@ public class LauncherUtil { } sb.append(ARG).append(ASSIG).append(args.next()); needsSep = true; - } + } return Uri.parse(sb.toString()); } - - public static final DataSet create(Uri uri) { + + public static final DataSet create(final Uri uri) { if(!uri.getScheme().equals(SCHEME)) { return null; } if(!uri.getHost().equals(HOST)) { return null; } - DataSet data = new DataSet(); + final DataSet data = new DataSet(); { String an = uri.getPath(); if(SLASH == an.charAt(0)) { @@ -330,16 +330,16 @@ public class LauncherUtil { } data.setActivityName(an); } - + final String q = uri.getQuery(); final int q_l = null != q ? q.length() : -1; int q_e = -1; while(q_e < q_l) { - int q_b = q_e + 1; // next term + final int q_b = q_e + 1; // next term q_e = q.indexOf(AMPER, q_b); if(0 == q_e) { // single separator - continue; + continue; } if(0 > q_e) { // end @@ -381,41 +381,41 @@ public class LauncherUtil { data.validate(); return data; } - + public final void validate() { if(null == activityName) { throw new RuntimeException("Activity is not NULL"); } } } - - public final static Intent getIntent(String action, DataSet data) { + + public final static Intent getIntent(final String action, final DataSet data) { data.validate(); return new Intent(action, data.getUri()); } - + public static void main(String[] args) { if(args.length==0) { args = new String[] { - SCHEME+"://"+HOST+"/com.jogamp.TestActivity?"+SYS_PKG+"=jogamp.pack1&"+SYS_PKG+"=javax.pack2&"+USR_PKG+"=com.jogamp.pack3&"+USR_PKG+"=com.jogamp.pack4&jogamp.common.debug=true&com.jogamp.test=false", + SCHEME+"://"+HOST+"/com.jogamp.TestActivity?"+SYS_PKG+"=jogamp.pack1&"+SYS_PKG+"=javax.pack2&"+USR_PKG+"=com.jogamp.pack3&"+USR_PKG+"=com.jogamp.pack4&jogamp.common.debug=true&com.jogamp.test=false", SCHEME+"://"+HOST+"/com.jogamp.TestActivity?"+SYS_PKG+"=jogamp.pack1&jogamp.common.debug=true&com.jogamp.test=false", SCHEME+"://"+HOST+"/com.jogamp.TestActivity?"+USR_PKG+"=jogamp.pack1&jogamp.common.debug=true&com.jogamp.test=false", SCHEME+"://"+HOST+"/com.jogamp.TestActivity?"+USR_PKG+"=jogamp.pack1&"+USR_PKG+"=com.jogamp.pack2", - SCHEME+"://"+HOST+"/com.jogamp.TestActivity?"+USR_PKG+"=jogamp.pack1&"+USR_PKG+"=javax.pack2&"+USR_PKG+"=com.jogamp.pack3&jogamp.common.debug=true&com.jogamp.test=false&"+ARG+"=arg1&"+ARG+"=arg2=arg2value&"+ARG+"=arg3", - SCHEME+"://"+HOST+"/com.jogamp.TestActivity?"+USR_PKG+"=jogamp.pack1&jogamp.common.debug=true&com.jogamp.test=false&"+ARG+"=arg1&"+ARG+"=arg2=arg2value&"+ARG+"=arg3", - SCHEME+"://"+HOST+"/com.jogamp.TestActivity?"+USR_PKG+"=jogamp.pack1&"+ARG+"=arg1&"+ARG+"=arg2=arg2value&"+ARG+"=arg3" + SCHEME+"://"+HOST+"/com.jogamp.TestActivity?"+USR_PKG+"=jogamp.pack1&"+USR_PKG+"=javax.pack2&"+USR_PKG+"=com.jogamp.pack3&jogamp.common.debug=true&com.jogamp.test=false&"+ARG+"=arg1&"+ARG+"=arg2=arg2value&"+ARG+"=arg3", + SCHEME+"://"+HOST+"/com.jogamp.TestActivity?"+USR_PKG+"=jogamp.pack1&jogamp.common.debug=true&com.jogamp.test=false&"+ARG+"=arg1&"+ARG+"=arg2=arg2value&"+ARG+"=arg3", + SCHEME+"://"+HOST+"/com.jogamp.TestActivity?"+USR_PKG+"=jogamp.pack1&"+ARG+"=arg1&"+ARG+"=arg2=arg2value&"+ARG+"=arg3" }; } int errors = 0; for(int i=0; i<args.length; i++) { - String uri_s = args[i]; - Uri uri0 = Uri.parse(uri_s); - DataSet data = DataSet.create(uri0); + final String uri_s = args[i]; + final Uri uri0 = Uri.parse(uri_s); + final DataSet data = DataSet.create(uri0); if(null == data) { errors++; System.err.println("Error: NULL JogAmpLauncherUtil: <"+uri_s+"> -> "+uri0+" -> NULL"); } else { - Uri uri1 = data.getUri(); + final Uri uri1 = data.getUri(); if(!uri0.equals(uri1)) { errors++; System.err.println("Error: Not equal: <"+uri_s+"> -> "+uri0+" -> "+uri1); @@ -426,5 +426,5 @@ public class LauncherUtil { } System.err.println("LauncherUtil Self Test: Errors: "+errors); } - + } diff --git a/src/test/com/jogamp/openal/test/android/MD.java b/src/test/com/jogamp/openal/test/android/MD.java index 113203e..c7a6b68 100644 --- a/src/test/com/jogamp/openal/test/android/MD.java +++ b/src/test/com/jogamp/openal/test/android/MD.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,13 +20,15 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ package com.jogamp.openal.test.android; +import jogamp.common.os.PlatformPropsImpl; + import com.jogamp.common.GlueGenVersion; import com.jogamp.common.os.Platform; import com.jogamp.common.util.VersionUtil; @@ -34,20 +36,20 @@ import com.jogamp.openal.JoalVersion; public class MD { public static final String TAG = "JogAmp.JOAL"; - - public static String getInfo() { - StringBuilder sb = new StringBuilder(); - - sb.append(VersionUtil.getPlatformInfo()).append(Platform.NEWLINE) - .append(GlueGenVersion.getInstance()).append(Platform.NEWLINE) - .append(JoalVersion.getInstance()).append(Platform.NEWLINE) - .append(Platform.NEWLINE); - - return sb.toString(); + + public static String getInfo() { + final StringBuilder sb = new StringBuilder(); + + sb.append(VersionUtil.getPlatformInfo()).append(PlatformPropsImpl.NEWLINE) + .append(GlueGenVersion.getInstance()).append(PlatformPropsImpl.NEWLINE) + .append(JoalVersion.getInstance()).append(PlatformPropsImpl.NEWLINE) + .append(PlatformPropsImpl.NEWLINE); + + return sb.toString(); } - - public static void main(String args[]) { - + + public static void main(final String args[]) { + System.err.println(getInfo()); } } diff --git a/src/test/com/jogamp/openal/test/android/OpenALTestActivity.java b/src/test/com/jogamp/openal/test/android/OpenALTestActivity.java index 960d447..e9d94a0 100644 --- a/src/test/com/jogamp/openal/test/android/OpenALTestActivity.java +++ b/src/test/com/jogamp/openal/test/android/OpenALTestActivity.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,7 +20,7 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. @@ -34,26 +34,26 @@ import android.util.Log; public class OpenALTestActivity extends BaseActivity { static String TAG = "OpenALTestActivity"; - + OpenALTest demo = null; - + @Override - public void onCreate(Bundle savedInstanceState) { + public void onCreate(final Bundle savedInstanceState) { Log.d(TAG, "onCreate - 0"); super.onCreate(savedInstanceState); - + demo = new OpenALTest(); try { demo.init(); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); demo.dispose(); demo = null; } - + Log.d(TAG, "onCreate - X"); } - + @Override public void onResume() { Log.d(MD.TAG, "onResume"); @@ -79,7 +79,7 @@ public class OpenALTestActivity extends BaseActivity { demo.dispose(); demo = null; } - super.onDestroy(); - } - + super.onDestroy(); + } + } diff --git a/src/test/com/jogamp/openal/test/android/OpenALTestActivityLauncher.java b/src/test/com/jogamp/openal/test/android/OpenALTestActivityLauncher.java index 3ebbd80..6f28444 100644 --- a/src/test/com/jogamp/openal/test/android/OpenALTestActivityLauncher.java +++ b/src/test/com/jogamp/openal/test/android/OpenALTestActivityLauncher.java @@ -7,28 +7,28 @@ import com.jogamp.openal.test.android.LauncherUtil.OrderedProperties; public class OpenALTestActivityLauncher extends LauncherUtil.BaseActivityLauncher { static String demo = "com.jogamp.openal.test.android.OpenALTestActivity"; - static String[] sys_pkgs = new String[] { "com.jogamp.common", "com.jogamp.openal" }; + static String[] sys_pkgs = new String[] { "com.jogamp.common", "com.jogamp.openal" }; static String[] usr_pkgs = new String[] { "com.jogamp.openal.test" }; - + @Override public void init() { - final OrderedProperties props = getProperties(); + final OrderedProperties props = getProperties(); props.setProperty("jogamp.debug.JNILibLoader", "true"); props.setProperty("jogamp.debug.NativeLibrary", "true"); props.setProperty("jogamp.debug.NativeLibrary.Lookup", "true"); props.setProperty("jogamp.debug.IOUtil", "true"); } - + @Override public String getActivityName() { return demo; } - + @Override public List<String> getSysPackages() { return Arrays.asList(sys_pkgs); } - + @Override public List<String> getUsrPackages() { return Arrays.asList(usr_pkgs); diff --git a/src/test/com/jogamp/openal/test/junit/ALExtLoopbackDeviceSOFTTest.java b/src/test/com/jogamp/openal/test/junit/ALExtLoopbackDeviceSOFTTest.java index d539d43..c84b4e6 100644 --- a/src/test/com/jogamp/openal/test/junit/ALExtLoopbackDeviceSOFTTest.java +++ b/src/test/com/jogamp/openal/test/junit/ALExtLoopbackDeviceSOFTTest.java @@ -12,6 +12,9 @@ import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runners.MethodSorters; +import com.jogamp.openal.ALCConstants; +import com.jogamp.openal.ALConstants; +import com.jogamp.openal.ALExtConstants; import com.jogamp.openal.ALFactory; import com.jogamp.openal.AL; import com.jogamp.openal.ALC; @@ -37,12 +40,12 @@ public class ALExtLoopbackDeviceSOFTTest extends UITestCase { testAlCLoopbackDeviceSOFTImpl(3, 0.8f); } - void testAlCLoopbackDeviceSOFTImpl(int srcIdx, float expAccuracy) throws UnsupportedAudioFileException, IOException { + void testAlCLoopbackDeviceSOFTImpl(final int srcIdx, final float expAccuracy) throws UnsupportedAudioFileException, IOException { final ALC alc = ALFactory.getALC(); final AL al = ALFactory.getAL(); final ALExt alext = ALFactory.getALExt(); - System.out.println("Available null device OpenAL Extensions:"+alc.alcGetString(null, ALC.ALC_EXTENSIONS)); + System.out.println("Available null device OpenAL Extensions:"+alc.alcGetString(null, ALCConstants.ALC_EXTENSIONS)); if ( !alc.alcIsExtensionPresent(null, "ALC_SOFT_loopback") ) { System.out.println("No extension ALC_SOFT_loopback present"); return; @@ -52,15 +55,15 @@ public class ALExtLoopbackDeviceSOFTTest extends UITestCase { final boolean useShort; if( 0 == srcIdx ) { inputStream = ResourceLocation.getTestStream0(); - fmtChannels = ALExt.AL_MONO_SOFT; - fmtData = ALExt.AL_BYTE_SOFT; + fmtChannels = ALExtConstants.AL_MONO_SOFT; + fmtData = ALExtConstants.AL_BYTE_SOFT; sampleSize = 8; channelCount = 1; useShort = false; } else if( 3 == srcIdx ) { inputStream = ResourceLocation.getTestStream3(); - fmtChannels = ALExt.AL_STEREO_SOFT; - fmtData = ALExt.AL_SHORT_SOFT; + fmtChannels = ALExtConstants.AL_STEREO_SOFT; + fmtData = ALExtConstants.AL_SHORT_SOFT; sampleSize = 16; channelCount = 2; useShort = true; @@ -99,18 +102,18 @@ public class ALExtLoopbackDeviceSOFTTest extends UITestCase { Assert.assertTrue("Not supported: "+msg, supported); context = alc.alcCreateContext(dev, new int[]{ - ALExt.ALC_FORMAT_CHANNELS_SOFT, + ALExtConstants.ALC_FORMAT_CHANNELS_SOFT, fmtChannels, - ALExt.ALC_FORMAT_TYPE_SOFT, + ALExtConstants.ALC_FORMAT_TYPE_SOFT, fmtData, - ALC.ALC_FREQUENCY, + ALCConstants.ALC_FREQUENCY, wd.freq, 0 }, 0); final int alcDevError = alc.alcGetError(dev); System.err.printf("CreatedSoftContext: alcError 0x%X, context %s%n", alcDevError, context); - } catch (Exception e) { + } catch (final Exception e) { ex = e; } assertNull(ex); @@ -120,26 +123,26 @@ public class ALExtLoopbackDeviceSOFTTest extends UITestCase { try { final int dataSize = Math.min(4096, wd.size); - int[] source = { 0 }; + final int[] source = { 0 }; al.alGenSources(1, source, 0); - assertEquals("Could not gen source", AL.AL_NO_ERROR, al.alGetError()); + assertEquals("Could not gen source", ALConstants.AL_NO_ERROR, al.alGetError()); final int[] buffer = new int[1]; final int[] tmp = new int[1]; al.alGenBuffers(1, buffer, 0); - assertEquals("Could not generate AL buffer", AL.AL_NO_ERROR, al.alGetError()); + assertEquals("Could not generate AL buffer", ALConstants.AL_NO_ERROR, al.alGetError()); al.alBufferData(buffer[0], wd.format, wd.data, dataSize, wd.freq); - assertEquals("Could not fill AL source buffer "+buffer[0]+", sz "+dataSize+", "+wd.data, AL.AL_NO_ERROR, al.alGetError()); - al.alGetBufferi(buffer[0], AL.AL_SIZE, tmp, 0); - assertEquals("Could not get buffer size "+buffer[0], AL.AL_NO_ERROR, al.alGetError()); + assertEquals("Could not fill AL source buffer "+buffer[0]+", sz "+dataSize+", "+wd.data, ALConstants.AL_NO_ERROR, al.alGetError()); + al.alGetBufferi(buffer[0], ALConstants.AL_SIZE, tmp, 0); + assertEquals("Could not get buffer size "+buffer[0], ALConstants.AL_NO_ERROR, al.alGetError()); System.err.println("Buffer size "+tmp[0]+" of "+dataSize); - al.alSourcei(source[0], AL.AL_BUFFER, buffer[0]); - assertEquals("Could source buffer "+buffer[0], AL.AL_NO_ERROR, al.alGetError()); + al.alSourcei(source[0], ALConstants.AL_BUFFER, buffer[0]); + assertEquals("Could source buffer "+buffer[0], ALConstants.AL_NO_ERROR, al.alGetError()); al.alSourcePlay(source[0]); - assertEquals("Could not play source "+source[0], AL.AL_NO_ERROR, al.alGetError()); + assertEquals("Could not play source "+source[0], ALConstants.AL_NO_ERROR, al.alGetError()); final ByteBuffer bbSink = ByteBuffer.allocateDirect(dataSize).order(wd.data.order()); @@ -150,7 +153,7 @@ public class ALExtLoopbackDeviceSOFTTest extends UITestCase { try { final int samplesPerChannel = dataSize / ( ( sampleSize / 8 ) * channelCount ); alext.alcRenderSamplesSOFT(dev, bbSink, samplesPerChannel); - } catch (Exception e) { + } catch (final Exception e) { ex = e; } assertNull(ex); @@ -222,7 +225,7 @@ public class ALExtLoopbackDeviceSOFTTest extends UITestCase { System.out.println("end testAlCLoopbackDeviceSOFT"); } - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { dumpSamples = true; org.junit.runner.JUnitCore.main(ALExtLoopbackDeviceSOFTTest.class.getName()); } diff --git a/src/test/com/jogamp/openal/test/junit/ALutWAVLoaderTest.java b/src/test/com/jogamp/openal/test/junit/ALutWAVLoaderTest.java index 9a9eaef..29035da 100644 --- a/src/test/com/jogamp/openal/test/junit/ALutWAVLoaderTest.java +++ b/src/test/com/jogamp/openal/test/junit/ALutWAVLoaderTest.java @@ -23,11 +23,11 @@ public class ALutWAVLoaderTest extends UITestCase { @Test public void testALutLoadWAVFileStream() throws IOException { // variables to load into - int[] format = new int[1]; - int[] size = new int[1]; - ByteBuffer[] data = new ByteBuffer[1]; - int[] freq = new int[1]; - int[] loop = new int[1]; + final int[] format = new int[1]; + final int[] size = new int[1]; + final ByteBuffer[] data = new ByteBuffer[1]; + final int[] freq = new int[1]; + final int[] loop = new int[1]; ALut.alutLoadWAVFile(ResourceLocation.getTestStream0(), format, data, size, freq, loop); System.out.println("*** ALut.alutLoadWAV Stream0 size "+size[0]); @@ -41,19 +41,19 @@ public class ALutWAVLoaderTest extends UITestCase { @Test public void testWAVDataLoadStream() throws IOException { - WAVData wd0 = WAVData.loadFromStream(ResourceLocation.getTestStream0(), ResourceLocation.getTestStream0Size(), 1, 8, 22050, ByteOrder.LITTLE_ENDIAN, true); + final WAVData wd0 = WAVData.loadFromStream(ResourceLocation.getTestStream0(), ResourceLocation.getTestStream0Size(), 1, 8, 22050, ByteOrder.LITTLE_ENDIAN, true); System.out.println("*** WAVData.loadFrom Stream0 size "+wd0.data.limit()); assertEquals(wd0.data.limit(), ResourceLocation.getTestStream0Size()); - WAVData wd1 = WAVData.loadFromStream(ResourceLocation.getTestStream1(), ResourceLocation.getTestStream1Size(), 2, 16, 44100, ByteOrder.BIG_ENDIAN, true); + final WAVData wd1 = WAVData.loadFromStream(ResourceLocation.getTestStream1(), ResourceLocation.getTestStream1Size(), 2, 16, 44100, ByteOrder.BIG_ENDIAN, true); System.out.println("*** WAVData.loadFrom Stream1 size "+wd1.data.limit()); assertEquals(wd1.data.limit(), ResourceLocation.getTestStream1Size()); - WAVData wd2 = WAVData.loadFromStream(ResourceLocation.getTestStream2(), ResourceLocation.getTestStream2Size(), 2, 16, 44100, ByteOrder.LITTLE_ENDIAN, true); + final WAVData wd2 = WAVData.loadFromStream(ResourceLocation.getTestStream2(), ResourceLocation.getTestStream2Size(), 2, 16, 44100, ByteOrder.LITTLE_ENDIAN, true); System.out.println("*** WAVData.loadFrom Stream2 size "+wd2.data.limit()); assertEquals(wd2.data.limit(), ResourceLocation.getTestStream2Size()); - WAVData wd3 = WAVData.loadFromStream(ResourceLocation.getTestStream3(), ResourceLocation.getTestStream3Size(), 2, 16, 44100, ByteOrder.LITTLE_ENDIAN, true); + final WAVData wd3 = WAVData.loadFromStream(ResourceLocation.getTestStream3(), ResourceLocation.getTestStream3Size(), 2, 16, 44100, ByteOrder.LITTLE_ENDIAN, true); System.out.println("*** WAVData.loadFrom Stream3 size "+wd3.data.limit()); assertEquals(wd3.data.limit(), ResourceLocation.getTestStream3Size()); @@ -61,18 +61,18 @@ public class ALutWAVLoaderTest extends UITestCase { @Test public void testWAVLoaderLoadStream() throws IOException { - WAVData wd0 = WAVLoader.loadFromStream(ResourceLocation.getTestStream0()); + final WAVData wd0 = WAVLoader.loadFromStream(ResourceLocation.getTestStream0()); System.out.println("*** WAVLoader.loadFrom Stream0 size "+wd0.data.limit()); Assert.assertTrue("Stream0 size "+ResourceLocation.getTestStream0Size()+" < "+wd0.data.limit(), wd0.data.limit() <= ResourceLocation.getTestStream0Size()); - WAVData wd3 = WAVLoader.loadFromStream(ResourceLocation.getTestStream3()); + final WAVData wd3 = WAVLoader.loadFromStream(ResourceLocation.getTestStream3()); System.out.println("*** WAVLoader.loadFrom Stream3 size "+wd3.data.limit()); Assert.assertTrue("Stream3 size "+ResourceLocation.getTestStream3Size()+" < "+wd3.data.limit()+" .. "+wd3.data, wd3.data.limit() <= ResourceLocation.getTestStream3Size()); } // TODO test * LoadFile - public static void main(String args[]) throws IOException { + public static void main(final String args[]) throws IOException { org.junit.runner.JUnitCore.main(ALutWAVLoaderTest.class.getName()); } } diff --git a/src/test/com/jogamp/openal/test/manual/OpenALTest.java b/src/test/com/jogamp/openal/test/manual/OpenALTest.java index eac1d46..1981326 100644 --- a/src/test/com/jogamp/openal/test/manual/OpenALTest.java +++ b/src/test/com/jogamp/openal/test/manual/OpenALTest.java @@ -42,9 +42,11 @@ import com.jogamp.openal.AL; import com.jogamp.openal.ALC; import com.jogamp.openal.ALCcontext; import com.jogamp.openal.ALCdevice; +import com.jogamp.openal.ALConstants; import com.jogamp.openal.ALFactory; import com.jogamp.openal.UnsupportedAudioFileException; import com.jogamp.openal.eax.EAX; +import com.jogamp.openal.eax.EAXConstants; import com.jogamp.openal.eax.EAXFactory; import com.jogamp.openal.test.resources.ResourceLocation; import com.jogamp.openal.util.WAVData; @@ -59,10 +61,10 @@ public class OpenALTest { private AL al = null; private int[] sources = null; private boolean initialized = false; - - public OpenALTest() { + + public OpenALTest() { } - + public void init() throws UnsupportedAudioFileException, IOException { if( initialized ) { return; @@ -71,12 +73,12 @@ public class OpenALTest { device = alc.alcOpenDevice(null); context = alc.alcCreateContext(device, null); alc.alcMakeContextCurrent(context); - al = ALFactory.getAL(); + al = ALFactory.getAL(); System.out.println("output devices:"); { final String[] outDevices = alc.alcGetDeviceSpecifiers(); if( null != outDevices ) { - for (String name : outDevices) { + for (final String name : outDevices) { System.out.println(" "+name); } } @@ -85,47 +87,47 @@ public class OpenALTest { { final String[] inDevices = alc.alcGetCaptureDeviceSpecifiers(); if( null != inDevices ) { - for (String name : inDevices) { + for (final String name : inDevices) { System.out.println(" "+name); } } } - boolean eaxPresent = al.alIsExtensionPresent("EAX2.0"); - EAX eax = ( eaxPresent ) ? EAXFactory.getEAX() : null; + final boolean eaxPresent = al.alIsExtensionPresent("EAX2.0"); + final EAX eax = ( eaxPresent ) ? EAXFactory.getEAX() : null; System.err.println("EAX present:" + eaxPresent + ", EAX retrieved: "+ (null != eax)); - int[] buffers = new int[1]; + final int[] buffers = new int[1]; al.alGenBuffers(1, buffers, 0); // WAVData wd = WAVData.loadFromStream(ResourceLocation.getTestStream0(), ResourceLocation.getTestStream0Size(), 1, 8, 22050, ByteOrder.LITTLE_ENDIAN, true); // WAVData wd = WAVData.loadFromStream(ResourceLocation.getTestStream1(), ResourceLocation.getTestStream1Size(), 2, 16, 44100, ByteOrder.BIG_ENDIAN, true); - WAVData wd = WAVData.loadFromStream(ResourceLocation.getTestStream2(), ResourceLocation.getTestStream2Size(), 2, 16, 44100, ByteOrder.LITTLE_ENDIAN, true); + final WAVData wd = WAVData.loadFromStream(ResourceLocation.getTestStream2(), ResourceLocation.getTestStream2Size(), 2, 16, 44100, ByteOrder.LITTLE_ENDIAN, true); // WAVData wd = WAVData.loadFromStream(ResourceLocation.getTestStream3(), ResourceLocation.getTestStream3Size(), 2, 16, 44100, ByteOrder.LITTLE_ENDIAN, true); System.out.println("*** size "+wd.data.limit()); - + al.alBufferData(buffers[0], wd.format, wd.data, wd.size, wd.freq); - + sources = new int[1]; al.alGenSources(1, sources, 0); - al.alSourcei(sources[0], AL.AL_BUFFER, buffers[0]); + al.alSourcei(sources[0], ALConstants.AL_BUFFER, buffers[0]); - int[] loopArray = new int[1]; - al.alGetSourcei(sources[0], AL.AL_LOOPING, loopArray, 0); - System.err.println("Looping 1: " + (loopArray[0] == AL.AL_TRUE)); + final int[] loopArray = new int[1]; + al.alGetSourcei(sources[0], ALConstants.AL_LOOPING, loopArray, 0); + System.err.println("Looping 1: " + (loopArray[0] == ALConstants.AL_TRUE)); - int[] loopBuffer = new int[1]; - al.alGetSourcei(sources[0], AL.AL_LOOPING, loopBuffer, 0); - System.err.println("Looping 2: " + (loopBuffer[0] == AL.AL_TRUE)); + final int[] loopBuffer = new int[1]; + al.alGetSourcei(sources[0], ALConstants.AL_LOOPING, loopBuffer, 0); + System.err.println("Looping 2: " + (loopBuffer[0] == ALConstants.AL_TRUE)); if (eaxPresent && null!=eax) { - IntBuffer env = Buffers.newDirectIntBuffer(1); - env.put(EAX.EAX_ENVIRONMENT_BATHROOM); - eax.setListenerProperty(EAX.DSPROPERTY_EAXLISTENER_ENVIRONMENT, env); + final IntBuffer env = Buffers.newDirectIntBuffer(1); + env.put(EAXConstants.EAX_ENVIRONMENT_BATHROOM); + eax.setListenerProperty(EAXConstants.DSPROPERTY_EAXLISTENER_ENVIRONMENT, env); } initialized = true; } - + public void play() { if( !initialized ) { return; @@ -134,31 +136,31 @@ public class OpenALTest { al.alSourceRewind(sources[0]); al.alSourcePlay(sources[0]); } - - public void play3f(float x, float y, float z) { + + public void play3f(final float x, final float y, final float z) { if( !initialized ) { return; } System.out.println("play3f "+x+", "+y+", "+z); al.alSourceRewind(sources[0]); al.alSourcePlay(sources[0]); - al.alSource3f(sources[0], AL.AL_POSITION, x, y, z); + al.alSource3f(sources[0], ALConstants.AL_POSITION, x, y, z); } - + public void pause() { if( !initialized ) { return; } al.alSourcePause(sources[0]); } - + public void dispose() { if( !initialized ) { return; } if( null != sources ) { al.alSourceStop(sources[0]); - al.alDeleteSources(1, sources, 0); + al.alDeleteSources(1, sources, 0); sources = null; } if( null != context ) { @@ -171,11 +173,11 @@ public class OpenALTest { } initialized = false; } - - public static void main(String[] args) throws InterruptedException, UnsupportedAudioFileException, IOException { - OpenALTest demo = new OpenALTest(); + + public static void main(final String[] args) throws InterruptedException, UnsupportedAudioFileException, IOException { + final OpenALTest demo = new OpenALTest(); demo.init(); - + demo.play(); Thread.sleep(5000); @@ -187,7 +189,7 @@ public class OpenALTest { demo.play3f(0f, 0f, 0f); Thread.sleep(5000); - + demo.dispose(); } } diff --git a/src/test/com/jogamp/openal/test/manual/Sound3DTest.java b/src/test/com/jogamp/openal/test/manual/Sound3DTest.java index 35bc602..27a4baa 100644 --- a/src/test/com/jogamp/openal/test/manual/Sound3DTest.java +++ b/src/test/com/jogamp/openal/test/manual/Sound3DTest.java @@ -48,27 +48,27 @@ import com.jogamp.openal.test.resources.ResourceLocation; */ public class Sound3DTest { - public static float lerp(float v1, float v2, float t) { + public static float lerp(final float v1, final float v2, final float t) { float result = 0; result = v1 + ((v2 - v1) * t); return result; } - public static void main(String[] args) throws IOException, InterruptedException, UnsupportedAudioFileException { + public static void main(final String[] args) throws IOException, InterruptedException, UnsupportedAudioFileException { AudioSystem3D.init(); // create the initial context - this can be collapsed into the init. - Device device = AudioSystem3D.openDevice(null); - Context context = AudioSystem3D.createContext(device); + final Device device = AudioSystem3D.openDevice(null); + final Context context = AudioSystem3D.createContext(device); AudioSystem3D.makeContextCurrent(context); // get the listener object - Listener listener = AudioSystem3D.getListener(); + final Listener listener = AudioSystem3D.getListener(); listener.setPosition(0, 0, 0); // load a source and play it - Source source1 = AudioSystem3D.loadSource(ResourceLocation.getTestStream0()); + final Source source1 = AudioSystem3D.loadSource(ResourceLocation.getTestStream0()); source1.setPosition(0, 0, 0); source1.setLooping(true); source1.play(); @@ -80,16 +80,16 @@ public class Sound3DTest { // move the listener for (int i = 0; i < 1000; i++) { - float t = ((float) i) / 1000f; - float lp = lerp(0f, 2f, t); + final float t = (i) / 1000f; + final float lp = lerp(0f, 2f, t); listener.setPosition(lp, lp, lp); Thread.sleep(10); } // fade listener out. for (int i = 0; i < 1000; i++) { - float t = ((float) i) / 1000f; - float lp = lerp(1f, 0f, t); + final float t = (i) / 1000f; + final float lp = lerp(1f, 0f, t); listener.setGain(lp); Thread.sleep(10); } diff --git a/src/test/com/jogamp/openal/test/resources/ResourceLocation.java b/src/test/com/jogamp/openal/test/resources/ResourceLocation.java index ba4ea99..f872d1d 100644 --- a/src/test/com/jogamp/openal/test/resources/ResourceLocation.java +++ b/src/test/com/jogamp/openal/test/resources/ResourceLocation.java @@ -22,7 +22,7 @@ public class ResourceLocation { /** CDR 44100Hz, 2 channels, S16_LE */ public static final String aa_wav = "aa.wav"; public static final int aa_wav_size = 846748; - + static final ResourceLocation rl; static { @@ -37,21 +37,21 @@ public class ResourceLocation { public static int getTestStream0Size() { return lewiscarrol_wav_size; } - /** CDR 44100Hz, 2 channels, S16_BE */ + /** CDR 44100Hz, 2 channels, S16_BE */ public static InputStream getTestStream1() { return getInputStream(aa_cdr, true); } public static int getTestStream1Size() { return aa_cdr_size; } - /** CDR 44100Hz, 2 channels, S16_LE */ + /** CDR 44100Hz, 2 channels, S16_LE */ public static InputStream getTestStream2() { return getInputStream(aa_cd, true); } public static int getTestStream2Size() { return aa_cd_size; } - /** WAV 44100Hz, 2 channels, S16_LE */ + /** WAV 44100Hz, 2 channels, S16_LE */ public static InputStream getTestStream3() { return getInputStream(aa_wav, true); } @@ -59,24 +59,24 @@ public class ResourceLocation { return aa_wav_size; } - public static InputStream getInputStream(String fileName) { + public static InputStream getInputStream(final String fileName) { return getInputStream(fileName, false); } - public static InputStream getInputStream(String fileName, boolean throwException) { - URLConnection conn = IOUtil.getResource(rl.getClass(), fileName); + public static InputStream getInputStream(final String fileName, final boolean throwException) { + final URLConnection conn = IOUtil.getResource(rl.getClass(), fileName); if (conn == null) { return null; } InputStream stream = null; try { stream = new BufferedInputStream(conn.getInputStream()); - } catch (IOException e) { + } catch (final IOException e) { if(throwException && null == stream) { throw new RuntimeException("File '"+fileName+"' not found: "+e.getMessage()); } else { System.err.println("File '"+fileName+"' not found"); - e.printStackTrace(); + e.printStackTrace(); } } return stream; diff --git a/src/test/com/jogamp/openal/test/util/UITestCase.java b/src/test/com/jogamp/openal/test/util/UITestCase.java index 73e6925..72659f0 100644 --- a/src/test/com/jogamp/openal/test/util/UITestCase.java +++ b/src/test/com/jogamp/openal/test/util/UITestCase.java @@ -78,7 +78,7 @@ public abstract class UITestCase { return testSupported; } - public static void setTestSupported(boolean v) { + public static void setTestSupported(final boolean v) { System.err.println("setTestSupported: "+v); testSupported = v; } @@ -88,7 +88,7 @@ public abstract class UITestCase { int ml = 0; final TestClass tc = new TestClass(getClass()); final List<FrameworkMethod> testMethods = tc.getAnnotatedMethods(org.junit.Test.class); - for(Iterator<FrameworkMethod> iter=testMethods.iterator(); iter.hasNext(); ) { + for(final Iterator<FrameworkMethod> iter=testMethods.iterator(); iter.hasNext(); ) { final int l = iter.next().getName().length(); if( ml < l ) { ml = l; } } @@ -101,11 +101,11 @@ public abstract class UITestCase { return _unitTestName.getMethodName(); } - public final String getSimpleTestName(String separator) { + public final String getSimpleTestName(final String separator) { return getClass().getSimpleName()+separator+getTestMethodName(); } - public final String getFullTestName(String separator) { + public final String getFullTestName(final String separator) { return getClass().getName()+separator+getTestMethodName(); } @@ -137,12 +137,12 @@ public abstract class UITestCase { System.err.println("++++ UITestCase.tearDown: "+getFullTestName(" - ")); } - public static void waitForKey(String preMessage) { - BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); + public static void waitForKey(final String preMessage) { + final BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); System.err.println(preMessage+"> Press enter to continue"); try { System.err.println(stdin.readLine()); - } catch (IOException e) { } + } catch (final IOException e) { } } static final String unsupportedTestMsg = "Test not supported on this platform."; |