public abstract class SoundSource extends SFMLNativeObject
Modifier and Type | Class and Description |
---|---|
static class |
SoundSource.Status
Enumeration of possible sound source states.
|
Constructor and Description |
---|
SoundSource()
Constructs a sound source.
|
Modifier and Type | Method and Description |
---|---|
float |
getAttenuation()
Gets the sound's attenuation factor.
|
float |
getMinDistance()
Gets the sound's minimum distance from the
Listener before attenuation sets in. |
float |
getPitch()
Gets the sound's current pitch factor.
|
Vector3f |
getPosition()
Gets the sound's current position in the scene.
|
protected SoundSource.Status |
getStatus()
Gets the current state of the sound stream.
|
float |
getVolume()
Gets the sound's current volume.
|
boolean |
isRelativeToListener()
Returns whether the sound's position is relative to the
Listener . |
void |
setAttenuation(float att)
Sets the sound's attenuation factor.
|
void |
setMinDistance(float distance)
Sets the minimum distance of the sound before attenuation kicks in.
|
void |
setPitch(float pitch)
Sets the pitch factor of the sound.
|
void |
setPosition(float x,
float y,
float z)
Sets the position of the sound in the scene.
|
void |
setPosition(Vector3f v)
Sets the position of the sound in the scene.
|
void |
setRelativeToListener(boolean relative)
Determines whether the sound position is bound to be relative to the
Listener
or whether it is positioned absolutely in the scene. |
void |
setVolume(float volume)
Sets the volume of the sound.
|
finalize, nativeCreate, nativeDelete, nativeSetExPtr
public void setPitch(float pitch)
pitch
- the new pitch factor of the sound.public void setVolume(float volume)
volume
- the new volume of the sound, ranging between 0 and 100.public final void setPosition(float x, float y, float z)
Listener
.
The sound position is set either absolutely in the scene or relatively to the
Listener
, depending on whether isRelativeToListener()
is
true
or false
.
By default, a sound is located at the origin (0, 0, 0)
.
Note that only mono sounds (ie 1 audio channel) can be spatialized.x
- the sound's new X coordinate.y
- the sound's new Y coordinate.z
- the sound's new Z coordinate.setRelativeToListener(boolean)
public void setPosition(Vector3f v)
Listener
.
The sound position is set either absolutely in the scene or relatively to the
Listener
, depending on whether isRelativeToListener()
is
true
or false
.
By default, a sound is located at the origin (0, 0, 0)
.
Note that only mono sounds (ie 1 audio channel) can be spatialized.v
- the sound's new position.setRelativeToListener(boolean)
public void setRelativeToListener(boolean relative)
Listener
or whether it is positioned absolutely in the scene.
By default, the sound's position in the scene is absolute.relative
- true
to make the sound position relative to the listener,
false
to make it absolute.setPosition(float, float, float)
public void setMinDistance(float distance)
Listener
is less or equal to this value,
the sound will be heard at its maximum volume. As the distance becomes larger,
the sound is attenuated (ie become more quiet) according to its attenuation factor.
The default minimum distance is 1.distance
- the minimum distance before attenuation in world units.setAttenuation(float)
public void setAttenuation(float att)
Listener
becomes higher than the
minimum distance, the sound volume will decrease according to this factor.
The attenuation factor ranges between 0 (no attenuation) and 100 (instant attenuation),
where the default value is 1.att
- the new attenuation factor, ranging between 0 (no attenuation)
and 100 (instant attenuation).setMinDistance(float)
public float getPitch()
public float getVolume()
public Vector3f getPosition()
public boolean isRelativeToListener()
Listener
.true
if the sound's position is relative to the listener, false
if
it is absolute.setRelativeToListener(boolean)
public float getMinDistance()
Listener
before attenuation sets in.setMinDistance(float)
public float getAttenuation()
setAttenuation(float)
protected SoundSource.Status getStatus()