CL_SoundBuffer Class Reference
[clanSound Audio Mixing]

Sample interface in ClanLib. More...

#include <soundbuffer.h>

List of all members.

Public Member Functions

Construction

 CL_SoundBuffer ()
 Construct a null instance.
 CL_SoundBuffer (const CL_String &res_id, CL_ResourceManager *manager)
 Construct sound buffer.
 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_SoundProviderget_provider () const
 Returns the sound provider to be used for playback.
float get_volume () const
 Returns the start/default volume used when the buffer is played.
float get_pan () const
 Returns the default panning position when the buffer is played.
bool is_null () const
 Returns true if this object is invalid.
void throw_if_null () const
 Throw an exception if this object is invalid.
Operations

void set_volume (float new_volume)
 Sets the volume of the sound buffer in a relative measure (0->1).
void set_pan (float new_pan)
 Sets the panning of the sound buffer played in measures from -1 -> 1.
void add_filter (CL_SoundFilter &filter)
 Adds the sound filter to the sound buffer.
void remove_filter (CL_SoundFilter &filter)
 Remove the sound filter from the sound buffer.
CL_SoundBuffer_Session play (bool looping=false, CL_SoundOutput *output=0)
 Plays the soundbuffer on the specified soundcard.
CL_SoundBuffer_Session prepare (bool looping=false, CL_SoundOutput *output=0)
 Prepares the soundbuffer for playback on the specified soundcard.

Detailed Description

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.


Constructor & Destructor Documentation

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 CL_SoundBuffer::~CL_SoundBuffer (  )  [virtual]

Member Function Documentation

void CL_SoundBuffer::add_filter ( CL_SoundFilter filter  ) 

Adds the sound filter to the sound buffer.

Parameters:
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.

bool CL_SoundBuffer::is_null (  )  const [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.

Parameters:
looping looping
output Sound output to be used - NULL means use the current selected sound output (CL_Sound::get_selected_output().
Returns:
The playback session.
CL_SoundBuffer_Session CL_SoundBuffer::prepare ( bool  looping = false,
CL_SoundOutput output = 0 
)

Prepares the soundbuffer for playback on the specified soundcard.

Parameters:
output Sound output to be used - NULL means use the current selected sound output (CL_Sound::get_selected_output().
Returns:
The playback session.
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).

Parameters:
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".

Parameters:
new_volume New volume of sound buffer.
void CL_SoundBuffer::throw_if_null (  )  const

Throw an exception if this object is invalid.


The documentation for this class was generated from the following file: