LASP 1.0
Library for Acoustic Signal Processing
Loading...
Searching...
No Matches
lasp_siggen.h
Go to the documentation of this file.
1#pragma once
2#include <memory>
3#include "lasp_types.h"
4#include "lasp_mathtypes.h"
5#include "lasp_filter.h"
6
7class StreamMgr;
8class DaqData;
9
23class Siggen {
24private:
25 std::map<std::string, std::shared_ptr<Filter>> _filters;
26 d _dc_offset = 0, _level_linear = 1;
27 bool _muted = false;
28
29protected:
30 std::mutex _mtx;
31 d _fs = 0;
32
33 virtual void resetImpl() = 0;
34 virtual vd genSignalUnscaled(const us nframes) = 0;
35
36public:
37 virtual ~Siggen() = default;
38
47 void setFilter(const std::string& name, std::shared_ptr<Filter> f);
48
54 void setDCOffset(d offset);
55
62 void setMute(bool mute = true) { _muted = mute; }
63
71 void setLevel(const d level, bool dB=true);
72
80 void reset(const d newFs);
81
89 vd genSignal(const us nframes);
90};
91
Data coming from / going to DAQ. Non-interleaved format, which means data in buffer is ordered by cha...
Signal generation abstract base class. Implementation is required for resetImpl(),...
Definition lasp_siggen.h:23
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....
vd genSignal(const us nframes)
Called whenever the implementation needs to create new samples.
virtual vd genSignalUnscaled(const us nframes)=0
std::mutex _mtx
Definition lasp_siggen.h:30
void setDCOffset(d offset)
Set a linear DC offset value to the signal.
void setLevel(const d level, bool dB=true)
Set the level of the signal generator.
virtual void resetImpl()=0
void reset(const d newFs)
Reset the signal generator. Should be called whenever the output is based on a different sampling fre...
virtual ~Siggen()=default
void setMute(bool mute=true)
Mute the signal. Passes through the DC offset. No lock is hold. If it just works one block later,...
Definition lasp_siggen.h:62
Stream manager. Used to manage the input and output streams. Implemented as a singleton: only one str...
arma::Col< d > vd
size_t us
We often use boolean values.
Definition lasp_types.h:29