Music defines a big sound played using streaming, so usually what we call a music :)
More...
#include <Music.hpp>
|
| | Music (std::size_t BufferSize=44100) |
| | Construct the music with a buffer size.
|
| |
| | ~Music () |
| | Destructor.
|
| |
| bool | OpenFromFile (const std::string &Filename) |
| | Open a music file (doesn't play it – call Play() for that)
|
| |
| bool | OpenFromMemory (const char *Data, std::size_t SizeInBytes) |
| | Open a music file from memory (doesn't play it – call Play() for that)
|
| |
| float | GetDuration () const |
| | Get the music duration.
|
| |
| 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.
|
| |
Music defines a big sound played using streaming, so usually what we call a music :)
Definition at line 47 of file Music.hpp.
◆ Status
Enumeration of the sound states.
Definition at line 52 of file Sound.hpp.
◆ Music()
| sf::Music::Music |
( |
std::size_t | BufferSize = 44100 | ) |
|
|
explicit |
Construct the music with a buffer size.
- Parameters
-
| BufferSize | : Size of the internal buffer, expressed in number of samples (ie. size taken by the music in memory) (44100 by default) |
Definition at line 40 of file Music.cpp.
◆ ~Music()
◆ GetAttenuation()
| float sf::Sound::GetAttenuation |
( |
| ) |
const |
|
inherited |
Get the attenuation factor.
- Returns
- Attenuation factor of the sound
Definition at line 263 of file Sound.cpp.
◆ GetChannelsCount()
| unsigned int sf::SoundStream::GetChannelsCount |
( |
| ) |
const |
|
inherited |
Return the number of channels (1 = mono, 2 = stereo)
Return the number of channels (1 = mono, 2 = stereo, ...)
- Returns
- Number of channels
Definition at line 126 of file SoundStream.cpp.
◆ GetDuration()
| float sf::Music::GetDuration |
( |
| ) |
const |
Get the music duration.
Get the sound duration.
- Returns
- Music duration, in seconds
Definition at line 148 of file Music.cpp.
◆ GetLoop()
| bool sf::SoundStream::GetLoop |
( |
| ) |
const |
|
inherited |
Tell whether or not the stream is looping.
Tell whether or not the music is looping.
- Returns
- True if the music is looping, false otherwise
Definition at line 180 of file SoundStream.cpp.
◆ GetMinDistance()
| float sf::Sound::GetMinDistance |
( |
| ) |
const |
|
inherited |
Get the minimum distance.
- Returns
- Minimum distance for the sound
Definition at line 255 of file Sound.cpp.
◆ GetPitch()
| float sf::Sound::GetPitch |
( |
| ) |
const |
|
inherited |
Get the pitch.
- Returns
- Pitch value
Definition at line 222 of file Sound.cpp.
◆ GetPlayingOffset()
| float sf::SoundStream::GetPlayingOffset |
( |
| ) |
const |
|
inherited |
Get the current playing position of the stream.
- Returns
- Current playing position, expressed in seconds
Definition at line 162 of file SoundStream.cpp.
◆ GetPosition()
| Vector3f sf::Sound::GetPosition |
( |
| ) |
const |
|
inherited |
Get the sound position.
- Returns
- Position of the sound in the world
Definition at line 238 of file Sound.cpp.
◆ GetSampleRate()
Get the stream sample rate.
Get the sound frequency (sample rate)
- Returns
- Stream frequency (number of samples per second)
Definition at line 135 of file SoundStream.cpp.
◆ GetStatus()
Get the status of the stream (stopped, paused, playing)
Get the status of the sound (stopped, paused, playing)
- Returns
- Current status of the sound
Definition at line 144 of file SoundStream.cpp.
◆ GetVolume()
| float sf::Sound::GetVolume |
( |
| ) |
const |
|
inherited |
Get the volume.
- Returns
- Volume value (in range [1, 100])
Definition at line 230 of file Sound.cpp.
◆ Initialize()
Set the audio stream parameters, you must call it before Play()
- Parameters
-
| ChannelsCount | : Number of channels |
| SampleRate | : Sample rate |
Definition at line 64 of file SoundStream.cpp.
◆ IsRelativeToListener()
| bool sf::Sound::IsRelativeToListener |
( |
| ) |
const |
|
inherited |
Tell if the sound's position is relative to the listener's position, or if it's absolute.
- Returns
- True if the position is relative, false if it's absolute
Definition at line 247 of file Sound.cpp.
◆ OpenFromFile()
| bool sf::Music::OpenFromFile |
( |
const std::string & | Filename | ) |
|
Open a music file (doesn't play it – call Play() for that)
- Parameters
-
| Filename | : Path of the music file to open |
- Returns
- True if loading has been successful
Definition at line 64 of file Music.cpp.
◆ OpenFromMemory()
| bool sf::Music::OpenFromMemory |
( |
const char * | Data, |
|
|
std::size_t | SizeInBytes ) |
Open a music file from memory (doesn't play it – call Play() for that)
- Parameters
-
| Data | : Pointer to the file data in memory |
| SizeInBytes | : Size of the data to load, in bytes |
- Returns
- True if loading has been successful
Definition at line 91 of file Music.cpp.
◆ Pause()
| void sf::Sound::Pause |
( |
| ) |
|
|
inherited |
◆ Play()
| void sf::SoundStream::Play |
( |
| ) |
|
|
inherited |
◆ SetAttenuation()
| void sf::Sound::SetAttenuation |
( |
float | Attenuation | ) |
|
|
inherited |
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
- Parameters
-
| Attenuation | : New attenuation factor for the sound |
The default attenuation factor 1.0
Definition at line 190 of file Sound.cpp.
◆ SetLoop()
| void sf::SoundStream::SetLoop |
( |
bool | Loop | ) |
|
|
inherited |
Set the stream loop state.
Set the music loop state.
This parameter is disabled by default
- Parameters
-
| Loop | : True to play in loop, false to play once |
Definition at line 171 of file SoundStream.cpp.
◆ SetMinDistance()
| void sf::Sound::SetMinDistance |
( |
float | MinDistance | ) |
|
|
inherited |
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
- Parameters
-
| MinDistance | : New minimum distance for the sound |
The default minimum distance is 1.0
Definition at line 180 of file Sound.cpp.
◆ SetPitch()
Set the sound pitch.
The default pitch is 1
- Parameters
-
Definition at line 133 of file Sound.cpp.
◆ SetPosition() [1/2]
Set the sound position (take a 3D vector).
The default position is (0, 0, 0)
- Parameters
-
| Position | : Position of the sound in the world |
The default position is (0, 0, 0)
Definition at line 160 of file Sound.cpp.
◆ SetPosition() [2/2]
Set the sound position (take 3 values).
The default position is (0, 0, 0)
- Parameters
-
| X,Y,Z | : Position of the sound in the world |
The default position is (0, 0, 0)
Definition at line 151 of file Sound.cpp.
◆ SetRelativeToListener()
| void sf::Sound::SetRelativeToListener |
( |
bool | Relative | ) |
|
|
inherited |
Make the sound's position relative to the listener's position, or absolute.
The default value is false (absolute)
- Parameters
-
| Relative | : True to set the position relative, false to set it absolute |
The default value is false (absolute)
Definition at line 170 of file Sound.cpp.
◆ SetVolume()
Set the sound volume.
The default volume is 100
- Parameters
-
| Volume | : Volume (in range [0, 100]) |
Definition at line 142 of file Sound.cpp.
◆ Stop()
| void sf::SoundStream::Stop |
( |
| ) |
|
|
inherited |
The documentation for this class was generated from the following files: