Class OcsfmlAudio.sound_stream

class sound_stream : ?pitch:float -> ?volume:float -> ?position:float * float * float -> ?relative_to_listener:bool -> ?min_distance:float -> ?attenuation:float -> ?playing_offset:OcsfmlSystem.Time.t -> ?loop:bool -> SoundStream.t -> object .. end
Binding does not support custom streams yet.

Abstract base class for streamed audio sources.

Unlike audio buffers (see sf::SoundBuffer), audio streams are never completely loaded in memory.

Instead, the audio data is acquired continuously while the stream is playing. This behaviour allows to play a sound with no loading delay, and keeps the memory consumption very low.

Sound sources that need to be streamed are usually big files (compressed audio musics that would eat hundreds of MB in memory) or files that would take a lot of time to be received (sounds played over the network).

sf::SoundStream is a base class that doesn't care about the stream source, which is left to the derived class. SFML provides a built-in specialization for big files (see sf::Music).

Inherits
method destroy : unit
method get_channel_count : int
Return the number of channels of the stream.

1 channel means a mono sound, 2 means stereo, etc.
Returns Number of channels

method get_loop : bool
Tell whether or not the stream is in loop mode.
Returns True if the stream is looping, false otherwise.
method get_playing_offset : OcsfmlSystem.Time.t
Get the current playing position of the stream.
Returns Current playing position, from the beginning of the stream.
method get_sample_rate : int
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.
Returns Sample rate, in number of samples per second

method get_status : status
Get the current status of the stream (stopped, paused, playing)
Returns Current status
method pause : unit
Pause the audio stream.

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

method play : unit
Start or resume playing the audio stream.

This function starts the stream if it was stopped, resumes it if it was paused, and restarts it from beginning if it was it already playing. This function uses its own thread so that it doesn't block the rest of the program while the stream is played.

method set_loop : bool -> unit
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.

method set_playing_offset : OcsfmlSystem.Time.t -> unit
Change the current playing position of the stream.

The playing position can be changed when the stream is either paused or playing.

method stop : unit
Stop playing the audio stream.

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()).