public class Music extends SoundStream
openFromFile(java.nio.file.Path) or
openFromStream(java.io.InputStream) methods.
The supported audio file formats are:
ogg, wav, flac, aiff, au, raw, paf, svx, nist, voc, ircam, w64, mat4,
mat5 pvf, htk, sds, avr, sd2, caf, wve, mpc2k, rf64SoundStream.ChunkSoundSource.Status| Constructor and Description |
|---|
Music()
Constructs a music.
|
| Modifier and Type | Method and Description |
|---|---|
Time |
getDuration()
Gets the total duration of the music.
|
protected void |
initialize(int channelCount,
int sampleRate)
Defines the audio stream parameters.
|
protected long |
nativeCreate()
Deprecated.
|
protected void |
nativeDelete()
Deprecated.
|
protected void |
nativeSetExPtr()
Deprecated.
|
protected SoundStream.Chunk |
onGetData()
Requests a new chunk of audio data.
|
protected void |
onSeek(Time time)
Re-positions the stream's current playing offset.
|
void |
openFromFile(Path path)
Attempts to open the music from a file.
|
void |
openFromStream(InputStream in)
Attempts to open the music from an
InputStream. |
getChannelCount, getPlayingOffset, getSampleRate, getStatus, isLoop, pause, play, setLoop, setPlayingOffset, stopgetAttenuation, getMinDistance, getPitch, getPosition, getVolume, isRelativeToListener, setAttenuation, setMinDistance, setPitch, setPosition, setPosition, setRelativeToListener, setVolumefinalize@Deprecated protected long nativeCreate()
SFMLNativeObjectnativeCreate in class SoundStream@Deprecated protected void nativeSetExPtr()
SFMLNativeObjectnativeSetExPtr in class SoundStream@Deprecated protected void nativeDelete()
SFMLNativeObjectnativeDelete in class SoundStreampublic void openFromStream(InputStream in) throws IOException
InputStream.in - the input stream to stream from.IOException - in case an I/O error occurs.public void openFromFile(Path path) throws IOException
path - the file to stream from.IOException - in case an I/O error occurs.public Time getDuration()
protected final void initialize(int channelCount,
int sampleRate)
SoundStreaminitialize in class SoundStreamchannelCount - the amount of audio channels (e.g. 1 for mono, 2 for stereo).sampleRate - the sample rate in samples per second.protected final SoundStream.Chunk onGetData()
SoundStreamonGetData in class SoundStreamSoundStream.isLoop() returns true.
To stop playback immediately, null may be returned.SoundStream.Chunkprotected final void onSeek(Time time)
SoundStreamSoundStream.setPlayingOffset(org.jsfml.system.Time).
Note that this method will be called within a separate playback thread.onSeek in class SoundStreamtime - the time offset to jump to.