clanSound Audio Mixing

Classes

class  clan::Sound
 Sound interface in ClanLib. More...
 
class  clan::SoundBuffer
 Sample interface in ClanLib. More...
 
class  clan::SoundBuffer_Session
 SoundBuffer_Session provides control over a playing soundeffect. More...
 
class  clan::SoundFilter
 Sound Filter Class. More...
 
class  clan::SoundFilterProvider
 Sound Filter Interface. More...
 
class  clan::SoundOutput
 SoundOutput interface in ClanLib. More...
 
class  clan::SoundOutput_Description
 Sound output description class. More...
 
class  clan::SoundProvider
 Sound provider. More...
 
class  clan::SoundProvider_Session
 Sound provider playback session. More...
 
class  clan::SoundSSE
 Sound related functions implemented as SIMD using SSE. More...
 

Enumerations

enum  clan::SoundFormat { clan::sf_8bit_unsigned, clan::sf_16bit_signed }
 Sound Format Enums. More...
 

Selected SoundOutput accessors

static const std::string & clan::Sound::get_name ()
 Returns the name of the current sound output: More...
 
static int clan::Sound::get_mixing_frequency ()
 Returns the mixing frequency of the current sound output. More...
 
static SoundOutput clan::Sound::get_current_output ()
 Returns the current selected sound output. More...
 
static void clan::Sound::select_output (const SoundOutput &output)
 Change the current selected sound output. More...
 

Operations

static void * clan::SoundSSE::aligned_alloc (int size)
 Allocates memory that is 16-byte memory aligned. More...
 
static void clan::SoundSSE::aligned_free (void *ptr)
 Free memory allocated with aligned_alloc. More...
 
static void clan::SoundSSE::unpack_16bit_stereo (short *input, int size, float *output[2])
 Unpacks 16 bit stereo samples into separate float channels. More...
 
static void clan::SoundSSE::unpack_16bit_mono (short *input, int size, float *output)
 Unpacks 16 bit mono samples into a single float channel. More...
 
static void clan::SoundSSE::unpack_8bit_stereo (unsigned char *input, int size, float *output[2])
 Unpacks 8 bit stereo samples into separate float channels. More...
 
static void clan::SoundSSE::unpack_8bit_mono (unsigned char *input, int size, float *output)
 Unpacks 8 bit mono samples into a single float channel. More...
 
static void clan::SoundSSE::unpack_float_mono (float *input, int size, float *output)
 Unpacks float mono samples into a single float channel. More...
 
static void clan::SoundSSE::unpack_float_stereo (float *input, int size, float *output[2])
 Unpacks float stereo samples into separate float channels. More...
 
static void clan::SoundSSE::pack_16bit_stereo (float *input[2], int size, short *output)
 Packs two float channels into a single 16 bit samples stream. More...
 
static void clan::SoundSSE::pack_float_stereo (float *input[2], int size, float *output)
 Packs two float channels into a single float samples stream. More...
 
static void clan::SoundSSE::copy_float (float *input, int size, float *output)
 Copy floats from one buffer to another. More...
 
static void clan::SoundSSE::multiply_float (float *channel, int size, float volume)
 Multiplies floats with a float. More...
 
static void clan::SoundSSE::set_float (float *channel, int size, float value)
 Sets floats to a specific value. More...
 
static void clan::SoundSSE::mix_one_to_one (float *input, int size, float *output, float volume)
 Mixes one float channel with specified volume into another float channel. More...
 
static void clan::SoundSSE::mix_one_to_many (float *input, int size, float **output, float *volume, int channels)
 Mixes one float channel into many float channels with individual volumes for each channel. More...
 
static void clan::SoundSSE::mix_many_to_one (float **input, float *volume, int channels, int size, float *output)
 Mixes many float channels into one float channel with individual volumes for each channel. More...
 

Construction

 clan::SoundBuffer::SoundBuffer ()
 Construct a null instance. More...
 
 clan::SoundBuffer::SoundBuffer (SoundProvider *provider)
 Construct sound buffer. More...
 
 clan::SoundBuffer::SoundBuffer (const std::string &fullname, bool streamed=false, const std::string &format="")
 
 clan::SoundBuffer::SoundBuffer (const std::string &filename, bool streamed, const FileSystem &fs, const std::string &type="")
 
 clan::SoundBuffer::SoundBuffer (IODevice &file, bool streamed, const std::string &type)
 

Resources

static Resource< SoundBufferclan::SoundBuffer::resource (const std::string &id, const ResourceManager &resources)
 Retrieves a SoundBuffer resource from the resource manager. More...
 
static SoundBuffer clan::SoundBuffer::load (const std::string &id, const XMLResourceDocument &doc)
 Loads a SoundBuffer from a XML resource definition. More...
 
virtual clan::SoundBuffer::~SoundBuffer ()
 

Attributes

SoundProviderclan::SoundBuffer::get_provider () const
 Returns the sound provider to be used for playback. More...
 
float clan::SoundBuffer::get_volume () const
 Returns the start/default volume used when the buffer is played. More...
 
float clan::SoundBuffer::get_pan () const
 Returns the default panning position when the buffer is played. More...
 
bool clan::SoundBuffer::is_null () const
 Returns true if this object is invalid. More...
 
void clan::SoundBuffer::throw_if_null () const
 Throw an exception if this object is invalid. More...
 

Operations

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

Construction

 clan::SoundBuffer_Session::SoundBuffer_Session ()
 Creates a null instance. More...
 
virtual clan::SoundBuffer_Session::~SoundBuffer_Session ()
 

Attributes

bool clan::SoundBuffer_Session::is_null () const
 Returns true if this object is invalid. More...
 
void clan::SoundBuffer_Session::throw_if_null () const
 Throw an exception if this object is invalid. More...
 
int clan::SoundBuffer_Session::get_position () const
 Returns the current sample position of the playback. More...
 
float clan::SoundBuffer_Session::get_position_relative () const
 Returns the sample position relative to the full length. More...
 
int clan::SoundBuffer_Session::get_length () const
 Returns the total length (in samples) of the sound buffer played. More...
 
int clan::SoundBuffer_Session::get_frequency () const
 Returns the frequency of the session. More...
 
float clan::SoundBuffer_Session::get_volume () const
 Returns the linear relative volume of the soundeffect. More...
 
float clan::SoundBuffer_Session::get_pan () const
 Returns the current pan (in a measure from -1 -> 1). More...
 
bool clan::SoundBuffer_Session::get_looping () const
 Returns whether this session loops. More...
 
bool clan::SoundBuffer_Session::is_playing ()
 Returns true if the session is playing. More...
 

Operations

bool clan::SoundBuffer_Session::set_position (int new_pos)
 Sets the session position to 'new_pos'. More...
 
bool clan::SoundBuffer_Session::set_position_relative (float new_pos)
 Sets the relative position of the session. More...
 
bool clan::SoundBuffer_Session::set_end_position (int pos)
 Sets the end position within the current stream. More...
 
void clan::SoundBuffer_Session::set_frequency (int new_freq)
 Sets the frequency of the session. More...
 
void clan::SoundBuffer_Session::set_volume (float new_volume)
 Sets the volume of the session in a relative measure (0->1) More...
 
void clan::SoundBuffer_Session::set_pan (float new_pan)
 Sets the panning of the session played in measures from -1 -> 1. More...
 
void clan::SoundBuffer_Session::play ()
 Starts playback of the session. More...
 
void clan::SoundBuffer_Session::stop ()
 Stops playback of the session. More...
 
void clan::SoundBuffer_Session::set_looping (bool loop)
 Determines whether this session should loop. More...
 
void clan::SoundBuffer_Session::add_filter (SoundFilter &filter)
 Adds the sound filter to the session. See SoundFilter for details. More...
 
void clan::SoundBuffer_Session::remove_filter (SoundFilter &filter)
 Remove the sound filter from the session. See SoundFilter for details. More...
 

Implementation

class clan::SoundBuffer_Session::SoundBuffer
 
class clan::SoundBuffer_Session::SoundOutput_Impl
 

Construction

 clan::SoundFilter::SoundFilter ()
 Constructs a NULL instance. More...
 
 clan::SoundFilter::SoundFilter (SoundFilterProvider *provider)
 Constructs a sound filter. More...
 
 clan::SoundFilter::~SoundFilter ()
 

Operators

bool clan::SoundFilter::operator== (const SoundFilter &other) const
 Equality operator. More...
 
bool clan::SoundFilter::operator!= (const SoundFilter &other) const
 Inequality operator. More...
 

Operations

bool clan::SoundFilter::is_null () const
 Returns true if this object is invalid. More...
 
void clan::SoundFilter::throw_if_null () const
 Throw an exception if this object is invalid. More...
 
SoundFilterProviderclan::SoundFilter::get_provider () const
 Retrieves the provider. More...
 
void clan::SoundFilter::filter (float **sample_data, int num_samples, int channels)
 Filter callback. More...
 

Implementation

std::shared_ptr< SoundFilter_Impl > clan::SoundFilter::impl
 

Construction

 clan::SoundOutput::SoundOutput ()
 Constructs a null instance. More...
 
 clan::SoundOutput::SoundOutput (int mixing_frequency, int latency=50)
 Constructs a SoundOutput. More...
 
 clan::SoundOutput::SoundOutput (const SoundOutput_Description &desc)
 Constructs a SoundOutput. More...
 
virtual clan::SoundOutput::~SoundOutput ()
 

Attributes

bool clan::SoundOutput::is_null () const
 Returns true if this object is invalid. More...
 
void clan::SoundOutput::throw_if_null () const
 Throw an exception if this object is invalid. More...
 
const std::string & clan::SoundOutput::get_name () const
 Name of the output device. More...
 
int clan::SoundOutput::get_mixing_frequency () const
 Returns the mixing frequency for the sound output device. More...
 
int clan::SoundOutput::get_mixing_latency () const
 Returns the mixing latency in milliseconds. More...
 
float clan::SoundOutput::get_global_volume () const
 Returns the main volume of the sound output. More...
 
float clan::SoundOutput::get_global_pan () const
 Returns the main panning position of the sound output. More...
 

Operations

void clan::SoundOutput::stop_all ()
 Stops all sample playbacks on the sound output. More...
 
void clan::SoundOutput::set_global_volume (float volume)
 Sets the main/mixer volume on the sound output. More...
 
void clan::SoundOutput::set_global_pan (float pan)
 Sets the main panning position on the sound output. More...
 
void clan::SoundOutput::add_filter (SoundFilter &filter)
 Adds the sound filter to the sound output. More...
 
void clan::SoundOutput::remove_filter (SoundFilter &filter)
 Remove the sound filter from the session. More...
 

Implementation

class clan::SoundOutput::SoundBuffer
 
class clan::SoundOutput::Sound
 
class clan::SoundOutput::SoundBuffer_Session
 

Construction

 clan::SoundOutput_Description::SoundOutput_Description ()
 Constructs a sound output description. More...
 
 clan::SoundOutput_Description::~SoundOutput_Description ()
 

Attributes

int clan::SoundOutput_Description::get_mixing_frequency () const
 Returns the mixing frequency for the sound output device. More...
 
int clan::SoundOutput_Description::get_mixing_latency () const
 Returns the mixing latency in milliseconds. More...
 

Operations

void clan::SoundOutput_Description::set_mixing_frequency (int frequency)
 Sets the mixing frequency for the sound output device. More...
 
void clan::SoundOutput_Description::set_mixing_latency (int latency)
 Sets the mixing latency in milliseconds. More...
 

Construction

virtual clan::SoundFilterProvider::~SoundFilterProvider ()
 

Operations

virtual void clan::SoundFilterProvider::filter (float **sample_data, int num_samples, int channels)=0
 Filter callback. More...
 

Construction

 clan::SoundProvider::SoundProvider ()
 
virtual clan::SoundProvider::~SoundProvider ()
 

Operations

virtual SoundProvider_Sessionclan::SoundProvider::begin_session ()=0
 Called by SoundBuffer when a new session starts. More...
 
virtual void clan::SoundProvider::end_session (SoundProvider_Session *session)=0
 Called by SoundBuffer when a session has finished. After this call,. More...
 

Construction

 clan::SoundProvider_Session::SoundProvider_Session ()
 
virtual clan::SoundProvider_Session::~SoundProvider_Session ()
 

Attributes

virtual int clan::SoundProvider_Session::get_num_samples () const =0
 Returns the number of samples in the soundbuffer. More...
 
virtual int clan::SoundProvider_Session::get_frequency () const =0
 Returns the playback frequency of the input data. More...
 
virtual int clan::SoundProvider_Session::get_position () const =0
 Returns the current position in the playback stream. More...
 
virtual int clan::SoundProvider_Session::get_num_channels () const =0
 Returns the number of channels filled when get_data is called. More...
 

Operations

virtual bool clan::SoundProvider_Session::set_looping (bool)
 Enable/disable session looping. More...
 
virtual bool clan::SoundProvider_Session::eof () const =0
 Returns true if no more input data is available. More...
 
virtual void clan::SoundProvider_Session::stop ()=0
 Stops the current stream. More...
 
virtual bool clan::SoundProvider_Session::play ()=0
 Start/continue playing of the stream. More...
 
virtual bool clan::SoundProvider_Session::set_position (int pos)=0
 Sets the position within the current stream. More...
 
virtual bool clan::SoundProvider_Session::set_end_position (int pos)=0
 Sets the end position within the current stream. More...
 
virtual int clan::SoundProvider_Session::get_data (float **data_ptr, int data_requested)=0
 Called when a playback session needs more sample data. More...
 

Detailed Description

Enumeration Type Documentation

◆ SoundFormat

Sound Format Enums.

Enumerator
sf_8bit_unsigned 
sf_16bit_signed 

Function Documentation

◆ SoundBuffer() [1/5]

clan::SoundBuffer::SoundBuffer ( )

Construct a null instance.

◆ SoundBuffer() [2/5]

clan::SoundBuffer::SoundBuffer ( const std::string &  filename,
bool  streamed,
const FileSystem fs,
const std::string &  type = "" 
)

◆ SoundBuffer() [3/5]

clan::SoundBuffer::SoundBuffer ( const std::string &  fullname,
bool  streamed = false,
const std::string &  format = "" 
)

◆ SoundBuffer() [4/5]

clan::SoundBuffer::SoundBuffer ( IODevice file,
bool  streamed,
const std::string &  type 
)

◆ SoundBuffer() [5/5]

clan::SoundBuffer::SoundBuffer ( SoundProvider provider)

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.

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.

◆ SoundBuffer_Session()

clan::SoundBuffer_Session::SoundBuffer_Session ( )

Creates a null instance.

◆ SoundFilter() [1/2]

clan::SoundFilter::SoundFilter ( )
inline

Constructs a NULL instance.

◆ SoundFilter() [2/2]

clan::SoundFilter::SoundFilter ( SoundFilterProvider provider)

Constructs a sound filter.

Parameters
provider= The provider

◆ SoundOutput() [1/3]

clan::SoundOutput::SoundOutput ( )

Constructs a null instance.

◆ SoundOutput() [2/3]

clan::SoundOutput::SoundOutput ( const SoundOutput_Description desc)

Constructs a SoundOutput.

Parameters
desc= Sound Output_ Description

◆ SoundOutput() [3/3]

clan::SoundOutput::SoundOutput ( int  mixing_frequency,
int  latency = 50 
)

Constructs a SoundOutput.

Parameters
mixing_frequency= value
latency= value

◆ SoundOutput_Description()

clan::SoundOutput_Description::SoundOutput_Description ( )

Constructs a sound output description.

◆ SoundProvider()

clan::SoundProvider::SoundProvider ( )

◆ SoundProvider_Session()

clan::SoundProvider_Session::SoundProvider_Session ( )

◆ ~SoundBuffer()

virtual clan::SoundBuffer::~SoundBuffer ( )
virtual

◆ ~SoundBuffer_Session()

virtual clan::SoundBuffer_Session::~SoundBuffer_Session ( )
virtual

◆ ~SoundFilter()

clan::SoundFilter::~SoundFilter ( )

◆ ~SoundFilterProvider()

virtual clan::SoundFilterProvider::~SoundFilterProvider ( )
inlinevirtual

◆ ~SoundOutput()

virtual clan::SoundOutput::~SoundOutput ( )
virtual

◆ ~SoundOutput_Description()

clan::SoundOutput_Description::~SoundOutput_Description ( )

◆ ~SoundProvider()

virtual clan::SoundProvider::~SoundProvider ( )
virtual

◆ ~SoundProvider_Session()

virtual clan::SoundProvider_Session::~SoundProvider_Session ( )
virtual

◆ add_filter() [1/3]

void clan::SoundOutput::add_filter ( SoundFilter filter)

Adds the sound filter to the sound output.

Parameters
filterSound filter to pass sound through.

◆ add_filter() [2/3]

void clan::SoundBuffer::add_filter ( SoundFilter filter)

Adds the sound filter to the sound buffer.

Parameters
filterSound filter to pass sound through.

◆ add_filter() [3/3]

void clan::SoundBuffer_Session::add_filter ( SoundFilter filter)

Adds the sound filter to the session. See SoundFilter for details.

Parameters
filterSound filter to pass sound through.

◆ aligned_alloc()

static void* clan::SoundSSE::aligned_alloc ( int  size)
static

Allocates memory that is 16-byte memory aligned.

◆ aligned_free()

static void clan::SoundSSE::aligned_free ( void *  ptr)
static

Free memory allocated with aligned_alloc.

◆ begin_session()

virtual SoundProvider_Session* clan::SoundProvider::begin_session ( )
pure virtual

Called by SoundBuffer when a new session starts.

Returns
The soundbuffer session to be attached to the newly started session.

Implemented in clan::SoundProvider_Vorbis, clan::SoundProvider_Wave, and clan::SoundProvider_Raw.

◆ copy_float()

static void clan::SoundSSE::copy_float ( float *  input,
int  size,
float *  output 
)
static

Copy floats from one buffer to another.

◆ end_session()

virtual void clan::SoundProvider::end_session ( SoundProvider_Session session)
pure virtual

Called by SoundBuffer when a session has finished. After this call,.

SoundBuffer will not access the session anymore. It can safely be deleted here (and in most cases should be delete here).

Implemented in clan::SoundProvider_Vorbis, clan::SoundProvider_Wave, and clan::SoundProvider_Raw.

◆ eof()

virtual bool clan::SoundProvider_Session::eof ( ) const
pure virtual

Returns true if no more input data is available.

Returns
True if end of input data. False otherwise.

◆ filter() [1/2]

void clan::SoundFilter::filter ( float **  sample_data,
int  num_samples,
int  channels 
)

Filter callback.

All sound data is passed through this function, which modifies the sample data accordingly to the function of the filter.

The format of the sample data is always 16 bit stereo.

◆ filter() [2/2]

virtual void clan::SoundFilterProvider::filter ( float **  sample_data,
int  num_samples,
int  channels 
)
pure virtual

Filter callback.

All sound data is passed through this function, which modifies the sample data accordingly to the function of the filter.

The format of the sample data is always 16 bit stereo.

◆ get_current_output()

static SoundOutput clan::Sound::get_current_output ( )
static

Returns the current selected sound output.

◆ get_data()

virtual int clan::SoundProvider_Session::get_data ( float **  data_ptr,
int  data_requested 
)
pure virtual

Called when a playback session needs more sample data.

Parameters
data_ptr= Points to a buffer that should be filled with sample data.
data_requested= Samples of data requested.
Returns
Number of samples actually filled with sample data.

◆ get_frequency() [1/2]

int clan::SoundBuffer_Session::get_frequency ( ) const

Returns the frequency of the session.

◆ get_frequency() [2/2]

virtual int clan::SoundProvider_Session::get_frequency ( ) const
pure virtual

Returns the playback frequency of the input data.

Returns
Playback frequency.

◆ get_global_pan()

float clan::SoundOutput::get_global_pan ( ) const

Returns the main panning position of the sound output.

◆ get_global_volume()

float clan::SoundOutput::get_global_volume ( ) const

Returns the main volume of the sound output.

◆ get_length()

int clan::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)

◆ get_looping()

bool clan::SoundBuffer_Session::get_looping ( ) const

Returns whether this session loops.

Returns
true if session should loop, false otherwise

◆ get_mixing_frequency() [1/3]

static int clan::Sound::get_mixing_frequency ( )
static

Returns the mixing frequency of the current sound output.

◆ get_mixing_frequency() [2/3]

int clan::SoundOutput_Description::get_mixing_frequency ( ) const

Returns the mixing frequency for the sound output device.

◆ get_mixing_frequency() [3/3]

int clan::SoundOutput::get_mixing_frequency ( ) const

Returns the mixing frequency for the sound output device.

◆ get_mixing_latency() [1/2]

int clan::SoundOutput_Description::get_mixing_latency ( ) const

Returns the mixing latency in milliseconds.

◆ get_mixing_latency() [2/2]

int clan::SoundOutput::get_mixing_latency ( ) const

Returns the mixing latency in milliseconds.

◆ get_name() [1/2]

static const std::string& clan::Sound::get_name ( )
static

Returns the name of the current sound output:

◆ get_name() [2/2]

const std::string& clan::SoundOutput::get_name ( ) const

Name of the output device.

◆ get_num_channels()

virtual int clan::SoundProvider_Session::get_num_channels ( ) const
pure virtual

Returns the number of channels filled when get_data is called.

◆ get_num_samples()

virtual int clan::SoundProvider_Session::get_num_samples ( ) const
pure virtual

Returns the number of samples in the soundbuffer.

◆ get_pan() [1/2]

float clan::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.

◆ get_pan() [2/2]

float clan::SoundBuffer::get_pan ( ) const

Returns the default panning position when the buffer is played.

◆ get_position() [1/2]

int clan::SoundBuffer_Session::get_position ( ) const

Returns the current sample position of the playback.

◆ get_position() [2/2]

virtual int clan::SoundProvider_Session::get_position ( ) const
pure virtual

Returns the current position in the playback stream.

◆ get_position_relative()

float clan::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.

◆ get_provider() [1/2]

SoundFilterProvider* clan::SoundFilter::get_provider ( ) const

Retrieves the provider.

◆ get_provider() [2/2]

SoundProvider* clan::SoundBuffer::get_provider ( ) const

Returns the sound provider to be used for playback.

◆ get_volume() [1/2]

float clan::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.

◆ get_volume() [2/2]

float clan::SoundBuffer::get_volume ( ) const

Returns the start/default volume used when the buffer is played.

◆ is_null() [1/4]

bool clan::SoundBuffer_Session::is_null ( ) const
inline

Returns true if this object is invalid.

◆ is_null() [2/4]

bool clan::SoundOutput::is_null ( ) const
inline

Returns true if this object is invalid.

◆ is_null() [3/4]

bool clan::SoundFilter::is_null ( ) const
inline

Returns true if this object is invalid.

References clan::SoundFilter::impl.

◆ is_null() [4/4]

bool clan::SoundBuffer::is_null ( ) const
inline

Returns true if this object is invalid.

◆ is_playing()

bool clan::SoundBuffer_Session::is_playing ( )

Returns true if the session is playing.

◆ load()

static SoundBuffer clan::SoundBuffer::load ( const std::string &  id,
const XMLResourceDocument doc 
)
static

Loads a SoundBuffer from a XML resource definition.

◆ mix_many_to_one()

static void clan::SoundSSE::mix_many_to_one ( float **  input,
float *  volume,
int  channels,
int  size,
float *  output 
)
static

Mixes many float channels into one float channel with individual volumes for each channel.

◆ mix_one_to_many()

static void clan::SoundSSE::mix_one_to_many ( float *  input,
int  size,
float **  output,
float *  volume,
int  channels 
)
static

Mixes one float channel into many float channels with individual volumes for each channel.

◆ mix_one_to_one()

static void clan::SoundSSE::mix_one_to_one ( float *  input,
int  size,
float *  output,
float  volume 
)
static

Mixes one float channel with specified volume into another float channel.

◆ multiply_float()

static void clan::SoundSSE::multiply_float ( float *  channel,
int  size,
float  volume 
)
static

Multiplies floats with a float.

◆ operator!=()

bool clan::SoundFilter::operator!= ( const SoundFilter other) const
inline

Inequality operator.

References clan::SoundFilter::impl.

◆ operator==()

bool clan::SoundFilter::operator== ( const SoundFilter other) const
inline

Equality operator.

References clan::SoundFilter::impl.

◆ pack_16bit_stereo()

static void clan::SoundSSE::pack_16bit_stereo ( float *  input[2],
int  size,
short *  output 
)
static

Packs two float channels into a single 16 bit samples stream.

◆ pack_float_stereo()

static void clan::SoundSSE::pack_float_stereo ( float *  input[2],
int  size,
float *  output 
)
static

Packs two float channels into a single float samples stream.

◆ play() [1/3]

void clan::SoundBuffer_Session::play ( )

Starts playback of the session.

◆ play() [2/3]

virtual bool clan::SoundProvider_Session::play ( )
pure virtual

Start/continue playing of the stream.

Returns
True for success. False otherwise.

◆ play() [3/3]

SoundBuffer_Session clan::SoundBuffer::play ( bool  looping = false,
SoundOutput output = nullptr 
)

Plays the soundbuffer on the specified soundcard.

Parameters
loopinglooping
outputSound output to be used - NULL means use the current selected sound output (Sound::get_selected_output().
Returns
The playback session.

◆ prepare()

SoundBuffer_Session clan::SoundBuffer::prepare ( bool  looping = false,
SoundOutput output = nullptr 
)

Prepares the soundbuffer for playback on the specified soundcard.

Parameters
outputSound output to be used - NULL means use the current selected sound output (Sound::get_selected_output().
Returns
The playback session.

◆ remove_filter() [1/3]

void clan::SoundOutput::remove_filter ( SoundFilter filter)

Remove the sound filter from the session.

◆ remove_filter() [2/3]

void clan::SoundBuffer::remove_filter ( SoundFilter filter)

Remove the sound filter from the sound buffer.

◆ remove_filter() [3/3]

void clan::SoundBuffer_Session::remove_filter ( SoundFilter filter)

Remove the sound filter from the session. See SoundFilter for details.

◆ resource()

static Resource<SoundBuffer> clan::SoundBuffer::resource ( const std::string &  id,
const ResourceManager resources 
)
static

Retrieves a SoundBuffer resource from the resource manager.

Parameters
gc= Graphic Context
resources= Resource manager
id= id

◆ select_output()

static void clan::Sound::select_output ( const SoundOutput output)
static

Change the current selected sound output.

Parameters
outputThe new current selected sound output.

◆ set_end_position() [1/2]

bool clan::SoundBuffer_Session::set_end_position ( int  pos)

Sets the end position within the current stream.

Parameters
pos= End position.
Returns
True for success. False otherwise.

◆ set_end_position() [2/2]

virtual bool clan::SoundProvider_Session::set_end_position ( int  pos)
pure virtual

Sets the end position within the current stream.

Parameters
pos= End position.
Returns
True for success. False otherwise.

◆ set_float()

static void clan::SoundSSE::set_float ( float *  channel,
int  size,
float  value 
)
static

Sets floats to a specific value.

◆ set_frequency()

void clan::SoundBuffer_Session::set_frequency ( int  new_freq)

Sets the frequency of the session.

Parameters
new_freqNew frequency of session.

◆ set_global_pan()

void clan::SoundOutput::set_global_pan ( float  pan)

Sets the main panning position on the sound output.

◆ set_global_volume()

void clan::SoundOutput::set_global_volume ( float  volume)

Sets the main/mixer volume on the sound output.

◆ set_looping() [1/2]

void clan::SoundBuffer_Session::set_looping ( bool  loop)

Determines whether this session should loop.

Parameters
looptrue if session should loop, false otherwise

◆ set_looping() [2/2]

virtual bool clan::SoundProvider_Session::set_looping ( bool  )
inlinevirtual

Enable/disable session looping.

If this function returns false (default), the clanSound mixer will manually try to simulate looping by setting the position to 0 when eof is encountered.

◆ set_mixing_frequency()

void clan::SoundOutput_Description::set_mixing_frequency ( int  frequency)

Sets the mixing frequency for the sound output device.

◆ set_mixing_latency()

void clan::SoundOutput_Description::set_mixing_latency ( int  latency)

Sets the mixing latency in milliseconds.

◆ set_pan() [1/2]

void clan::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_panNew pan of the sound buffer played.

◆ set_pan() [2/2]

void clan::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_panNew pan of the session played.
Returns
Returns true if the operation completed sucecsfully.

◆ set_position() [1/2]

bool clan::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.

◆ set_position() [2/2]

virtual bool clan::SoundProvider_Session::set_position ( int  pos)
pure virtual

Sets the position within the current stream.

Parameters
posPosition to seek to.
Returns
True for success. False otherwise.

◆ set_position_relative()

bool clan::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_posNew relative position.
Returns
Returns true if operation completed succesfully.

◆ set_volume() [1/2]

void clan::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_volumeNew volume of sound buffer.

◆ set_volume() [2/2]

void clan::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_volumeNew volume of session.
Returns
Returns true if the operation completed succesfully.

◆ stop() [1/2]

void clan::SoundBuffer_Session::stop ( )

Stops playback of the session.

◆ stop() [2/2]

virtual void clan::SoundProvider_Session::stop ( )
pure virtual

Stops the current stream.

◆ stop_all()

void clan::SoundOutput::stop_all ( )

Stops all sample playbacks on the sound output.

◆ throw_if_null() [1/4]

void clan::SoundBuffer_Session::throw_if_null ( ) const

Throw an exception if this object is invalid.

◆ throw_if_null() [2/4]

void clan::SoundOutput::throw_if_null ( ) const

Throw an exception if this object is invalid.

◆ throw_if_null() [3/4]

void clan::SoundFilter::throw_if_null ( ) const

Throw an exception if this object is invalid.

◆ throw_if_null() [4/4]

void clan::SoundBuffer::throw_if_null ( ) const

Throw an exception if this object is invalid.

◆ unpack_16bit_mono()

static void clan::SoundSSE::unpack_16bit_mono ( short *  input,
int  size,
float *  output 
)
static

Unpacks 16 bit mono samples into a single float channel.

◆ unpack_16bit_stereo()

static void clan::SoundSSE::unpack_16bit_stereo ( short *  input,
int  size,
float *  output[2] 
)
static

Unpacks 16 bit stereo samples into separate float channels.

◆ unpack_8bit_mono()

static void clan::SoundSSE::unpack_8bit_mono ( unsigned char *  input,
int  size,
float *  output 
)
static

Unpacks 8 bit mono samples into a single float channel.

◆ unpack_8bit_stereo()

static void clan::SoundSSE::unpack_8bit_stereo ( unsigned char *  input,
int  size,
float *  output[2] 
)
static

Unpacks 8 bit stereo samples into separate float channels.

◆ unpack_float_mono()

static void clan::SoundSSE::unpack_float_mono ( float *  input,
int  size,
float *  output 
)
static

Unpacks float mono samples into a single float channel.

◆ unpack_float_stereo()

static void clan::SoundSSE::unpack_float_stereo ( float *  input,
int  size,
float *  output[2] 
)
static

Unpacks float stereo samples into separate float channels.

Variable Documentation

◆ impl

std::shared_ptr<SoundFilter_Impl> clan::SoundFilter::impl

Friends

◆ Sound

friend class Sound
friend

◆ SoundBuffer [1/2]

friend class SoundBuffer
friend

◆ SoundBuffer [2/2]

friend class SoundBuffer
friend

◆ SoundBuffer_Session

friend class SoundBuffer_Session
friend

◆ SoundOutput_Impl

friend class SoundOutput_Impl
friend