Reference

CL_SoundBuffer_Session(3)

CL_SoundBuffer_Session provides control over a playing soundeffect.

NAME

CL_SoundBuffer_Session - CL_SoundBuffer_Session provides control over a playing soundeffect.

DESCRIPTION

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 &copy)

~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 &copy)

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

SEE ALSO

All ClanLib API classes can be found in clanlib (3).

AUTHORS

Originally written by Magnus Norddahl <[email protected]> and Martin Starch <[email protected]>. ClanLib is now developed by the ClanLib Development team as an Open Source project.

The ClanLib man pages was created using the Perceps documentation system (another excellent piece of Open Source software, available at http://somewhere.in.the.world.org).

See clanlib (3) to find out how to get a full list of contributors and details on how to submit bug reports, comments etc.