#include <spSound.hpp>
Public Member Functions | |
virtual | ~Sound () |
virtual bool | reload (const io::stringc &Filename, u8 BufferCount=DEF_SOUND_BUFFERCOUNT)=0 |
virtual void | close ()=0 |
virtual void | play () |
Starts playing the sound. The sound will be played from the beginning. | |
virtual void | pause (bool Paused=true) |
Pauses (if "Paused" is true) or resumes (if "Paused" if false) the sound. | |
virtual void | stop () |
Stops playing the sound. | |
virtual void | emit2D (f32 Volume=1.0f, bool UseEffectSlot=true) |
Emits a 2D sound with the specified volume. Use this for short sound samples. | |
virtual void | emit3D (const dim::vector3df &Point, f32 Volume=1.0f, bool UseEffectSlot=true) |
Emits a 3D sound with the specified volume. Use this for short, volumetric sound samples. | |
virtual void | setSeek (f32 Seek) |
virtual f32 | getSeek () const |
virtual void | setVolume (f32 Volume) |
virtual void | setSpeed (f32 Speed) |
virtual void | setBalance (f32 Balance) |
virtual void | setLoop (bool Enable) |
Enables or disables loop playback mode. If true the sound will played for ever. By default false. | |
virtual f32 | getLength () const =0 |
Returns the length of the sound (in seconds). | |
virtual bool | valid () const =0 |
Returns true if the object is a valid sound. Otherwise no sound file has been loaded or could not load. | |
virtual void | setPosition (const dim::vector3df &Position) |
Sets the 3D global position of that sound. Only for volumetric sounds. | |
virtual void | setVelocity (const dim::vector3df &Veclotiy) |
Sets the 3D global velocity of that sound. Only for volumetric sound and sound systems which support the 'doppler' effect. | |
virtual void | setVolumetric (bool isVolumetric) |
virtual void | setVolumetricRadius (f32 Radius) |
virtual bool | playing () const |
Returns true if this sound is currenlty playing. | |
virtual bool | finish () const |
Returns true if the sound has reached the end. | |
virtual bool | saveRecord (const io::stringc &Filename) |
virtual void | beginRecording () |
Begins to record a sound from an sound-input device (microphone). | |
virtual void | endRecording () |
Finish the recording sound. After recording a sound it can be saved as a wave (WAV) file. | |
u8 | getBufferCount () const |
Returns the count of buffers. By default 1. | |
io::stringc | getFilename () const |
Returns the sound's filename. | |
bool | paused () const |
bool | recording () const |
Returns true if the sound is currently being recorded. | |
bool | getLoop () const |
Returns true if the sound was played in loop mode. | |
bool | getVolumetric () const |
Returns true if the sound is volumetric. By default false. | |
f32 | getVolumetricRadius () const |
Returns the volumetric radius. By default 100.0. | |
dim::vector3df | getPosition () const |
Returns the global position. | |
dim::vector3df | getVeclotiy () const |
Returns the global velocity. | |
f32 | getSpeed () const |
Returns the speed. By default 1.0. | |
f32 | getVolume () const |
Returns the volume. By default 1.0. | |
f32 | getBalance () const |
Protected Member Functions | |
Sound () | |
bool | checkFile (const io::stringc &Filename) const |
Protected Attributes | |
io::stringc | Filename_ |
u8 | BufferCount_ |
f32 | Radius_ |
f32 | Volume_ |
f32 | Balance_ |
f32 | Speed_ |
f32 | Seek_ |
bool | isPaused_ |
bool | isLoop_ |
bool | isPlaying_ |
bool | isVolumetric_ |
bool | isRecording_ |
dim::vector3df | Position_ |
dim::vector3df | Veclotiy_ |
bool | hasSeekChanged_ |
Friends | |
class | SoundDevice |
Sound base class. Sounds can have several buffers (in OpenAL called "sources" which share the same buffer). By default each sound has only one buffer. Use several buffers when you want to play the same sound several times in a row.
sp::audio::Sound::~Sound | ( | ) | [virtual] |
sp::audio::Sound::Sound | ( | ) | [protected] |
void sp::audio::Sound::beginRecording | ( | ) | [virtual] |
Begins to record a sound from an sound-input device (microphone).
Reimplemented in sp::audio::WinMMSound, and sp::audio::OpenSLESSound.
bool sp::audio::Sound::checkFile | ( | const io::stringc & | Filename | ) | const [protected] |
virtual void sp::audio::Sound::close | ( | ) | [pure virtual] |
Implemented in sp::audio::DummySound, sp::audio::WinMMSound, sp::audio::OpenALSound, sp::audio::OpenSLESSound, and sp::audio::XAudio2Sound.
void sp::audio::Sound::emit2D | ( | f32 | Volume = 1.0f , |
|
bool | UseEffectSlot = true | |||
) | [virtual] |
Emits a 2D sound with the specified volume. Use this for short sound samples.
Reimplemented in sp::audio::OpenALSound.
void sp::audio::Sound::emit3D | ( | const dim::vector3df & | Point, | |
f32 | Volume = 1.0f , |
|||
bool | UseEffectSlot = true | |||
) | [virtual] |
Emits a 3D sound with the specified volume. Use this for short, volumetric sound samples.
Reimplemented in sp::audio::OpenALSound.
void sp::audio::Sound::endRecording | ( | ) | [virtual] |
Finish the recording sound. After recording a sound it can be saved as a wave (WAV) file.
Reimplemented in sp::audio::WinMMSound, and sp::audio::OpenSLESSound.
bool sp::audio::Sound::finish | ( | ) | const [virtual] |
Returns true if the sound has reached the end.
Reimplemented in sp::audio::OpenALSound.
f32 sp::audio::Sound::getBalance | ( | ) | const [inline] |
Returns the balance. 0.0 means the sound is centered, -1.0 means the sound is on the left and +1.0 means the sound is on the right. By default 0.0.
u8 sp::audio::Sound::getBufferCount | ( | ) | const [inline] |
Returns the count of buffers. By default 1.
io::stringc sp::audio::Sound::getFilename | ( | ) | const [inline] |
Returns the sound's filename.
virtual f32 sp::audio::Sound::getLength | ( | ) | const [pure virtual] |
Returns the length of the sound (in seconds).
Implemented in sp::audio::DummySound, sp::audio::WinMMSound, sp::audio::OpenALSound, sp::audio::OpenSLESSound, and sp::audio::XAudio2Sound.
bool sp::audio::Sound::getLoop | ( | ) | const [inline] |
Returns true if the sound was played in loop mode.
dim::vector3df sp::audio::Sound::getPosition | ( | ) | const [inline] |
Returns the global position.
f32 sp::audio::Sound::getSeek | ( | ) | const [virtual] |
Reimplemented in sp::audio::DummySound, sp::audio::WinMMSound, sp::audio::OpenALSound, sp::audio::OpenSLESSound, and sp::audio::XAudio2Sound.
f32 sp::audio::Sound::getSpeed | ( | ) | const [inline] |
Returns the speed. By default 1.0.
dim::vector3df sp::audio::Sound::getVeclotiy | ( | ) | const [inline] |
Returns the global velocity.
f32 sp::audio::Sound::getVolume | ( | ) | const [inline] |
Returns the volume. By default 1.0.
bool sp::audio::Sound::getVolumetric | ( | ) | const [inline] |
Returns true if the sound is volumetric. By default false.
f32 sp::audio::Sound::getVolumetricRadius | ( | ) | const [inline] |
Returns the volumetric radius. By default 100.0.
void sp::audio::Sound::pause | ( | bool | Paused = true |
) | [virtual] |
Pauses (if "Paused" is true) or resumes (if "Paused" if false) the sound.
Reimplemented in sp::audio::WinMMSound, sp::audio::OpenALSound, sp::audio::OpenSLESSound, and sp::audio::XAudio2Sound.
bool sp::audio::Sound::paused | ( | ) | const [inline] |
Returns true if the sound is currently paused.
void sp::audio::Sound::play | ( | ) | [virtual] |
Starts playing the sound. The sound will be played from the beginning.
Reimplemented in sp::audio::WinMMSound, sp::audio::OpenALSound, and sp::audio::XAudio2Sound.
bool sp::audio::Sound::playing | ( | ) | const [virtual] |
Returns true if this sound is currenlty playing.
Reimplemented in sp::audio::OpenALSound.
bool sp::audio::Sound::recording | ( | ) | const [inline] |
Returns true if the sound is currently being recorded.
virtual bool sp::audio::Sound::reload | ( | const io::stringc & | Filename, | |
u8 | BufferCount = DEF_SOUND_BUFFERCOUNT | |||
) | [pure virtual] |
Implemented in sp::audio::DummySound, sp::audio::WinMMSound, sp::audio::OpenALSound, sp::audio::OpenSLESSound, and sp::audio::XAudio2Sound.
bool sp::audio::Sound::saveRecord | ( | const io::stringc & | Filename | ) | [virtual] |
Saves the record sound as a wave (WAV) file to the disk. A sound needs to be recorded using the "beginRecording" and "endRecording" before this function can be used.
Filename,: | Filename or path where the sound file is to be saved. |
Reimplemented in sp::audio::WinMMSound, and sp::audio::OpenSLESSound.
void sp::audio::Sound::setBalance | ( | f32 | Balance | ) | [virtual] |
Sets the balance of the sound.
Balance,: | Specifies the balance between two sound-output devices (the sound boxes). Must lie between -1.0 (left) and 1.0 (right). By default 0.0 (in the middle, both boxes have the same volume). |
Reimplemented in sp::audio::DummySound, sp::audio::WinMMSound, sp::audio::OpenALSound, sp::audio::OpenSLESSound, and sp::audio::XAudio2Sound.
void sp::audio::Sound::setLoop | ( | bool | Enable | ) | [virtual] |
Enables or disables loop playback mode. If true the sound will played for ever. By default false.
Reimplemented in sp::audio::OpenALSound.
void sp::audio::Sound::setPosition | ( | const dim::vector3df & | Position | ) | [virtual] |
Sets the 3D global position of that sound. Only for volumetric sounds.
Reimplemented in sp::audio::OpenALSound.
void sp::audio::Sound::setSeek | ( | f32 | Seek | ) | [virtual] |
Sets the seek or status of the sound. To use this function "play" needs not to be called.
Seek,: | Specifies the status. Must lie between 0.0 and 1.0. |
Reimplemented in sp::audio::DummySound, sp::audio::WinMMSound, sp::audio::OpenALSound, sp::audio::OpenSLESSound, and sp::audio::XAudio2Sound.
void sp::audio::Sound::setSpeed | ( | f32 | Speed | ) | [virtual] |
Sets the speed or frequency of the sound.
Speed,: | Specifies the speed. Must lie between 0.0 (slow, where with 0.0 the sound stops to play and 2.0 (fast). By default 1.0 (normal). Backwards playing is not possible! |
Reimplemented in sp::audio::DummySound, sp::audio::WinMMSound, sp::audio::OpenALSound, sp::audio::OpenSLESSound, and sp::audio::XAudio2Sound.
void sp::audio::Sound::setVelocity | ( | const dim::vector3df & | Veclotiy | ) | [virtual] |
Sets the 3D global velocity of that sound. Only for volumetric sound and sound systems which support the 'doppler' effect.
Reimplemented in sp::audio::OpenALSound.
void sp::audio::Sound::setVolume | ( | f32 | Volume | ) | [virtual] |
Sets the volume of the sound.
Volume,: | Specifies the volume for the sound. Must lie between 0.0 (quiet) and 1.0 (loud). By default 1.0. |
Reimplemented in sp::audio::DummySound, sp::audio::WinMMSound, sp::audio::OpenALSound, sp::audio::OpenSLESSound, and sp::audio::XAudio2Sound.
void sp::audio::Sound::setVolumetric | ( | bool | isVolumetric | ) | [virtual] |
Reimplemented in sp::audio::OpenALSound.
void sp::audio::Sound::setVolumetricRadius | ( | f32 | Radius | ) | [virtual] |
Reimplemented in sp::audio::OpenALSound.
void sp::audio::Sound::stop | ( | ) | [virtual] |
Stops playing the sound.
Reimplemented in sp::audio::WinMMSound, sp::audio::OpenALSound, sp::audio::OpenSLESSound, and sp::audio::XAudio2Sound.
virtual bool sp::audio::Sound::valid | ( | ) | const [pure virtual] |
Returns true if the object is a valid sound. Otherwise no sound file has been loaded or could not load.
Implemented in sp::audio::DummySound, sp::audio::WinMMSound, sp::audio::OpenALSound, sp::audio::OpenSLESSound, and sp::audio::XAudio2Sound.
friend class SoundDevice [friend] |
f32 sp::audio::Sound::Balance_ [protected] |
u8 sp::audio::Sound::BufferCount_ [protected] |
io::stringc sp::audio::Sound::Filename_ [protected] |
bool sp::audio::Sound::hasSeekChanged_ [protected] |
bool sp::audio::Sound::isLoop_ [protected] |
bool sp::audio::Sound::isPaused_ [protected] |
bool sp::audio::Sound::isPlaying_ [protected] |
bool sp::audio::Sound::isRecording_ [protected] |
bool sp::audio::Sound::isVolumetric_ [protected] |
dim::vector3df sp::audio::Sound::Position_ [protected] |
f32 sp::audio::Sound::Radius_ [protected] |
f32 sp::audio::Sound::Seek_ [protected] |
f32 sp::audio::Sound::Speed_ [protected] |
dim::vector3df sp::audio::Sound::Veclotiy_ [protected] |
f32 sp::audio::Sound::Volume_ [protected] |