summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/openal/sound3d
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-07-03 16:27:25 +0200
committerSven Gothel <[email protected]>2014-07-03 16:27:25 +0200
commit0430708fbcbdc5572affb45318eb782adffd13f1 (patch)
tree61ac401ea90e07ae0a7ac639da1e6a240f1b87cd /src/java/com/jogamp/openal/sound3d
parent21cd5206625aaa8914e53bdfaab8e7ae4e497a08 (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
Diffstat (limited to 'src/java/com/jogamp/openal/sound3d')
-rw-r--r--src/java/com/jogamp/openal/sound3d/AudioSystem3D.java72
-rw-r--r--src/java/com/jogamp/openal/sound3d/Buffer.java33
-rw-r--r--src/java/com/jogamp/openal/sound3d/Context.java14
-rw-r--r--src/java/com/jogamp/openal/sound3d/Device.java12
-rw-r--r--src/java/com/jogamp/openal/sound3d/Listener.java63
-rw-r--r--src/java/com/jogamp/openal/sound3d/Source.java187
-rw-r--r--src/java/com/jogamp/openal/sound3d/Vec3f.java12
7 files changed, 198 insertions, 195 deletions
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;