public abstract class SoundStream extends SoundSource
SoundStream.Chunk
Modifier and Type | Class and Description |
---|---|
static class |
SoundStream.Chunk
Represents a chunk of audio data provided by a
SoundStream when
new data is requested. |
SoundSource.Status
Constructor and Description |
---|
SoundStream()
Constructs a sound stream.
|
Modifier and Type | Method and Description |
---|---|
int |
getChannelCount()
Gets the amount of audio channels of this stream.
|
Time |
getPlayingOffset()
Gets the playing offset at which to play from the stream.
|
int |
getSampleRate()
Gets the sample rate of this stream.
|
SoundSource.Status |
getStatus()
Gets the current state of the sound stream.
|
protected void |
initialize(int channelCount,
int sampleRate)
Defines the audio stream parameters.
|
boolean |
isLoop()
Returns whether or not the sound stream playback is looping.
|
protected long |
nativeCreate()
Deprecated.
|
protected void |
nativeDelete()
Deprecated.
|
protected void |
nativeSetExPtr()
Deprecated.
|
protected abstract SoundStream.Chunk |
onGetData()
Requests a new chunk of audio data.
|
protected abstract void |
onSeek(Time time)
Re-positions the stream's current playing offset.
|
void |
pause()
Pauses playback of the stream if it is currently playing.
|
void |
play()
Starts playing the stream or resumes it if it is currently paused.
|
void |
setLoop(boolean loop)
Enables or disables repeated looping of the sound stream playback.
|
void |
setPlayingOffset(Time offset)
Sets the current playing offset at which to play from the stream.
|
void |
stop()
Stops playing the stream.
|
getAttenuation, getMinDistance, getPitch, getPosition, getVolume, isRelativeToListener, setAttenuation, setMinDistance, setPitch, setPosition, setPosition, setRelativeToListener, setVolume
finalize
@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 int getChannelCount()
public int getSampleRate()
public final void setPlayingOffset(Time offset)
offset
- the playing offset at which to play from the stream.public Time getPlayingOffset()
public void setLoop(boolean loop)
setPlayingOffset(Time.ZERO)
was invoked.loop
- true
to enable looping, false
to disable.public boolean isLoop()
setPlayingOffset(Time.ZERO)
was invoked.true
if it is looping, false
if not.public SoundSource.Status getStatus()
SoundSource
getStatus
in class SoundSource
protected void initialize(int channelCount, int sampleRate)
channelCount
- the amount of audio channels (e.g. 1 for mono, 2 for stereo).sampleRate
- the sample rate in samples per second.protected abstract SoundStream.Chunk onGetData()
isLoop()
returns true
.
To stop playback immediately, null
may be returned.SoundStream.Chunk
protected abstract void onSeek(Time time)
setPlayingOffset(org.jsfml.system.Time)
.
Note that this method will be called within a separate playback thread.time
- the time offset to jump to.