libvisual  0.5.0
Public Member Functions | Static Public Member Functions | List of all members
LV::Audio Class Reference

Multi-channel audio stream class. More...

#include <libvisual/lv_audio.h>

Public Member Functions

 Audio ()
 Default constructor.
 
 Audio (Audio const &)=delete
 
 Audio (Audio &&rhs)
 Move constructor.
 
 ~Audio ()
 Destructor.
 
Audiooperator= (Audio const &)=delete
 
Audiooperator= (Audio &&rhs)
 Move assignment operator.
 
bool get_sample (BufferPtr const &buffer, std::string const &channel_name)
 Retrieves samples from a channel. More...
 
void get_sample_mixed_simple (BufferPtr const &buffer, unsigned int channels,...)
 Returns samples downmixed by averaging a set of channels. More...
 
void get_sample_mixed_simple (BufferPtr const &buffer, unsigned int channels, va_list args)
 
void get_sample_mixed (BufferPtr const &buffer, bool divide, unsigned int channels,...)
 Returns samples downmixed by weighted summing or averaging a set of channels. More...
 
void get_sample_mixed (BufferPtr const &buffer, bool divide, unsigned int channels, va_list args)
 
void get_spectrum (BufferPtr const &buffer, std::size_t sample_count, std::string const &channel_name, bool normalised)
 Returns the amplitude spectrum of a set of samples from a channel. More...
 
void get_spectrum (BufferPtr const &buffer, std::size_t sample_count, std::string const &channel_name, bool normalised, float multiplier)
 
void input (BufferPtr const &buffer, VisAudioSampleRateType rate, VisAudioSampleFormatType format, VisAudioSampleChannelType channel_type)
 Adds an interleaved set of samples to the stream. More...
 
void input (BufferPtr const &buffer, VisAudioSampleRateType rate, VisAudioSampleFormatType format, std::string const &channel_name)
 Adds a set of channel samples to the stream. More...
 

Static Public Member Functions

static void get_spectrum_for_sample (BufferPtr const &buffer, BufferConstPtr const &samples, bool normalised)
 Returns the amplitude spectrum of a set of samples. More...
 
static void get_spectrum_for_sample (BufferPtr const &buffer, BufferConstPtr const &samples, bool normalised, float multiplier)
 
static void normalise_spectrum (BufferPtr const &buffer)
 

Detailed Description

Multi-channel audio stream class.

Note
Samples are stored as 32-bit floating point PCM at 44.1kHz.

Definition at line 79 of file lv_audio.h.

Member Function Documentation

bool LV::Audio::get_sample ( BufferPtr const &  buffer,
std::string const &  channel_name 
)

Retrieves samples from a channel.

Note
Output samples will be truncated to fit the user-supplied buffer.
Parameters
[out]bufferbuffer to hold the retrieved samples (32-bit floating point PCM)
channel_namename of channel
Returns
true if successful, false if channel does not exist

Definition at line 143 of file lv_audio.cpp.

Referenced by get_spectrum().

void LV::Audio::get_sample_mixed ( BufferPtr const &  buffer,
bool  divide,
unsigned int  channels,
  ... 
)

Returns samples downmixed by weighted summing or averaging a set of channels.

Note
Output samples will be truncated to fit the user-supplied buffer.
Parameters
[out]bufferbuffer to hold the mixed samples (32-bit floating point PCM)
divideperform averaging
channelsnumber of channels
...list of channel names (each of type const char *), followed by a list of respective weights (each of type double)

Definition at line 188 of file lv_audio.cpp.

void LV::Audio::get_sample_mixed_simple ( BufferPtr const &  buffer,
unsigned int  channels,
  ... 
)

Returns samples downmixed by averaging a set of channels.

Note
Output samples will be truncated to fit the user-supplied buffer.
Parameters
[out]bufferbuffer to hold the mixed samples (32-bit floating point PCM)
channelsnumber of channels
...list of channel names (each of type const char *)

Definition at line 157 of file lv_audio.cpp.

void LV::Audio::get_spectrum ( BufferPtr const &  buffer,
std::size_t  sample_count,
std::string const &  channel_name,
bool  normalised 
)

Returns the amplitude spectrum of a set of samples from a channel.

Note
The output spectrum will be truncated to fit the user-supplied buffer.
Parameters
[out]bufferbuffer to hold the amplitude spectrum (32-bit floats)
sample_countnumber of samples to draw from channel
channel_namename of channel
normalisednormalise ampltitudes to [0.0, 1.0]

Definition at line 223 of file lv_audio.cpp.

void LV::Audio::get_spectrum_for_sample ( BufferPtr const &  buffer,
BufferConstPtr const &  samples,
bool  normalised 
)
static

Returns the amplitude spectrum of a set of samples.

Note
The output spectrum will be truncated to fit the user-supplied buffer.
Parameters
[out]bufferbuffer to hold the ampltitude spectrum (32-bit floats)
samplesinput samples
normalisednormalise ampltitudes to [0.0, 1.0]

Definition at line 243 of file lv_audio.cpp.

Referenced by get_spectrum().

void LV::Audio::input ( BufferPtr const &  buffer,
VisAudioSampleRateType  rate,
VisAudioSampleFormatType  format,
VisAudioSampleChannelType  channel_type 
)

Adds an interleaved set of samples to the stream.

Parameters
bufferbuffer containing the input samples
ratesampling rate
formatsample format
channel_typechannel format

Definition at line 273 of file lv_audio.cpp.

void LV::Audio::input ( BufferPtr const &  buffer,
VisAudioSampleRateType  rate,
VisAudioSampleFormatType  format,
std::string const &  channel_name 
)

Adds a set of channel samples to the stream.

Parameters
bufferbuffer containing the input samples
ratesampling rate
formatsample format
channel_namename of channel

Definition at line 308 of file lv_audio.cpp.


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