Classes | Enumerations | Enumerator
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< SoundBuffer > | clan::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
SoundProvider * | clan::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...
SoundFilterProvider * | clan::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_Session * | clan::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

enum clan::SoundFormat

Sound Format Enums.

Enumerator
sf_8bit_unsigned |
sf_16bit_signed |

## Function Documentation

clan::SoundBuffer::SoundBuffer | ( |  | ) |

Construct a null instance.

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.

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

clan::SoundBuffer_Session::SoundBuffer_Session | ( |  | ) |

Creates a null instance.

clan::SoundFilter::SoundFilter | ( |  | ) |
| inline

Constructs a NULL instance.

clan::SoundFilter::SoundFilter | ( | SoundFilterProvider * | provider | ) |

Constructs a sound filter.

Parameters

  provider | = The provider

clan::SoundOutput::SoundOutput | ( |  | ) |

Constructs a null instance.

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

Constructs a SoundOutput.

Parameters

  mixing_frequency | = value
  latency | = value

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

Constructs a SoundOutput.

Parameters

  desc | = Sound Output_ Description

clan::SoundOutput_Description::SoundOutput_Description | ( |  | ) |

Constructs a sound output description.

clan::SoundProvider::SoundProvider | ( |  | ) |

clan::SoundProvider_Session::SoundProvider_Session | ( |  | ) |

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

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

clan::SoundFilter::~SoundFilter | ( |  | ) |

virtual clan::SoundFilterProvider::~SoundFilterProvider | ( |  | ) |
| inline virtual

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

clan::SoundOutput_Description::~SoundOutput_Description | ( |  | ) |

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

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

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

Adds the sound filter to the sound output.

Parameters

  filter | Sound filter to pass sound through.

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

Adds the sound filter to the sound buffer.

Parameters

  filter | Sound filter to pass sound through.

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

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

Parameters

  filter | Sound filter to pass sound through.

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

Allocates memory that is 16-byte memory aligned.

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

Free memory allocated with aligned_alloc.

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.

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

Copy floats from one buffer to another.

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.

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.

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.

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.

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

Returns the current selected sound output.

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.

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

Returns the playback frequency of the input data.

Returns
  Playback frequency.

int clan::SoundBuffer_Session::get_frequency | ( |  | ) | const

Returns the frequency of the session.

float clan::SoundOutput::get_global_pan | ( |  | ) | const

Returns the main panning position of the sound output.

float clan::SoundOutput::get_global_volume | ( |  | ) | const

Returns the main volume of the sound output.

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)

bool clan::SoundBuffer_Session::get_looping | ( |  | ) | const

Returns whether this session loops.

Returns
  true if session should loop, false otherwise

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

Returns the mixing frequency of the current sound output.

int clan::SoundOutput_Description::get_mixing_frequency | ( |  | ) | const

Returns the mixing frequency for the sound output device.

int clan::SoundOutput::get_mixing_frequency | ( |  | ) | const

Returns the mixing frequency for the sound output device.

int clan::SoundOutput_Description::get_mixing_latency | ( |  | ) | const

Returns the mixing latency in milliseconds.

int clan::SoundOutput::get_mixing_latency | ( |  | ) | const

Returns the mixing latency in milliseconds.

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

Returns the name of the current sound output:

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

Name of the output device.

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

Returns the number of channels filled when get_data is called.

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

Returns the number of samples in the soundbuffer.

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.

float clan::SoundBuffer::get_pan | ( |  | ) | const

Returns the default panning position when the buffer is played.

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

Returns the current position in the playback stream.

int clan::SoundBuffer_Session::get_position | ( |  | ) | const

Returns the current sample position of the playback.

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.

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

Retrieves the provider.

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

Returns the sound provider to be used for playback.

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.

float clan::SoundBuffer::get_volume | ( |  | ) | const

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

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

Returns true if this object is invalid.

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

Returns true if this object is invalid.

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

Returns true if this object is invalid.

References clan::SoundFilter::impl.

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

Returns true if this object is invalid.

bool clan::SoundBuffer_Session::is_playing | ( |  | ) |

Returns true if the session is playing.

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

Loads a SoundBuffer from a XML resource definition.

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.

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.

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.

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

Multiplies floats with a float.

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

Inequality operator.

References clan::SoundFilter::impl.

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

Equality operator.

References clan::SoundFilter::impl.

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.

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.

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

Start/continue playing of the stream.

Returns
  True for success. False otherwise.

void clan::SoundBuffer_Session::play | ( |  | ) |

Starts playback of the session.

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

Plays the soundbuffer on the specified soundcard.

Parameters

  looping | looping
  output | Sound output to be used - NULL means use the current selected sound output (Sound::get_selected_output().

Returns
  The playback session.

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

Prepares the soundbuffer for playback on the specified soundcard.

Parameters

  output | Sound output to be used - NULL means use the current selected sound output (Sound::get_selected_output().

Returns
  The playback session.

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

Remove the sound filter from the session.

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

Remove the sound filter from the sound buffer.

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

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

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

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

Change the current selected sound output.

Parameters

  output | The new current selected sound output.

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.

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.

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

Sets floats to a specific value.

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

Sets the frequency of the session.

Parameters

  new_freq | New frequency of session.

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

Sets the main panning position on the sound output.

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

Sets the main/mixer volume on the sound output.

virtual bool clan::SoundProvider_Session::set_looping | ( | bool |  | ) |
| inline virtual

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.

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

Determines whether this session should loop.

Parameters

  loop | true if session should loop, false otherwise

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

Sets the mixing frequency for the sound output device.

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

Sets the mixing latency in milliseconds.

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_pan | New pan of the sound buffer played.

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_pan | New pan of the session played.

Returns
  Returns true if the operation completed sucecsfully.

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

Sets the position within the current stream.

Parameters

  pos | Position to seek to.

Returns
  True for success. False otherwise.

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.

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_pos | New relative position.

Returns
  Returns true if operation completed succesfully.

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_volume | New volume of sound buffer.

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_volume | New volume of session.

Returns
  Returns true if the operation completed succesfully.

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

Stops the current stream.

void clan::SoundBuffer_Session::stop | ( |  | ) |

Stops playback of the session.

void clan::SoundOutput::stop_all | ( |  | ) |

Stops all sample playbacks on the sound output.

void clan::SoundBuffer_Session::throw_if_null | ( |  | ) | const

Throw an exception if this object is invalid.

void clan::SoundOutput::throw_if_null | ( |  | ) | const

Throw an exception if this object is invalid.

void clan::SoundFilter::throw_if_null | ( |  | ) | const

Throw an exception if this object is invalid.

void clan::SoundBuffer::throw_if_null | ( |  | ) | const

Throw an exception if this object is invalid.

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

Unpacks 16 bit mono samples into a single float channel.

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

Unpacks 16 bit stereo samples into separate float channels.

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.

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.

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

Unpacks float mono samples into a single float channel.

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

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

Referenced by clan::SoundFilter::is_null(), clan::SoundFilter::operator!=(), and clan::SoundFilter::operator==().

## Friends

friend class Sound
| friend

friend class SoundBuffer
| friend

friend class SoundBuffer
| friend

friend class SoundBuffer_Session
| friend

friend class SoundOutput_Impl
| friend