diff options
author | Robin Gareus <robin@gareus.org> | 2017-11-11 22:47:47 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-11-12 00:22:34 +0100 |
commit | 93e32af9f40064a2adf194e91c2398db90876aea (patch) | |
tree | 257d1a48e30507bbca49a83af1c90a6a36bfdd25 /libs/ardour/ardour/dsp_filter.h | |
parent | 52aa9bf84806307f1df4a7b05aea3d93fb8abc58 (diff) |
Add a noise generator (Lua DSP)
Diffstat (limited to 'libs/ardour/ardour/dsp_filter.h')
-rw-r--r-- | libs/ardour/ardour/dsp_filter.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/libs/ardour/ardour/dsp_filter.h b/libs/ardour/ardour/dsp_filter.h index f54eeac302..f3100efac5 100644 --- a/libs/ardour/ardour/dsp_filter.h +++ b/libs/ardour/ardour/dsp_filter.h @@ -310,5 +310,33 @@ namespace ARDOUR { namespace DSP { fftwf_plan _fftplan; }; + class LIBARDOUR_API Generator { + public: + Generator (); + + enum Type { + UniformWhiteNoise, + GaussianWhiteNoise, + PinkNoise, + }; + + void run (float *data, const uint32_t n_samples); + void set_type (Type t); + + private: + uint32_t randi (); + float randf () { return (randi () / 1073741824.f) - 1.f; } + float grandf (); + + Type _type; + uint32_t _rseed; + /* pink-noise */ + float _b0, _b1, _b2, _b3, _b4, _b5, _b6; + /* gaussian white */ + bool _pass; + float _rn; + + }; + } } /* namespace */ #endif |