AuLib  1.0beta
Public Types | Public Member Functions | Protected Attributes | Friends | List of all members
AuLib::AudioBase Class Reference

#include <AuLib/AudioBase.h>

Inheritance diagram for AuLib::AudioBase:
Inheritance graph
[legend]

Public Types

typedef std::vector< double >::iterator iterator
 
typedef std::vector< double >::const_iterator const_iterator
 

Public Member Functions

 AudioBase (uint32_t nchnls=def_nchnls, uint32_t vframes=def_vframes, double sr=def_sr)
 
virtual const AudioBaseoperator*= (double scal)
 
virtual const AudioBaseoperator*= (const double *sig)
 
virtual const AudioBaseoperator*= (const AudioBase &obj)
 
virtual const AudioBaseoperator+= (double offs)
 
virtual const AudioBaseoperator+= (const double *sig)
 
virtual const AudioBaseoperator+= (const AudioBase &obj)
 
double & operator[] (uint32_t ndx)
 
const double & operator[] (uint32_t ndx) const
 
iterator begin ()
 
iterator end ()
 
const_iterator cbegin () const
 
const_iterator cend () const
 
const AudioBaseset (const AudioBase &obj)
 
const AudioBaseset (const double *sig)
 
const double * set (double v)
 
double set (double v, uint32_t p)
 
 operator const std::vector< double > & () const
 
 operator const double * () const
 
const double * vector () const
 
double vector (uint32_t frndx, uint32_t chn) const
 
uint32_t vframes (uint32_t frames)
 
uint32_t resize_exact (uint32_t frames)
 
uint32_t vframes () const
 
uint32_t vsamps () const
 
uint32_t nchnls () const
 
uint32_t sr () const
 
uint32_t error () const
 
virtual const char * error_message () const
 

Protected Attributes

uint32_t m_nchnls
 
uint32_t m_vframes
 
std::vector< double > m_vector
 
double m_sr
 
uint32_t m_error
 

Friends

std::ostream & operator<< (std::ostream &os, const AudioBase &obj)
 
std::istream & operator>> (std::istream &is, AudioBase &obj)
 

Detailed Description

Audio DSP base class

Member Typedef Documentation

◆ const_iterator

typedef std::vector<double>::const_iterator AuLib::AudioBase::const_iterator

const iterator for this class

◆ iterator

typedef std::vector<double>::iterator AuLib::AudioBase::iterator

iterator for this class

Constructor & Destructor Documentation

◆ AudioBase()

AuLib::AudioBase::AudioBase ( uint32_t  nchnls = def_nchnls,
uint32_t  vframes = def_vframes,
double  sr = def_sr 
)
inline

AudioBase constructor
nchnls - number of channels
vframes - number of frames in vector. This is set to next power-of-two no greater than the requested number of frames. Objects requiring arbitrary vector sizes should explicity re-size the vector using the resize_exact() method.
sr - sampling rate

Member Function Documentation

◆ begin()

iterator AuLib::AudioBase::begin ( )
inline

returns an iterator to the beginning

◆ cbegin()

const_iterator AuLib::AudioBase::cbegin ( ) const
inline

returns a const iterator to the beginning

◆ cend()

const_iterator AuLib::AudioBase::cend ( ) const
inline

returns a const iterator to the end

◆ end()

iterator AuLib::AudioBase::end ( )
inline

returns an iterator to the end

◆ error()

uint32_t AuLib::AudioBase::error ( ) const
inline

Get error code

◆ error_message()

virtual const char* AuLib::AudioBase::error_message ( ) const
inlinevirtual

Get error message

Reimplemented in AuLib::SoundOut, AuLib::SoundOut, AuLib::SoundIn, and AuLib::SampleTable.

◆ nchnls()

uint32_t AuLib::AudioBase::nchnls ( ) const
inline

Get number of channels

◆ operator const double *()

AuLib::AudioBase::operator const double * ( ) const
inlineexplicit

Conversion operator for const double*

◆ operator const std::vector< double > &()

AuLib::AudioBase::operator const std::vector< double > & ( ) const
inline

Conversion operator for const std::vector<double>&

◆ operator*=() [1/3]

virtual const AudioBase& AuLib::AudioBase::operator*= ( double  scal)
inlinevirtual

Scale the data vector

Reimplemented in AuLib::Stft, and AuLib::Pvoc.

◆ operator*=() [2/3]

virtual const AudioBase& AuLib::AudioBase::operator*= ( const double *  sig)
inlinevirtual

Multiply the data vector by a sig vector

Reimplemented in AuLib::Stft, and AuLib::Pvoc.

◆ operator*=() [3/3]

virtual const AudioBase& AuLib::AudioBase::operator*= ( const AudioBase obj)
inlinevirtual

Multiply the data vector by the vector from obj

◆ operator+=() [1/3]

virtual const AudioBase& AuLib::AudioBase::operator+= ( double  offs)
inlinevirtual

DC offset the data vector

Reimplemented in AuLib::Stft, and AuLib::Pvoc.

◆ operator+=() [2/3]

virtual const AudioBase& AuLib::AudioBase::operator+= ( const double *  sig)
inlinevirtual

Add a vector sig to the data vector

Reimplemented in AuLib::Stft, and AuLib::Pvoc.

◆ operator+=() [3/3]

virtual const AudioBase& AuLib::AudioBase::operator+= ( const AudioBase obj)
inlinevirtual

Add a vector sig from obj to the data vector

◆ operator[]() [1/2]

double& AuLib::AudioBase::operator[] ( uint32_t  ndx)
inline

Get a reference of a single sample at sample pos ndx off the data vector

◆ operator[]() [2/2]

const double& AuLib::AudioBase::operator[] ( uint32_t  ndx) const
inline

Get a constant reference of a single sample at sample pos ndx off the data vector

◆ resize_exact()

uint32_t AuLib::AudioBase::resize_exact ( uint32_t  frames)
inline

Resize the vector to given number of frames, exactly. This is used to set the vector size to values other than power-of-two sizes, for dedicated applications where this is required. Clears the vector and returns the updated vector frame size.

◆ set() [1/4]

const AudioBase& AuLib::AudioBase::set ( const AudioBase obj)
inline

set the data vector to an input obj vector return the AudioBase obj reference

◆ set() [2/4]

const AudioBase& AuLib::AudioBase::set ( const double *  sig)
inline

set the data vector to a sig vector return the AudioBase obj reference

◆ set() [3/4]

const double* AuLib::AudioBase::set ( double  v)
inline

set the data vector to a value v return a pointer to the vector

◆ set() [4/4]

double AuLib::AudioBase::set ( double  v,
uint32_t  p 
)
inline

set the data vector to a value v at pos p return the old (replaced) sample

◆ sr()

uint32_t AuLib::AudioBase::sr ( ) const
inline

Get sampling reate

◆ vector() [1/2]

const double* AuLib::AudioBase::vector ( ) const
inline

Get the audio vector

◆ vector() [2/2]

double AuLib::AudioBase::vector ( uint32_t  frndx,
uint32_t  chn 
) const
inline

Get a single sample at frame ndx and channel chn off the data vector

◆ vframes() [1/2]

uint32_t AuLib::AudioBase::vframes ( uint32_t  frames)
inline

Set the current vector size in frames. Clears the vector and returns the updated vector frame size. Vector is resized if the requested frame size cannot be accommodated. Size is set to next power-of-two no greater than the requested number of frames.

◆ vframes() [2/2]

uint32_t AuLib::AudioBase::vframes ( ) const
inline

Get current vector size in frames

◆ vsamps()

uint32_t AuLib::AudioBase::vsamps ( ) const
inline

Get (max/allocated) vector size in samples

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const AudioBase obj 
)
friend

Stream output operator

◆ operator>>

std::istream& operator>> ( std::istream &  is,
AudioBase obj 
)
friend

Stream input operator

Member Data Documentation

◆ m_error

uint32_t AuLib::AudioBase::m_error
protected

◆ m_nchnls

uint32_t AuLib::AudioBase::m_nchnls
protected

◆ m_sr

double AuLib::AudioBase::m_sr
protected

◆ m_vector

std::vector<double> AuLib::AudioBase::m_vector
protected

◆ m_vframes

uint32_t AuLib::AudioBase::m_vframes
protected

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