ClanLib
2.3.7
|
Sample interface in ClanLib. More...
#include <soundbuffer.h>
Public Member Functions | |
Construction | |
CL_SoundBuffer () | |
Construct a null instance. More... | |
CL_SoundBuffer (const CL_String &res_id, CL_ResourceManager *manager) | |
Construct sound buffer. More... | |
CL_SoundBuffer (CL_SoundProvider *provider) | |
CL_SoundBuffer (const CL_String &fullname, bool streamed=false, const CL_String &format="") | |
CL_SoundBuffer (const CL_String &filename, bool streamed, const CL_VirtualDirectory &directory, const CL_String &type="") | |
CL_SoundBuffer (CL_IODevice &file, bool streamed, const CL_String &type) | |
virtual | ~CL_SoundBuffer () |
Attributes | |
CL_SoundProvider * | get_provider () const |
Returns the sound provider to be used for playback. More... | |
float | get_volume () const |
Returns the start/default volume used when the buffer is played. More... | |
float | get_pan () const |
Returns the default panning position when the buffer is played. More... | |
bool | is_null () const |
Returns true if this object is invalid. More... | |
void | throw_if_null () const |
Throw an exception if this object is invalid. More... | |
Operations | |
void | set_volume (float new_volume) |
Sets the volume of the sound buffer in a relative measure (0->1) More... | |
void | set_pan (float new_pan) |
Sets the panning of the sound buffer played in measures from -1 -> 1. More... | |
void | add_filter (CL_SoundFilter &filter) |
Adds the sound filter to the sound buffer. More... | |
void | remove_filter (CL_SoundFilter &filter) |
Remove the sound filter from the sound buffer. More... | |
CL_SoundBuffer_Session | play (bool looping=false, CL_SoundOutput *output=0) |
Plays the soundbuffer on the specified soundcard. More... | |
CL_SoundBuffer_Session | prepare (bool looping=false, CL_SoundOutput *output=0) |
Prepares the soundbuffer for playback on the specified soundcard. More... | |
Sample interface in ClanLib.
The CL_SoundBuffer class represents a sample in ClanLib. It can either be static or streamed. The soundbuffer gets its sample data from a soundprovider, that is passed during construction.
CL_SoundBuffer::CL_SoundBuffer | ( | ) |
Construct a null instance.
CL_SoundBuffer::CL_SoundBuffer | ( | const CL_String & | res_id, |
CL_ResourceManager * | manager | ||
) |
Construct sound buffer.
A sound buffer can be constructed either as static or streamed. If the sound buffer is loaded from resources, the buffer type is determined by the resource option 'stream' associated with the resource.
CL_SoundBuffer's internals are reference counted, so the copy constructor will create a new soundbuffer object which shares the same buffer as the original one. This means that if the copy is modified, the original is affected as well.
If delete_provider is true, the provider will be deleted when the soundbuffer is deleted.
CL_SoundBuffer::CL_SoundBuffer | ( | CL_SoundProvider * | provider) |
CL_SoundBuffer::CL_SoundBuffer | ( | const CL_String & | fullname, |
bool | streamed = false , |
||
const CL_String & | format = "" |
||
) |
CL_SoundBuffer::CL_SoundBuffer | ( | const CL_String & | filename, |
bool | streamed, | ||
const CL_VirtualDirectory & | directory, | ||
const CL_String & | type = "" |
||
) |
CL_SoundBuffer::CL_SoundBuffer | ( | CL_IODevice & | file, |
bool | streamed, | ||
const CL_String & | type | ||
) |
|
virtual |
void CL_SoundBuffer::add_filter | ( | CL_SoundFilter & | filter) |
Adds the sound filter to the sound buffer.
filter | Sound filter to pass sound through. |
float CL_SoundBuffer::get_pan | ( | ) | const |
Returns the default panning position when the buffer is played.
CL_SoundProvider* CL_SoundBuffer::get_provider | ( | ) | const |
Returns the sound provider to be used for playback.
float CL_SoundBuffer::get_volume | ( | ) | const |
Returns the start/default volume used when the buffer is played.
|
inline |
Returns true if this object is invalid.
CL_SoundBuffer_Session CL_SoundBuffer::play | ( | bool | looping = false , |
CL_SoundOutput * | output = 0 |
||
) |
Plays the soundbuffer on the specified soundcard.
looping | looping |
output | Sound output to be used - NULL means use the current selected sound output (CL_Sound::get_selected_output(). |
CL_SoundBuffer_Session CL_SoundBuffer::prepare | ( | bool | looping = false , |
CL_SoundOutput * | output = 0 |
||
) |
Prepares the soundbuffer for playback on the specified soundcard.
output | Sound output to be used - NULL means use the current selected sound output (CL_Sound::get_selected_output(). |
void CL_SoundBuffer::remove_filter | ( | CL_SoundFilter & | filter) |
Remove the sound filter from the sound buffer.
void CL_SoundBuffer::set_pan | ( | float | new_pan) |
Sets the panning of the sound buffer played in measures from -1 -> 1.
Setting the pan with a value of -1 will pan the sound buffer to the extreme left (left speaker only), 1 will pan the sound buffer to the extreme right (right speaker only).
new_pan | New pan of the sound buffer played. |
void CL_SoundBuffer::set_volume | ( | float | new_volume) |
Sets the volume of the sound buffer in a relative measure (0->1)
A value of 0 will effectively mute the sound (although it will still be sampled), and a value of 1 will set the volume to "max".
new_volume | New volume of sound buffer. |
void CL_SoundBuffer::throw_if_null | ( | ) | const |
Throw an exception if this object is invalid.