NAME
CL_SoundBuffer - Sample interface in ClanLib.
DESCRIPTION
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.
A static sample are normally sound effects and other sounds, that do not change. ClanLib will always load the entire sample into memory, and possibly upload it to the soundcard.
Streamed samples are either large sample that should be loaded a bit at a time (music for instance), or sounds that change from playback to playback (a microphone, speech over the net, etc).
CLASS MEMBERS
- virtual ~CL_SoundBuffer()
- static CL_SoundBuffer *load(
-
const char *res_id, CL_ResourceManager *manager)
- static CL_SoundBuffer *create(
-
CL_StaticSoundProvider *provider, bool delete_provider=false)
- static CL_SoundBuffer *create(
-
CL_StreamSoundProvider *provider, bool delete_provider=false)
- virtual CL_StaticSoundProvider *get_static_provider()
- virtual CL_StreamSoundProvider *get_stream_provider()
- virtual int get_length()
- virtual int get_num_samples()
- virtual int get_frequency()
- virtual bool set_frequency(
-
int new_freq)
- virtual float get_volume()
- virtual bool set_volume(
-
float new_volume)
- virtual float get_pan()
- virtual bool set_pan(
-
float new_pan)
- virtual bool is_playing(
-
CL_SoundBuffer_Session **session=NULL, CL_SoundCard *card=NULL)
- virtual void stop(
-
CL_SoundCard *card=NULL)
- virtual CL_SoundBuffer_Session play(
-
bool looping=false, CL_SoundCard *card=NULL)
- virtual CL_SoundBuffer_Session prepare(
-
bool looping=false, CL_SoundCard *card=NULL)
MEMBERS WITH DESCRIPTIONS
- virtual ~CL_SoundBuffer()
-
Description:
- static CL_SoundBuffer *load(
-
const char *res_id, CL_ResourceManager *manager)
Description:
- static CL_SoundBuffer *create(
-
CL_StaticSoundProvider *provider, bool delete_provider=false)
Description:
Creates a static soundbuffer. If delete_provider is true, the providerwill be deleted when the soundbuffer is deleted.
Return value:
The created soundbuffer.
- static CL_SoundBuffer *create(
-
CL_StreamSoundProvider *provider, bool delete_provider=false)
Description:
Creates a streamed soundbuffer. If delete_provider is true, the providerwill be delete when the soundbuffer is deleted.
Return value:
The created soundbuffer.
- virtual CL_StaticSoundProvider *get_static_provider()
-
Description:
Returns the static soundprovider attached or NULL if it is a streamedsound buffer.
Return value:
The static soundprovider or NULL if none.
- virtual CL_StreamSoundProvider *get_stream_provider()
-
Description:
Return the streamed soundprovider attached or NULL if it is a staticsound buffer.
Return value:
The streamed soundprovider of NULL if none.
- virtual int get_length()
-
Description:
Returns the length of the soundbuffer. That is num_samples * bytes_per_sample.
Return value:
Length of soundbuffer.
- virtual int get_num_samples()
-
Description:
Returns the number of samples in the soundbuffer.
Return value:
Number of samples in soundbuffer.
- virtual int get_frequency()
-
Description:
Returns the start frequency used when the buffer is played.
Return value:
Default/start frequency.
- virtual bool set_frequency(
-
int new_freq)
Parameters: new_freq - The new default frequency.
Description:
Sets the start frequency used when the buffer is played.
Return value:
True if successful, false otherwise.
- virtual float get_volume()
-
Description:
Returns the start/default volume used when the buffer is played.
Return value:
The volume.
- virtual bool set_volume(
-
float new_volume)
Parameters: new_volume - The new default volume.
Description:
Sets the default volume used when the buffer is played.
Return value:
True if successful, false otherwise.
- virtual float get_pan()
-
Description:
Returns the default panning position when the buffer is played.
Return value:
The panning position.
- virtual bool set_pan(
-
float new_pan)
Parameters: new_pan - The new default panning position.
Description:
Sets the default panning position when the buffer is played.
Return value:
True if successful, false otherwise.
- virtual bool is_playing(
-
CL_SoundBuffer_Session **session=NULL, CL_SoundCard *card=NULL)
Parameters: session - Pointer to session-pointer, set to point to the first session playing this soundbuffer. Return value is only valid if function returns true
Description:
Returns true if an instance of this soundbuffer is playing
- virtual void stop(
-
CL_SoundCard *card=NULL)
Description:
Stops any sessions playing this soundbuffer
- virtual CL_SoundBuffer_Session play(
-
bool looping=false, CL_SoundCard *card=NULL)
Parameters: card - Soundcard to be used - NULL means use the current selected sound card (CL_Sound::get_selected_card().
Description:
Plays the soundbuffer on the specified soundcard and using the specified playback description.
Return value:
The playback session.
- virtual CL_SoundBuffer_Session prepare(
-
bool looping=false, CL_SoundCard *card=NULL)
Parameters: card - Soundcard to be used or NULL to use CL_Sound::get_selected_card().
Description:
Prepares the soundbuffer for playback on the specified soundcard.
Return value:
The playback session.
SEE ALSO
- CL_StaticSoundProvider
-
Static sample data source.
- CL_StreamSoundProvider
-
Streamed sample data source.
- CL_SoundBuffer_Session
-
Sample playback control.
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.