Warning
This page refers to an old version of SFML. Click here to switch to the latest version.
Warning
This page refers to an old version of SFML. Click here to switch to the latest version.
SoundStream is a streamed sound, ie samples are acquired while the sound is playing. More...
#include <SFML/Audio/SoundStream.hpp>
Classes | |
| struct | Chunk |
| Structure defining a chunk of audio data to stream. More... | |
Public Types | |
| enum | Status |
| Enumeration of the sound states. More... | |
Public Member Functions | |
| virtual | ~SoundStream () |
| Virtual destructor. | |
| void | Play () |
| Start playing the audio stream. | |
| void | Stop () |
| Stop playing the audio stream. | |
| unsigned int | GetChannelsCount () const |
| Return the number of channels (1 = mono, 2 = stereo). | |
| unsigned int | GetSampleRate () const |
| Get the stream sample rate. | |
| Status | GetStatus () const |
| Get the status of the stream (stopped, paused, playing). | |
| float | GetPlayingOffset () const |
| Get the current playing position of the stream. | |
| void | SetLoop (bool Loop) |
| Set the stream loop state. | |
| bool | GetLoop () const |
| Tell whether or not the stream is looping. | |
| void | Pause () |
| Pause the sound. | |
| void | SetPitch (float Pitch) |
| Set the sound pitch. | |
| void | SetVolume (float Volume) |
| Set the sound volume. | |
| void | SetPosition (float X, float Y, float Z) |
| Set the sound position (take 3 values). | |
| void | SetPosition (const Vector3f &Position) |
| Set the sound position (take a 3D vector). | |
| void | SetRelativeToListener (bool Relative) |
| Make the sound's position relative to the listener's position, or absolute. | |
| void | SetMinDistance (float MinDistance) |
| Set the minimum distance - closer than this distance, the listener will hear the sound at its maximum volume. | |
| void | SetAttenuation (float Attenuation) |
| Set the attenuation factor - the higher the attenuation, the more the sound will be attenuated with distance from listener. | |
| float | GetPitch () const |
| Get the pitch. | |
| float | GetVolume () const |
| Get the volume. | |
| Vector3f | GetPosition () const |
| Get the sound position. | |
| bool | IsRelativeToListener () const |
| Tell if the sound's position is relative to the listener's position, or if it's absolute. | |
| float | GetMinDistance () const |
| Get the minimum distance. | |
| float | GetAttenuation () const |
| Get the attenuation factor. | |
Protected Member Functions | |
| SoundStream () | |
| Default constructor. | |
| void | Initialize (unsigned int ChannelsCount, unsigned int SampleRate) |
| Set the audio stream parameters, you must call it before Play(). | |
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
Definition at line 44 of file SoundStream.hpp.
| enum sf::Sound::Status |
|
virtual |
Virtual destructor.
|
protected |
Default constructor.
| float sf::Sound::GetAttenuation | ( | ) | const |
Get the attenuation factor.
| unsigned int sf::SoundStream::GetChannelsCount | ( | ) | const |
Return the number of channels (1 = mono, 2 = stereo).
| bool sf::SoundStream::GetLoop | ( | ) | const |
Tell whether or not the stream is looping.
| float sf::Sound::GetMinDistance | ( | ) | const |
Get the minimum distance.
| float sf::Sound::GetPitch | ( | ) | const |
Get the pitch.
| float sf::SoundStream::GetPlayingOffset | ( | ) | const |
Get the current playing position of the stream.
| Vector3f sf::Sound::GetPosition | ( | ) | const |
Get the sound position.
| unsigned int sf::SoundStream::GetSampleRate | ( | ) | const |
Get the stream sample rate.
| Status sf::SoundStream::GetStatus | ( | ) | const |
Get the status of the stream (stopped, paused, playing).
| float sf::Sound::GetVolume | ( | ) | const |
Get the volume.
|
protected |
Set the audio stream parameters, you must call it before Play().
| ChannelsCount | : Number of channels |
| SampleRate | : Sample rate |
| bool sf::Sound::IsRelativeToListener | ( | ) | const |
Tell if the sound's position is relative to the listener's position, or if it's absolute.
| void sf::Sound::Pause | ( | ) |
Pause the sound.
| void sf::SoundStream::Play | ( | ) |
Start playing the audio stream.
| void sf::Sound::SetAttenuation | ( | float | Attenuation | ) |
Set the attenuation factor - the higher the attenuation, the more the sound will be attenuated with distance from listener.
The default attenuation factor 1.0
| Attenuation | : New attenuation factor for the sound |
| void sf::SoundStream::SetLoop | ( | bool | Loop | ) |
Set the stream loop state.
This parameter is disabled by default
| Loop | : True to play in loop, false to play once |
| void sf::Sound::SetMinDistance | ( | float | MinDistance | ) |
Set the minimum distance - closer than this distance, the listener will hear the sound at its maximum volume.
The default minimum distance is 1.0
| MinDistance | : New minimum distance for the sound |
| void sf::Sound::SetPitch | ( | float | Pitch | ) |
Set the sound pitch.
The default pitch is 1
| Pitch | : New pitch |
| void sf::Sound::SetPosition | ( | const Vector3f & | Position | ) |
Set the sound position (take a 3D vector).
The default position is (0, 0, 0)
| Position | : Position of the sound in the world |
| void sf::Sound::SetPosition | ( | float | X, |
| float | Y, | ||
| float | Z ) |
Set the sound position (take 3 values).
The default position is (0, 0, 0)
| X,Y,Z | : Position of the sound in the world |
| void sf::Sound::SetRelativeToListener | ( | bool | Relative | ) |
Make the sound's position relative to the listener's position, or absolute.
The default value is false (absolute)
| Relative | : True to set the position relative, false to set it absolute |
| void sf::Sound::SetVolume | ( | float | Volume | ) |
Set the sound volume.
The default volume is 100
| Volume | : Volume (in range [0, 100]) |
| void sf::SoundStream::Stop | ( | ) |
Stop playing the audio stream.