Line data Source code
1 : /** 2 : * \file RelativePowerFilter.h 3 : */ 4 : 5 : #ifndef ATK_DYNAMIC_RELATIVEPOWERFILTER_H 6 : #define ATK_DYNAMIC_RELATIVEPOWERFILTER_H 7 : 8 : #include <ATK/Core/TypedBaseFilter.h> 9 : #include <ATK/Dynamic/config.h> 10 : 11 : namespace ATK 12 : { 13 : /// Creates an output signal with the relative filtered power of the input (computed with an AR1) 14 : template<typename DataType_> 15 : class ATK_DYNAMIC_EXPORT RelativePowerFilter 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::output_delay; 26 : 27 : public: 28 : /*! 29 : * @brief Constructor 30 : * @param nb_channels is the number of input and output channels 31 : */ 32 : explicit RelativePowerFilter(gsl::index nb_channels = 1); 33 : /// Destructor 34 12 : ~RelativePowerFilter() override = default; 35 : 36 : /// Sets the memory of the AR1 (must be between 0 and 1) 37 : void set_memory(DataType_ memory_factor); 38 : /// gets the memory factor 39 : DataType_ get_memory() const; 40 : 41 : protected: 42 : void process_impl(gsl::index size) const final; 43 : 44 : private: 45 : DataType_ memory_factor{0}; 46 : mutable DataType_ temp_output{0}; 47 : }; 48 : } 49 : 50 : #endif