SAL
A C++ library for spatial audio.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | List of all members
sal::Buffer Class Reference

#include <audiobuffer.h>

Inheritance diagram for sal::Buffer:
sal::HoaBuffer sal::MonoBuffer sal::StereoBuffer

Public Types

enum  ChannelLabels { kMonoChannel = 0, kLeftChannel = 0, kRightChannel = 1 }
 

Public Member Functions

 Buffer (const Int num_channels, const Int num_samples)
 
 Buffer ()
 
 Buffer (Sample **data_referenced, const Int num_channels, const Int num_samples) noexcept
 
virtual Int num_channels () const noexcept
 
virtual Int num_samples () const noexcept
 
Sample GetSample (Int channel_id, Int sample_id) const noexcept
 
bool IsDataOwner () const noexcept
 
void SetSample (const Int channel_id, const Int sample_id, const Sample sample) noexcept
 
void SetSamples (const Int channel_id, const Int from_sample_id, const Int num_samples, const Sample *samples) noexcept
 
void SetSamples (const Buffer &other) noexcept
 
void AddSamples (const Int channel_id, const Int from_sample_id, const Int num_samples, const Sample *samples) noexcept
 
void MultiplyAddSamples (const Int channel_id, const Int from_sample_id, const Int num_samples, const Sample *samples, const Sample constant) noexcept
 
void FilterAddSamples (const Int channel_id, const Int from_sample_id, const Int num_samples, const Sample *samples, mcl::DigitalFilter &filter) noexcept
 
const SampleGetReadPointer (const Int channel_id) const noexcept
 
SampleGetWritePointer (const Int channel_id) noexcept
 
Sample ** GetWritePointers () noexcept
 
virtual void AddSamples (const Buffer &buffer) noexcept
 
void SetFrame (const Int channel_id, const Int frame_id, const Int frame_length, const Signal &signal)
 
void PrintData ()
 
virtual void Reset () noexcept
 
 Buffer (const Buffer &other)
 
Bufferoperator= (const Buffer &other)
 
virtual ~Buffer ()
 

Static Public Member Functions

static bool Test ()
 

Member Enumeration Documentation

Enumerator:
kMonoChannel 
kLeftChannel 
kRightChannel 

Constructor & Destructor Documentation

sal::Buffer::Buffer ( const Int  num_channels,
const Int  num_samples 
)
inline

Constructs a multichannel buffer.

sal::Buffer::Buffer ( )
inline
sal::Buffer::Buffer ( Sample **  data_referenced,
const Int  num_channels,
const Int  num_samples 
)
inlinenoexcept

Constructs a multichannel buffer as a reference to another data structure. If constructed in this way, this object will not own the data.

Parameters
[in]data_referencedthe data structure which we are referencing to.
[in]num_channelsthe number of channels for the data structure we are referencing to.
[in]num_samplesthe number of samples for the data structure we are referencing to.
sal::Buffer::Buffer ( const Buffer other)
inline
virtual sal::Buffer::~Buffer ( )
inlinevirtual

Member Function Documentation

void sal::Buffer::AddSamples ( const Int  channel_id,
const Int  from_sample_id,
const Int  num_samples,
const Sample samples 
)
inlinenoexcept

Adds samples to current sample values in the buffer.

Parameters
[in]channel_idThe ID of the channel.
[in]from_sample_idThe index of the first sample we want to modify.
[in]num_samplesThe number of samples we want to modify.
[in]samplesThe new samples.
virtual void sal::Buffer::AddSamples ( const Buffer buffer)
inlinevirtualnoexcept

Adds all the samples from another buffer. The buffer has to be of the same type and have the same number of channels and samples (checked only through debugging asserts).

void sal::Buffer::FilterAddSamples ( const Int  channel_id,
const Int  from_sample_id,
const Int  num_samples,
const Sample samples,
mcl::DigitalFilter &  filter 
)
inlinenoexcept
const Sample* sal::Buffer::GetReadPointer ( const Int  channel_id) const
inlinenoexcept
Sample sal::Buffer::GetSample ( Int  channel_id,
Int  sample_id 
) const
inlinenoexcept
Sample* sal::Buffer::GetWritePointer ( const Int  channel_id)
inlinenoexcept
Sample** sal::Buffer::GetWritePointers ( )
inlinenoexcept
bool sal::Buffer::IsDataOwner ( ) const
inlinenoexcept
void sal::Buffer::MultiplyAddSamples ( const Int  channel_id,
const Int  from_sample_id,
const Int  num_samples,
const Sample samples,
const Sample  constant 
)
inlinenoexcept

This method first multiplies all the input samples by a certain constant and then adds the result to the samples in the buffer.

virtual Int sal::Buffer::num_channels ( ) const
inlinevirtualnoexcept
virtual Int sal::Buffer::num_samples ( ) const
inlinevirtualnoexcept
Buffer& sal::Buffer::operator= ( const Buffer other)
inline

Copy assignment operator. If you are trying to assign the object onto itself, this operator has no effect. Also, there is no effect if you try to assign a buffer that is referencing itself. For instance, if A is a buffer that owns the data, and B is a buffer that refers to A's data, then the assignment A = B has no effect.

void sal::Buffer::PrintData ( )
inline
virtual void sal::Buffer::Reset ( )
inlinevirtualnoexcept

Resets all the values to zero.

void sal::Buffer::SetFrame ( const Int  channel_id,
const Int  frame_id,
const Int  frame_length,
const Signal signal 
)
inline
void sal::Buffer::SetSample ( const Int  channel_id,
const Int  sample_id,
const Sample  sample 
)
inlinenoexcept
void sal::Buffer::SetSamples ( const Int  channel_id,
const Int  from_sample_id,
const Int  num_samples,
const Sample samples 
)
inlinenoexcept

Reassigns the values of a set of contigous samples in the buffer.

Parameters
[in]channel_idThe ID of the channel.
[in]from_sample_idThe index of the first sample we want to modify.
[in]num_samplesThe number of samples we want to modify.
[in]samplesThe new samples.
void sal::Buffer::SetSamples ( const Buffer other)
inlinenoexcept
bool sal::Buffer::Test ( )
static

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