CL_SoundBuffer_Session3
Cl_soundbuffer_session provides control over a playing soundeffect.
Overview
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 of course also be used to retrigger the sound or to stop it. The soundeffect is stored in the layer1 soundmanager until all references to the sound played are removed, meaning that the soundeffect (session) will be ready to play and remember its state and settings (volume, frequency...) until no CL_SoundBuffer_Session refers to it, via a soundbuffer session reference system.
Class members
CL_SoundBuffer_Session()
CL_SoundBuffer_Session(-
void *handle, CL_SoundCard *_card)
CL_SoundBuffer_Session(-
const CL_SoundBuffer_Session ©)
~CL_SoundBuffer_Session()
- CL_SoundBuffer_Session&
operator=( -
const CL_SoundBuffer_Session &session)
- void *
get_handle()
- CL_SoundCard *
get_card()
- int
get_position()
- float
get_position_relative()
- bool
set_position( -
int new_pos)
- bool
set_position_relative( -
float new_pos)
- int
get_length()
- int
get_frequency()
- bool
set_frequency( -
int new_freq)
- float
get_volume()
- bool
set_volume( -
float new_volume)
- float
get_pan()
- bool
set_pan( -
float new_pan)
- void
play()
- void
stop()
- bool
is_playing()
- void
set_looping( -
bool loop)
Members with descriptions
CL_SoundBuffer_Session()-
Description:
Creates a soundbuffer session not attached to any object.
CL_SoundBuffer_Session(-
void *handle, CL_SoundCard *_card)
Description:
CL_SoundBuffer_Session(-
const CL_SoundBuffer_Session ©)
Description:
Copy constructor.
~CL_SoundBuffer_Session()-
Description:
- CL_SoundBuffer_Session&
operator=( -
const CL_SoundBuffer_Session &session)
Description:
- void *
get_handle() -
Description:
- CL_SoundCard *
get_card() -
Description:
Returns a pointer to the card on which the soundbuffer controlledis played/playing.
Return value:
Pointer to soundcard
- int
get_position() -
Description:
Returns the current position of the soundeffect
Return value:
Current position of soundeffect.
- float
get_position_relative() -
Description:
Returns the soundeffects relative position, comparedto the total length of the soundeffect.The value returned will be between 0->1, where 0means the soundeffect is at the beginning, and 1means that the soundeffect has reached the end.
Return value:
Relative position of the soundeffect.
- bool
set_position( -
int new_pos)
Parameters: The new position of the soundeffect.
Description:
Sets the soundeffects position to new_pos.
Return value:
Returns true if operation completed succesfully.
- bool
set_position_relative( -
float new_pos)
Parameters: New relative position
Description:
Sets the relative position of the soundeffect.Value must be between 0->1, where 0 sets the soundeffect to the beginning, and 1 sets itto the end of the soundbuffer.
Return value:
Returns true if operation completed succesfully.
- int
get_length() -
Description:
Returns the total length of the soundeffect played.Value returned will be -1 if the length is unknown (incase of non-static soundeffects like streamed sound)
Return value:
Length of the soundeffect.
- int
get_frequency() -
Description:
Returns the frequency of the soundeffect played.
Return value:
Frequency of soundeffect played.
- bool
set_frequency( -
int new_freq)
Parameters: New frequency of soundeffect.
Description:
Sets the frequency of the soundeffect played.
Return value:
Returns true, if the operation completed succesfully.
- float
get_volume() -
Description:
Returns the linear relative volume of the soundeffect.0 means the soundeffect is muted, 1 means the soundeffectis playing at "max" volume.
Return value:
Volume of soundeffect played.
- bool
set_volume( -
float new_volume)
Parameters: new_volume - New volume of soundeffect
Description:
Sets the volume of the soundeffect in a relative measure (0->1)A value of 0 will effectively mute the sound (although it willstill be sampled), and a value of 1 will set the volume to "max".
Return value:
Returns true if the operation completed succesfully.
- float
get_pan() -
Description:
Returns the current pan (in a measure from -1 -> 1), where-1 means the soundeffect is only playing in the left speaker, and 1 means the soundeffect is only playing in the right speaker.
Return value:
Current pan of the soundeffect played.
- bool
set_pan( -
float new_pan)
Parameters: new_pan - New pan of the soundeffect played.
Description:
Sets the panning of the soundeffect played in measures from -1 -> 1Setting the pan with a value of -1 will pan the soundeffect to theextreme left (left speaker only), 1 will pan the soundeffect to theextreme right (right speaker only).
Return value:
Returns true if the operation completed sucecsfully.
- void
play() -
Description:
Starts playback of the session.
- void
stop() -
Description:
Stops playback of the session.
- bool
is_playing() -
Description:
Returns true if the session is playing
- void
set_looping( -
bool loop)
Parameters: loop - true if session should loop, false otherwise
Description:
Determines whether this session should loop