LASP 1.0
Library for Acoustic Signal Processing
Loading...
Searching...
No Matches

Signal generation abstract base class. Implementation is required for resetImpl(), genSignalUnscaled() and destructor. More...

#include <lasp_siggen.h>

Inheritance diagram for Siggen:

Public Member Functions

virtual ~Siggen ()=default
 
void setFilter (const std::string &name, std::shared_ptr< Filter > f)
 Set a filter on the signal. For example to EQ the signal, or otherwise to shape the spectrum. Filters are stored in a map, and setFilter can be used to overwrite them, if a null pointer is given.
 
void setDCOffset (d offset)
 Set a linear DC offset value to the signal.
 
void setMute (bool mute=true)
 Mute the signal. Passes through the DC offset. No lock is hold. If it just works one block later, than that is just the case.
 
void setLevel (const d level, bool dB=true)
 Set the level of the signal generator.
 
void reset (const d newFs)
 Reset the signal generator. Should be called whenever the output is based on a different sampling frequency. Note that derived classes from this class should call the base class!
 
vd genSignal (const us nframes)
 Called whenever the implementation needs to create new samples.
 

Protected Member Functions

virtual void resetImpl ()=0
 
virtual vd genSignalUnscaled (const us nframes)=0
 

Protected Attributes

std::mutex _mtx
 
_fs = 0
 

Detailed Description

Signal generation abstract base class. Implementation is required for resetImpl(), genSignalUnscaled() and destructor.

Definition at line 23 of file lasp_siggen.h.

Constructor & Destructor Documentation

◆ ~Siggen()

virtual Siggen::~Siggen ( )
virtualdefault

Member Function Documentation

◆ genSignal()

vd Siggen::genSignal ( const us  nframes)

Called whenever the implementation needs to create new samples.

Parameters
nframes
Returns
Array of samples with length nframes

Definition at line 15 of file lasp_siggen.cpp.

◆ genSignalUnscaled()

virtual vd Siggen::genSignalUnscaled ( const us  nframes)
protectedpure virtual

Implemented in Sine, and Periodic.

◆ reset()

void Siggen::reset ( const d  newFs)

Reset the signal generator. Should be called whenever the output is based on a different sampling frequency. Note that derived classes from this class should call the base class!

Parameters
newFsNew sampling frequency to use.

Definition at line 54 of file lasp_siggen.cpp.

◆ resetImpl()

virtual void Siggen::resetImpl ( )
protectedpure virtual

Implemented in Sine.

◆ setDCOffset()

void Siggen::setDCOffset ( offset)

Set a linear DC offset value to the signal.

Parameters
offset

Definition at line 44 of file lasp_siggen.cpp.

◆ setFilter()

void Siggen::setFilter ( const std::string &  name,
std::shared_ptr< Filter f 
)

Set a filter on the signal. For example to EQ the signal, or otherwise to shape the spectrum. Filters are stored in a map, and setFilter can be used to overwrite them, if a null pointer is given.

Parameters
nameThe name of the filter (i.e. "noiseshaper", or "eq"
fThe filter to install.

Definition at line 34 of file lasp_siggen.cpp.

◆ setLevel()

void Siggen::setLevel ( const d  level,
bool  dB = true 
)

Set the level of the signal generator.

Parameters
levelThe new level. If dB == true, it is treated as a level, and pow(10, level/20) is installed as the linear gain.
dBif false, level is treated as linear gain value.

Definition at line 49 of file lasp_siggen.cpp.

◆ setMute()

void Siggen::setMute ( bool  mute = true)
inline

Mute the signal. Passes through the DC offset. No lock is hold. If it just works one block later, than that is just the case.

Parameters
muteif tre

Definition at line 62 of file lasp_siggen.h.

Member Data Documentation

◆ _fs

d Siggen::_fs = 0
protected

Definition at line 31 of file lasp_siggen.h.

◆ _mtx

std::mutex Siggen::_mtx
protected

Definition at line 30 of file lasp_siggen.h.


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