Struct sfml::audio::SoundStreamPlayer [] [src]

pub struct SoundStreamPlayer<'a, S: SoundStream + 'a> { /* fields omitted */ }

Player for custom streamed audio sources. See SoundStream.

Methods

impl<'a, S: SoundStream> SoundStreamPlayer<'a, S>
[src]

[src]

Create a new SoundStreamPlayer with the specified SoundStream.

[src]

Start or resume playing the audio stream.

[src]

Pause the audio stream.

This function pauses the stream if it was playing, otherwise (stream already paused or stopped) it has no effect.

[src]

Get the current status of the stream (stopped, paused, playing)

[src]

Stop playing, lending out the underlying SoundStream.

This function stops the stream if it was playing or paused, and does nothing if it was already stopped. It also resets the playing position (unlike pause()).

It lends out the underlying SoundStream, allowing it to be manipulated.

Example

Be careful when using this code, it's not being tested!
let mut music_stream = MusicStream::load("cool_song.ogg");
let mut player = SoundStreamPlayer::new(&mut music_stream);
player.play();
// ...
// Let's say we want to change the song being played.
// We can't just simply reassign `music_stream`, since it's being borrowed by `player`.
// Manipulating the stream while it's being played is _unsafe_, so it's not allowed.
//
// Instead, let's stop the player first, reassign the stream, then restart the player.
{
   let stream = player.stop();
   *stream = MusicStream::load("another_cool_song.ogg");
}
player.play();

[src]

Get the current playing position, from the beginning of the stream

[src]

Change the current playing position of the stream.

The playing position can be changed when the stream is either paused or playing. Changing the playing position when the stream is stopped has no effect, since playing the stream would reset its position.

[src]

Return the number of channels of the stream.

1 channel means a mono sound, 2 means stereo, etc.

[src]

Get the stream sample rate of the stream.

The sample rate is the number of audio samples played per second. The higher, the better the quality.

[src]

Tell whether or not the stream is in loop mode.

[src]

Set whether or not the stream should loop after reaching the end.

If set, the stream will restart from beginning after reaching the end and so on, until it is stopped or setLoop(false) is called. The default looping state for streams is false.

Trait Implementations

impl<'a, S: Debug + SoundStream + 'a> Debug for SoundStreamPlayer<'a, S>
[src]

[src]

Formats the value using the given formatter.

impl<'a, S: SoundStream> SoundSource for SoundStreamPlayer<'a, S>
[src]

[src]

Set the pitch of the sound. Read more

[src]

Set the volume of the sound. Read more

[src]

Set the 3D position of the sound in the audio scene. Read more

[src]

Make the sound's position relative to the listener or absolute. Read more

[src]

Set the minimum distance of the sound. Read more

[src]

Set the attenuation factor of the sound. Read more

[src]

Get the pitch of the sound.

[src]

Get the volume of the sound. Read more

[src]

Get the 3D position of the sound in the audio scene.

[src]

Tell whether the sound's position is relative to the listener or is absolute.

[src]

Get the minimum distance of the sound.

[src]

Get the attenuation factor of the sound.

impl<'a, S: SoundStream> Drop for SoundStreamPlayer<'a, S>
[src]

[src]

Executes the destructor for this type. Read more