Line data Source code
1 : /** 2 : * \file HalfTanhShaperFilter.h 3 : */ 4 : 5 : #ifndef ATK_DISTORTION_HALFTANHSHAPERFILTER_H 6 : #define ATK_DISTORTION_HALFTANHSHAPERFILTER_H 7 : 8 : #include <ATK/Core/TypedBaseFilter.h> 9 : #include <ATK/Distortion/config.h> 10 : 11 : namespace ATK 12 : { 13 : /// Negative half of the signal tanh mapper 14 : template<typename DataType_> 15 : class ATK_DISTORTION_EXPORT HalfTanhShaperFilter final : public TypedBaseFilter<DataType_> 16 : { 17 : protected: 18 : /// Simplify parent calls 19 : using Parent = TypedBaseFilter<DataType_>; 20 : using typename Parent::DataType; 21 : using Parent::converted_inputs; 22 : using Parent::outputs; 23 : using Parent::nb_input_ports; 24 : using Parent::nb_output_ports; 25 : using Parent::input_sampling_rate; 26 : using Parent::output_sampling_rate; 27 : 28 : public: 29 : /*! 30 : * @brief Constructor 31 : * @param nb_channels is the number of input and output channels 32 : */ 33 : explicit HalfTanhShaperFilter(gsl::index nb_channels = 1); 34 : /// Destructor 35 4 : ~HalfTanhShaperFilter() override = default; 36 : 37 : void set_coefficient(DataType coeff); 38 : DataType_ get_coefficient() const; 39 : 40 : protected: 41 : void process_impl(gsl::index size) const final; 42 : private: 43 : DataType coeff{1}; 44 : }; 45 : } 46 : 47 : #endif