3#include "debugtrace.hpp"
9using rte = std::runtime_error;
11inline d
level_amp(d level_dB) {
return pow(10, level_dB / 20); }
20 DEBUGTRACE_PRINT(nframes);
21 vd signal(nframes, arma::fill::value(_dc_offset));
25 for (
auto f : _filters) {
27 f.second->filter(signal_dynamic);
29 signal += signal_dynamic;
35 std::shared_ptr<Filter> filter) {
39 _filters[name] = filter;
40 }
else if (_filters.find(name) != _filters.end()) {
41 _filters.extract(name);
52 _level_linear = dB ?
level_amp(level) : level;
58 for (
auto &f : _filters) {
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
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...
std::scoped_lock< std::mutex > mutexlock
std::scoped_lock< std::mutex > lck
size_t us
We often use boolean values.