X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fardour%2Fdsp_filter.h;h=994d8725ea418576c6c3edacfacd779f49f8dcb1;hb=02db39c1bc63da52c21d77cc8f840d5d3233f301;hp=0ecf08cf44f1752e164e9d57807e8175d11e8853;hpb=581e25f3699132628785943e770c2653f5d09efc;p=ardour.git diff --git a/libs/ardour/ardour/dsp_filter.h b/libs/ardour/ardour/dsp_filter.h index 0ecf08cf44..994d8725ea 100644 --- a/libs/ardour/ardour/dsp_filter.h +++ b/libs/ardour/ardour/dsp_filter.h @@ -27,18 +27,20 @@ namespace ARDOUR { namespace DSP { - /** C Shared Memory + /** C/C++ Shared Memory * - * A convenience class representing a C array or float[] or int32_t[] + * A convenience class representing a C array of float[] or int32_t[] * data values. This is useful for lua scripts to perform DSP operations - * directly using C, C++. - * Access to this memory area is always 4 byte aligned: float, int. + * directly using C/C++ with CPU Hardware acceleration. * - * This memory area can also be shared between different instances. + * Access to this memory area is always 4 byte aligned. The data + * is interpreted either as float or as int. + * + * This memory area can also be shared between different instances + * or the same lua plugin (DSP, GUI). * * Since memory allocation is not realtime safe it should be * allocated during dsp_init() or dsp_configure(). - * * The memory is free()ed automatically when the lua instance is * destroyed. */ @@ -191,7 +193,7 @@ namespace ARDOUR { namespace DSP { }; /** Biquad Filter */ - class LIBARDOUR_API BiQuad { + class LIBARDOUR_API Biquad { public: enum Type { LowPass, @@ -209,8 +211,8 @@ namespace ARDOUR { namespace DSP { * * @param samplerate Samplerate */ - BiQuad (double samplerate); - BiQuad (const BiQuad &other); + Biquad (double samplerate); + Biquad (const Biquad &other); /** process audio data * @@ -220,12 +222,19 @@ namespace ARDOUR { namespace DSP { void run (float *data, const uint32_t n_samples); /** setup filter, compute coefficients * - * @param t filter type + * @param t filter type (LowPass, HighPass, etc) * @param freq filter frequency * @param Q filter quality * @param gain filter gain */ void compute (Type t, double freq, double Q, double gain); + + /** filter transfer function (filter response for spectrum visualization) + * @param freq frequency + * @return gain at given frequency in dB (clamped to -120..+120) + */ + float dB_at_freq (float freq) const; + /** reset filter state */ void reset () { _z1 = _z2 = 0.0; } private: