AuxPort 0.2
Modules for Audio Software Development
Loading...
Searching...
No Matches
AuxPort::Audio::Buffer< sample > Class Template Reference

Buffer is a Generic Audio Buffer class that is a container for floating or integer type Audio Buffers. More...

#include <AuxBuffer.h>

Inheritance diagram for AuxPort::Audio::Buffer< sample >:
AuxPort::ILog

Public Member Functions

 Buffer ()=default
 Initializes the class.
 
 Buffer (const sample *array, const size_t &size)
 Initializes Buffer with an array.
 
 Buffer (const std::vector< sample > &buffer)
 Initializes Buffer with an std::vector.
 
 Buffer (const Buffer< sample > &newBuffer)
 Initializes Buffer with another Buffer.
 
 ~Buffer ()
 Safely Deallocates memory and destroys the Buffer | v1.0.
 
const sample & get (const size_t &index) const
 Returns a sample value at the provided index on the Buffer.
 
const sample & operator[] (const size_t &index) const
 Returns a sample value at the provided index on the Buffer.
 
void set (const sample &value, const size_t &index)
 Sets the sample to the specified index.
 
void replace (const sample *buffer, const size_t &size)
 Replaces the audio buffer with a buffer pointer.
 
void replace (const std::vector< sample > &buffer)
 Replaces the audio buffer with a std::vector.
 
void replace (const AuxPort::Audio::Buffer< sample > &buffer)
 Replaces the audio buffer with a std::vector.
 
void add (const sample &value)
 Adds a constant to every single value of the Audio Buffer.
 
void add (const sample &value, size_t index)
 Adds coefficient to the value in the Audio Buffer at the specified "index".
 
void add (const std::vector< sample > &buffer)
 of std::vector to the Audio Buffer
 
void add (sample *buffer, const size_t &size)
 Addition of values in a C-Style array to the Audio Buffer.
 
void add (const AuxPort::Audio::Buffer< sample > &buffer)
 Addition of Two Audio Buffers.
 
void multiply (const sample &value)
 Multiplies coefficient to every single value of the Audio Buffer.
 
void multiply (const sample &value, const size_t &index)
 Multiplies coefficient to the value in the Audio Buffer at the specified "index".
 
void divide (const sample &value)
 Divides coefficient from every single value of the Audio Buffer.
 
void divide (const sample &value, const size_t &index)
 Performs division between the value in the Audio Buffer at the specified "index" and the "value" passed.
 
void subtract (const sample &value)
 Subtracts coefficient from every single value of the Audio Buffer.
 
void subtract (const sample &value, size_t index)
 Performs subtraction between the value in the Audio Buffer at the specified "index" and the "value" passed.
 
void resize (const size_t &size)
 Resizes the audio buffer to the size given in the argument.
 
double getRMS (bool dBFS=true) const
 Calculates the RMS in Linear/dbFS.
 
size_t size () const
 Returns Size of Buffer.
 
void Log () override
 Overloaded AuxPort::ILog::Log.
 
void operator= (const Buffer< sample > &buffer)
 Overloaded Assignment Operator.
 
void operator= (const std::vector< sample > &buffer)
 Overloaded Assignment Operator.
 
bool operator== (const Buffer< sample > &buffer) const
 Checks if two Audio Buffers have equal values.
 
void zeroPad (size_t startIndex, size_t endIndex)
 Zero Pad an Audio Buffer.
 
void subBuffer (AuxPort::Audio::Buffer< sample > &subBuffer, const size_t &startIndex, const size_t &endIndex)
 Extract a Sub Buffer from an Audio Buffer.
 
double mean ()
 Averages the Audio buffer.
 

Friends

std::ostream & operator<< (std::ostream &out, const Buffer< sample > &buffer)
 Overloaded ostream operator, u can use std::cout to call AuxPort::Logger::Log()
 

Additional Inherited Members

- Protected Member Functions inherited from AuxPort::ILog
void setColour (const ColourType &colourType)
 This function allows you to set text colour for the text to be printed onto the console.
 

Detailed Description

template<class sample>
class AuxPort::Audio::Buffer< sample >

Buffer is a Generic Audio Buffer class that is a container for floating or integer type Audio Buffers.

Parameters
sampleTemplate Type used for Generic Audio Buffers

Definition at line 57 of file AuxBuffer.h.

Constructor & Destructor Documentation

◆ Buffer() [1/3]

template<class sample >
AuxPort::Audio::Buffer< sample >::Buffer ( const sample * array,
const size_t & size )
inline

Initializes Buffer with an array.

Definition at line 69 of file AuxBuffer.h.

◆ Buffer() [2/3]

template<class sample >
AuxPort::Audio::Buffer< sample >::Buffer ( const std::vector< sample > & buffer)
inline

Initializes Buffer with an std::vector.

Definition at line 77 of file AuxBuffer.h.

◆ Buffer() [3/3]

template<class sample >
AuxPort::Audio::Buffer< sample >::Buffer ( const Buffer< sample > & newBuffer)
inline

Initializes Buffer with another Buffer.

Definition at line 85 of file AuxBuffer.h.

◆ ~Buffer()

template<class sample >
AuxPort::Audio::Buffer< sample >::~Buffer ( )
inline

Safely Deallocates memory and destroys the Buffer | v1.0.

Definition at line 93 of file AuxBuffer.h.

Member Function Documentation

◆ add() [1/5]

template<class sample >
void AuxPort::Audio::Buffer< sample >::add ( const AuxPort::Audio::Buffer< sample > & buffer)
inline

Addition of Two Audio Buffers.

Note
Assertion: Size of the Buffer passed should <= Size of the meta buffer

Definition at line 241 of file AuxBuffer.h.

◆ add() [2/5]

template<class sample >
void AuxPort::Audio::Buffer< sample >::add ( const sample & value)
inline

Adds a constant to every single value of the Audio Buffer.

Definition at line 198 of file AuxBuffer.h.

◆ add() [3/5]

template<class sample >
void AuxPort::Audio::Buffer< sample >::add ( const sample & value,
size_t index )
inline

Adds coefficient to the value in the Audio Buffer at the specified "index".

Definition at line 209 of file AuxBuffer.h.

◆ add() [4/5]

template<class sample >
void AuxPort::Audio::Buffer< sample >::add ( const std::vector< sample > & buffer)
inline

of std::vector to the Audio Buffer

Note
Assertion: Size of the std::vector passed should <= size of the audio buffer

Definition at line 219 of file AuxBuffer.h.

◆ add() [5/5]

template<class sample >
void AuxPort::Audio::Buffer< sample >::add ( sample * buffer,
const size_t & size )
inline

Addition of values in a C-Style array to the Audio Buffer.

Note
Assertion: Size of the C-Style buffer passed should <= size of the audio buffer

Definition at line 230 of file AuxBuffer.h.

◆ divide() [1/2]

template<class sample >
void AuxPort::Audio::Buffer< sample >::divide ( const sample & value)
inline

Divides coefficient from every single value of the Audio Buffer.

Definition at line 271 of file AuxBuffer.h.

◆ divide() [2/2]

template<class sample >
void AuxPort::Audio::Buffer< sample >::divide ( const sample & value,
const size_t & index )
inline

Performs division between the value in the Audio Buffer at the specified "index" and the "value" passed.

Definition at line 281 of file AuxBuffer.h.

◆ get()

template<class sample >
const sample & AuxPort::Audio::Buffer< sample >::get ( const size_t & index) const
inline

Returns a sample value at the provided index on the Buffer.

Note
Assertion: Thrown when index provided is greater than size of Buffer

Definition at line 104 of file AuxBuffer.h.

◆ getRMS()

template<class sample >
double AuxPort::Audio::Buffer< sample >::getRMS ( bool dBFS = true) const
inline

Calculates the RMS in Linear/dbFS.

Definition at line 323 of file AuxBuffer.h.

◆ Log()

template<class sample >
void AuxPort::Audio::Buffer< sample >::Log ( )
inlineoverridevirtual

Overloaded AuxPort::ILog::Log.

Reimplemented from AuxPort::ILog.

Definition at line 372 of file AuxBuffer.h.

◆ mean()

template<class sample >
double AuxPort::Audio::Buffer< sample >::mean ( )
inline

Averages the Audio buffer.

Definition at line 440 of file AuxBuffer.h.

◆ multiply() [1/2]

template<class sample >
void AuxPort::Audio::Buffer< sample >::multiply ( const sample & value)
inline

Multiplies coefficient to every single value of the Audio Buffer.

Definition at line 251 of file AuxBuffer.h.

◆ multiply() [2/2]

template<class sample >
void AuxPort::Audio::Buffer< sample >::multiply ( const sample & value,
const size_t & index )
inline

Multiplies coefficient to the value in the Audio Buffer at the specified "index".

Definition at line 262 of file AuxBuffer.h.

◆ operator=() [1/2]

template<class sample >
void AuxPort::Audio::Buffer< sample >::operator= ( const Buffer< sample > & buffer)
inline

Overloaded Assignment Operator.

Definition at line 382 of file AuxBuffer.h.

◆ operator=() [2/2]

template<class sample >
void AuxPort::Audio::Buffer< sample >::operator= ( const std::vector< sample > & buffer)
inline

Overloaded Assignment Operator.

Definition at line 390 of file AuxBuffer.h.

◆ operator==()

template<class sample >
bool AuxPort::Audio::Buffer< sample >::operator== ( const Buffer< sample > & buffer) const
inline

Checks if two Audio Buffers have equal values.

Definition at line 398 of file AuxBuffer.h.

◆ operator[]()

template<class sample >
const sample & AuxPort::Audio::Buffer< sample >::operator[] ( const size_t & index) const
inline

Returns a sample value at the provided index on the Buffer.

Note
Assertion: Thrown when index provided is greater than size of Buffer

Definition at line 114 of file AuxBuffer.h.

◆ replace() [1/3]

template<class sample >
void AuxPort::Audio::Buffer< sample >::replace ( const AuxPort::Audio::Buffer< sample > & buffer)
inline

Replaces the audio buffer with a std::vector.

Definition at line 176 of file AuxBuffer.h.

◆ replace() [2/3]

template<class sample >
void AuxPort::Audio::Buffer< sample >::replace ( const sample * buffer,
const size_t & size )
inline

Replaces the audio buffer with a buffer pointer.

Definition at line 132 of file AuxBuffer.h.

◆ replace() [3/3]

template<class sample >
void AuxPort::Audio::Buffer< sample >::replace ( const std::vector< sample > & buffer)
inline

Replaces the audio buffer with a std::vector.

Definition at line 154 of file AuxBuffer.h.

◆ resize()

template<class sample >
void AuxPort::Audio::Buffer< sample >::resize ( const size_t & size)
inline

Resizes the audio buffer to the size given in the argument.

Definition at line 310 of file AuxBuffer.h.

◆ set()

template<class sample >
void AuxPort::Audio::Buffer< sample >::set ( const sample & value,
const size_t & index )
inline

Sets the sample to the specified index.

Note
Assertion: Exception thrown if index > size of the buffer

Definition at line 123 of file AuxBuffer.h.

◆ size()

template<class sample >
size_t AuxPort::Audio::Buffer< sample >::size ( ) const
inline

Returns Size of Buffer.

Definition at line 337 of file AuxBuffer.h.

◆ subBuffer()

template<class sample >
void AuxPort::Audio::Buffer< sample >::subBuffer ( AuxPort::Audio::Buffer< sample > & subBuffer,
const size_t & startIndex,
const size_t & endIndex )
inline

Extract a Sub Buffer from an Audio Buffer.

Definition at line 424 of file AuxBuffer.h.

◆ subtract() [1/2]

template<class sample >
void AuxPort::Audio::Buffer< sample >::subtract ( const sample & value)
inline

Subtracts coefficient from every single value of the Audio Buffer.

Definition at line 291 of file AuxBuffer.h.

◆ subtract() [2/2]

template<class sample >
void AuxPort::Audio::Buffer< sample >::subtract ( const sample & value,
size_t index )
inline

Performs subtraction between the value in the Audio Buffer at the specified "index" and the "value" passed.

Definition at line 302 of file AuxBuffer.h.

◆ zeroPad()

template<class sample >
void AuxPort::Audio::Buffer< sample >::zeroPad ( size_t startIndex,
size_t endIndex )
inline

Zero Pad an Audio Buffer.

Definition at line 413 of file AuxBuffer.h.

Friends And Related Symbol Documentation

◆ operator<<

template<class sample >
std::ostream & operator<< ( std::ostream & out,
const Buffer< sample > & buffer )
friend

Overloaded ostream operator, u can use std::cout to call AuxPort::Logger::Log()

Definition at line 345 of file AuxBuffer.h.


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