CL_SoundBuffer_Session provides control over a playing soundeffect.
More...
#include <soundbuffer_session.h>
CL_SoundBuffer_Session provides control over a playing soundeffect.
Whenever a soundbuffer is played, it returns a CL_SoundBuffer_Session class, which can be used to control the sound (its volume, pitch, pan, position). It can also be used to retrigger the sound or to stop it.
CL_SoundBuffer_Session::CL_SoundBuffer_Session |
( |
) | |
|
virtual CL_SoundBuffer_Session::~CL_SoundBuffer_Session |
( |
) | |
|
|
virtual |
Adds the sound filter to the session. See CL_SoundFilter for details.
- Parameters
-
filter | Sound filter to pass sound through. |
int CL_SoundBuffer_Session::get_frequency |
( |
) | |
const |
Returns the frequency of the session.
int CL_SoundBuffer_Session::get_length |
( |
) | |
const |
Returns the total length (in samples) of the sound buffer played.
Value returned will be -1 if the length is unknown (in case of non-static soundeffects like streamed sound)
bool CL_SoundBuffer_Session::get_looping |
( |
) | |
const |
Returns whether this session loops.
- Returns
- true if session should loop, false otherwise
float CL_SoundBuffer_Session::get_pan |
( |
) | |
const |
Returns the current pan (in a measure from -1 -> 1).
-1 means the soundeffect is only playing in the left speaker, and 1 means the soundeffect is only playing in the right speaker.
int CL_SoundBuffer_Session::get_position |
( |
) | |
const |
Returns the current sample position of the playback.
float CL_SoundBuffer_Session::get_position_relative |
( |
) | |
const |
Returns the sample position relative to the full length.
The value returned will be between 0 and 1, where 0 means the session is at the beginning, and 1 means that the soundeffect has reached the end.
float CL_SoundBuffer_Session::get_volume |
( |
) | |
const |
Returns the linear relative volume of the soundeffect.
0 means the soundeffect is muted, 1 means the soundeffect is playing at "max" volume.
bool CL_SoundBuffer_Session::is_null |
( |
) | |
const |
|
inline |
Returns true if this object is invalid.
bool CL_SoundBuffer_Session::is_playing |
( |
) | |
|
Returns true if the session is playing.
void CL_SoundBuffer_Session::play |
( |
) | |
|
Starts playback of the session.
Remove the sound filter from the session. See CL_SoundFilter for details.
bool CL_SoundBuffer_Session::set_end_position |
( |
int |
pos) | |
|
Sets the end position within the current stream.
- Parameters
-
- Returns
- True for success. False otherwise.
void CL_SoundBuffer_Session::set_frequency |
( |
int |
new_freq) | |
|
Sets the frequency of the session.
- Parameters
-
new_freq | New frequency of session. |
void CL_SoundBuffer_Session::set_looping |
( |
bool |
loop) | |
|
Determines whether this session should loop.
- Parameters
-
loop | true if session should loop, false otherwise |
void CL_SoundBuffer_Session::set_pan |
( |
float |
new_pan) | |
|
Sets the panning of the session played in measures from -1 -> 1.
Setting the pan with a value of -1 will pan the session to the extreme left (left speaker only), 1 will pan the session to the extreme right (right speaker only).
- Parameters
-
new_pan | New pan of the session played. |
- Returns
- Returns true if the operation completed sucecsfully.
bool CL_SoundBuffer_Session::set_position |
( |
int |
new_pos) | |
|
Sets the session position to 'new_pos'.
- Parameters
-
new_pos | = The new position of the session. |
- Returns
- Returns true if operation completed succesfully.
bool CL_SoundBuffer_Session::set_position_relative |
( |
float |
new_pos) | |
|
Sets the relative position of the session.
Value must be between 0 and 1, where 0 sets the session to the beginning, and 1 sets it to the end of the sound buffer.
- Parameters
-
new_pos | New relative position. |
- Returns
- Returns true if operation completed succesfully.
void CL_SoundBuffer_Session::set_volume |
( |
float |
new_volume) | |
|
Sets the volume of the session 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".
- Parameters
-
new_volume | New volume of session. |
- Returns
- Returns true if the operation completed succesfully.
void CL_SoundBuffer_Session::stop |
( |
) | |
|
Stops playback of the session.
void CL_SoundBuffer_Session::throw_if_null |
( |
) | |
const |
Throw an exception if this object is invalid.
friend class CL_SoundOutput_Impl |
|
friend |
The documentation for this class was generated from the following file: