Line data Source code
1 : /** 2 : * \file GainExpanderFilter.h 3 : */ 4 : 5 : #ifndef ATK_DYNAMIC_GAINEXPANDERFILTER_H 6 : #define ATK_DYNAMIC_GAINEXPANDERFILTER_H 7 : 8 : #include <ATK/Dynamic/GainFilter.h> 9 : #include <ATK/Dynamic/config.h> 10 : 11 : namespace ATK 12 : { 13 : /// Gain "expander". Computes a new amplitude/volume gain based on threshold, slope and the power of the input signal 14 : template<typename DataType_> 15 : class ATK_DYNAMIC_EXPORT GainExpanderFilter : public ParentGainFilter<DataType_> 16 : { 17 : public: 18 : /// Simplify parent calls 19 : using Parent = ParentGainFilter<DataType_>; 20 : using Parent::ratio; 21 : using Parent::start_recomputeLUT; 22 : using typename Parent::DataType; 23 : /*! 24 : * @brief Constructor 25 : * @param nb_channels is the number of input and output channels 26 : * @param LUTsize is the total LUT size used by the filter 27 : * @param LUTprecision is the number of elements used to compute values < 1 28 : */ 29 : GainExpanderFilter(gsl::index nb_channels = 1, size_t LUTsize = 128*1024, size_t LUTprecision = 1024); 30 : /// Destructor 31 10 : ~GainExpanderFilter() override = default; 32 : 33 : /// Sets the softness of the knee of the filter (positive value) 34 : void set_softness(DataType_ softness); 35 : /// Retrieves the softness afctor 36 : DataType_ get_softness() const; 37 : 38 : protected: 39 : DataType_ computeGain(DataType_ value) const; 40 : private: 41 : DataType_ softness{0.0001}; 42 : }; 43 : } 44 : 45 : #endif