public class Sound extends SoundSource
SoundBuffer
and play a buffered sound.SoundSource.Status
Constructor and Description |
---|
Sound()
Constructs an empty sound.
|
Sound(ConstSoundBuffer soundBuffer)
Constructs a sound with the specified
SoundBuffer |
Sound(Sound other)
Constructs a sound by copying another sound.
|
Modifier and Type | Method and Description |
---|---|
ConstSoundBuffer |
getBuffer()
Gets the underlying sound buffer that this sound plays from.
|
Time |
getPlayingOffset()
Gets the playing offset from where to start playing the underlying buffer.
|
SoundSource.Status |
getStatus()
Gets the current state of the sound stream.
|
boolean |
isLoop()
Returns whether or not the sound is looping.
|
protected long |
nativeCreate()
Deprecated.
|
protected void |
nativeDelete()
Deprecated.
|
protected void |
nativeSetExPtr()
Deprecated.
|
void |
pause()
Pauses the sound if it is currently playing.
|
void |
play()
Starts playing the sound or resumes it if it is currently paused.
|
void |
setBuffer(ConstSoundBuffer soundBuffer)
Sets the sound buffer used by this sound.
|
void |
setLoop(boolean loop)
Enables or disables repeated looping of the sound.
|
void |
setPlayingOffset(Time offset)
Sets the playing offset from where to play the underlying buffer.
|
void |
stop()
Stops the sound if it is currently playing or paused.
|
getAttenuation, getMinDistance, getPitch, getPosition, getVolume, isRelativeToListener, setAttenuation, setMinDistance, setPitch, setPosition, setPosition, setRelativeToListener, setVolume
finalize
public Sound()
public Sound(ConstSoundBuffer soundBuffer)
SoundBuffer
soundBuffer
- the sound buffer to use.public Sound(Sound other)
other
- the sound to copy.@Deprecated protected long nativeCreate()
SFMLNativeObject
nativeCreate
in class SFMLNativeObject
@Deprecated protected void nativeSetExPtr()
SFMLNativeObject
nativeSetExPtr
in class SFMLNativeObject
@Deprecated protected void nativeDelete()
SFMLNativeObject
nativeDelete
in class SFMLNativeObject
public void play()
public void pause()
public void stop()
public void setBuffer(ConstSoundBuffer soundBuffer)
soundBuffer
- the new sound buffer.public void setLoop(boolean loop)
true
and the sound has finished playing, it will
be restarted from the beginning as if setPlayingOffset(Time.ZERO)
was called.loop
- true
to enable looping, false
to disable.public void setPlayingOffset(Time offset)
offset
- the playing offset in the underlaying buffer.public ConstSoundBuffer getBuffer()
public boolean isLoop()
true
if this sound is looping, false
if not.public Time getPlayingOffset()
public SoundSource.Status getStatus()
SoundSource
getStatus
in class SoundSource