|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.jinx.audio.Source
public class Source
The Source class is intended to make the job of implementing the Audible
interface a little easier. Source represents any individual sound source.
Source objects should have their delete() method called when they are
no longer needed and should then be discarded. They should always be deleted
and discarded when an Audible object's deinit() method is called. They
should NEVER be used after that.
This is designed to loosely mimic the Source class of the Sound3D
toolkit, while still allowing low-level access to the OpenAL APIs.
API Stability: Alpha; this is subject to change at any time.
Constructor Summary | |
---|---|
Source(net.java.games.joal.AL al,
net.java.games.joal.ALC alc)
Constructor; allows the construction of an unconfigured Source. |
Method Summary | |
---|---|
int |
buffersProcessed()
Provides the number of Buffers already processed on this Source. |
int |
buffersQueued()
Provides the number of Buffers currently queued on this Source. |
void |
delete()
Frees the resources that this Source consumes. |
protected net.java.games.joal.AL |
getAL()
Provides the AL object that was used to construct this Source. |
protected net.java.games.joal.ALC |
getALC()
Provides the ALC object that was used to construct this Source. |
protected boolean |
getBooleanInt(int pname)
Utility method to use getInt to get a boolean value. |
Buffer |
getBuffer()
Provides the Buffer associated with this Source. |
float |
getConeOuterGain()
Provides the gain outside the oriented cone. |
float[] |
getDirection()
Provides the direction of this Source. |
protected float |
getFloat(int pname)
Utility method to use alGetSourcef(). |
float |
getGain()
Provides the gain for this source. |
protected int |
getInt(int pname)
Utility method to use alGetSourcei(). |
float |
getMaxDistance()
Provides the maximum distance after which there will be no more attenuation of this source. |
float |
getMaxGain()
Provides the maximum gain for this Source. |
float |
getMinGain()
Provides the minimum gain for this Source. |
float |
getPitch()
Provides the current pitch value of this Source. |
float[] |
getPosition()
Provides the position of this Source. |
float |
getReferenceDistance()
Provides the value of the reference distance for this Source. |
float |
getRolloffFactor()
Provides the rolloff factor. |
int |
getSourceID()
Provides the OpenAL name of this Source. |
float[] |
getVelocity()
Provides the velocity of this Source. |
boolean |
isInitialized()
Indicates if this Source is in an initialized state, in which it will function. |
boolean |
isLooping()
Indicates if this Source will loop. |
boolean |
isSourceRelative()
Indicates if this Source is relative to the position the Listener. |
void |
pause()
Pauses this source. |
void |
play()
Begins playing this Source. |
void |
queueBuffer(Buffer buffer)
Queues a Buffer object on this Source. |
void |
queueBuffers(Buffer[] buffers)
Queues an array of Buffer objects on this Source. |
void |
rewind()
Rewinds this source. |
protected void |
setBooleanInt(int pname,
boolean value)
Utility method to use setInt to set a boolean value. |
void |
setBuffer(Buffer buffer)
Sets the Buffer associated with this Source. |
void |
setConeOuterGain(float cog)
Sets the gain outside the oriented cone. |
void |
setDirection(float[] d)
Sets the direction of this Source. |
void |
setDirection(float x,
float y,
float z)
Sets the direction of this Source. |
protected void |
setFloat(int pname,
float value)
Utility method to use alSourcef(). |
void |
setGain(float gain)
Sets the gain for this Source. |
protected void |
setInt(int pname,
int value)
Utility method to use alSourcei(). |
void |
setLooping(boolean loop)
Sets wether or not this Source loops back to the beginning when it finishes. |
void |
setMaxDistance(float max)
Sets the maximum distance after which there will be no more attenuation of this Source. |
void |
setMaxGain(float mg)
Sets the maximum gain for this Source. |
void |
setMinGain(float mg)
Sets the minimum gain for this Source. |
void |
setPitch(float pitch)
Sets the pitch of this Source without affecting the speed of playback. |
void |
setPosition(float[] pos)
Sets the position of this Source. |
void |
setPosition(float x,
float y,
float z)
Sets the position of this Source. |
void |
setReferenceDistance(float rd)
Sets the reference distance; this is the distance where the volume of this Source would normally drop by half before being affected by rolloff factor or maximum distance. |
void |
setRolloffFactor(float rolloff)
Sets the rolloff factor. |
void |
setSourceRelative(boolean sr)
Sets whether or not this Source is relative to the position of the Listener. |
void |
setVelocity(float[] v)
Sets the velocity of this Source. |
void |
setVelocity(float x,
float y,
float z)
Sets the velocity of this Source. |
void |
stop()
Stops this Source. |
void |
unqueueBuffer(Buffer buffer)
Unqueues a Buffer object from this Source. |
void |
unqueueBuffers(Buffer[] buffers)
Unqueues an array of Buffer objects from this Source. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Source(net.java.games.joal.AL al, net.java.games.joal.ALC alc)
al
- the AL object to use for audio rendering.alc
- the ALC object to use for audio rendering.
java.lang.NullPointerException
- will be thrown if either al or alc are null.Method Detail |
---|
public int getSourceID()
public boolean isInitialized()
protected net.java.games.joal.AL getAL()
protected net.java.games.joal.ALC getALC()
public void play()
public void pause()
public void stop()
public void rewind()
protected int getInt(int pname)
pname
- the parameter name.protected void setInt(int pname, int value)
pname
- the parameter name.value
- the value to use to set the parameter.protected void setBooleanInt(int pname, boolean value)
pname
- the parameter name.value
- the value to use to set the parameter.protected boolean getBooleanInt(int pname)
pname
- the parameter name.protected void setFloat(int pname, float value)
pname
- the parameter name.value
- the value to use to set the parameter.protected float getFloat(int pname)
pname
- the parameter name.public void setPitch(float pitch)
pitch
- the new pitch value.public float getPitch()
public void setGain(float gain)
gain
- the new gain value.public float getGain()
public void setMaxDistance(float max)
max
- the new maximum distance.public float getMaxDistance()
public void setRolloffFactor(float rolloff)
rolloff
- the rolloff value.public float getRolloffFactor()
public void setReferenceDistance(float rd)
rd
- the reference distance.public float getReferenceDistance()
public void setMinGain(float mg)
mg
- the mimimum gain.public float getMinGain()
public void setMaxGain(float mg)
mg
- the maximum gain.public float getMaxGain()
public void setConeOuterGain(float cog)
cog
- the value.public float getConeOuterGain()
public void setPosition(float x, float y, float z)
x
- the x value.y
- the y value.z
- the z value.public void setPosition(float[] pos)
pos
- the position as a float array. This must be at least three
elements.public float[] getPosition()
public void setVelocity(float x, float y, float z)
x
- the x value.y
- the y value.z
- the z value.public void setVelocity(float[] v)
v
- the velocity as a float array. This must be at least three
elements.public float[] getVelocity()
public void setDirection(float x, float y, float z)
x
- the x value.y
- the y value.z
- the z value.public void setDirection(float[] d)
d
- the direction as a float array. This must be at least three
elements.public float[] getDirection()
public void setSourceRelative(boolean sr)
sr
- if true, then it will be source relative, false means it isn't.public boolean isSourceRelative()
public void setLooping(boolean loop)
loop
- boolean value for setting this option.public boolean isLooping()
public int buffersQueued()
public int buffersProcessed()
public void setBuffer(Buffer buffer)
buffer
- the Buffer to associate with this Source.public Buffer getBuffer()
public void delete()
public void queueBuffers(Buffer[] buffers)
buffers
- the Buffer objects to queue.public void queueBuffer(Buffer buffer)
buffer
- the Buffer object to queue.public void unqueueBuffers(Buffer[] buffers)
buffers
- the Buffer objects to dequeue.public void unqueueBuffer(Buffer buffer)
buffer
- the Buffer object to dequeue.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |