C# Class SFML.Audio.SoundStream

SoundStream is a streamed sound, ie. samples are acquired while the sound is playing. Use it for big sounds that would require hundreds of MB in memory (see Music), or for streaming sound from the network
Inheritance: SFML.System.ObjectBase
ファイルを表示 Open project: SFML/SFML.Net

Public Methods

Method Description
Pause ( ) : void

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

Play ( ) : void

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.

SoundStream ( ) : System

Default constructor

Stop ( ) : void

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

ToString ( ) : string

Provide a string describing the object

Protected Methods

Method Description
Destroy ( bool disposing ) : void

Handle the destruction of the object

Initialize ( uint channelCount, uint sampleRate ) : void

Set the audio stream parameters, you must call it before Play()

OnGetData ( short &samples ) : bool

Virtual function called each time new audio data is needed to feed the stream

OnSeek ( Time timeOffset ) : void

Virtual function called to seek into the stream

Private Methods

Method Description
GetData ( Chunk &dataChunk, IntPtr userData ) : bool

Called each time new audio data is needed to feed the stream

Seek ( Time timeOffset, IntPtr userData ) : void

Called to seek in the stream

sfSoundStream_create ( GetDataCallbackType OnGetData, SeekCallbackType OnSeek, uint ChannelCount, uint SampleRate, IntPtr UserData ) : IntPtr
sfSoundStream_destroy ( IntPtr SoundStreamStream ) : void
sfSoundStream_getAttenuation ( IntPtr SoundStream ) : float
sfSoundStream_getChannelCount ( IntPtr SoundStream ) : uint
sfSoundStream_getLoop ( IntPtr SoundStream ) : bool
sfSoundStream_getMinDistance ( IntPtr SoundStream ) : float
sfSoundStream_getPitch ( IntPtr SoundStream ) : float
sfSoundStream_getPlayingOffset ( IntPtr SoundStream ) : Time
sfSoundStream_getPosition ( IntPtr SoundStream ) : Vector3f
sfSoundStream_getSampleRate ( IntPtr SoundStream ) : uint
sfSoundStream_getStatus ( IntPtr SoundStream ) : SoundStatus
sfSoundStream_getVolume ( IntPtr SoundStream ) : float
sfSoundStream_isRelativeToListener ( IntPtr SoundStream ) : bool
sfSoundStream_pause ( IntPtr SoundStream ) : void
sfSoundStream_play ( IntPtr SoundStream ) : void
sfSoundStream_setAttenuation ( IntPtr SoundStream, float Attenuation ) : void
sfSoundStream_setLoop ( IntPtr SoundStream, bool Loop ) : void
sfSoundStream_setMinDistance ( IntPtr SoundStream, float MinDistance ) : void
sfSoundStream_setPitch ( IntPtr SoundStream, float Pitch ) : void
sfSoundStream_setPlayingOffset ( IntPtr SoundStream, Time TimeOffset ) : void
sfSoundStream_setPosition ( IntPtr SoundStream, Vector3f position ) : void
sfSoundStream_setRelativeToListener ( IntPtr SoundStream, bool Relative ) : void
sfSoundStream_setVolume ( IntPtr SoundStream, float Volume ) : void
sfSoundStream_stop ( IntPtr SoundStream ) : void

Method Details

Destroy() protected method

Handle the destruction of the object
protected Destroy ( bool disposing ) : void
disposing bool Is the GC disposing the object, or is it an explicit call ?
return void

Initialize() protected method

Set the audio stream parameters, you must call it before Play()
protected Initialize ( uint channelCount, uint sampleRate ) : void
channelCount uint Number of channels
sampleRate uint Sample rate, in samples per second
return void

OnGetData() protected abstract method

Virtual function called each time new audio data is needed to feed the stream
protected abstract OnGetData ( short &samples ) : bool
samples short Array of samples to fill for the stream
return bool

OnSeek() protected abstract method

Virtual function called to seek into the stream
protected abstract OnSeek ( Time timeOffset ) : void
timeOffset Time New position
return void

Pause() public method

Pause the audio stream. This function pauses the stream if it was playing, otherwise (stream already paused or stopped) it has no effect.
public Pause ( ) : void
return void

Play() public method

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.
public Play ( ) : void
return void

SoundStream() public method

Default constructor
public SoundStream ( ) : System
return System

Stop() public method

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()).
public Stop ( ) : void
return void

ToString() public method

Provide a string describing the object
public ToString ( ) : string
return string