Line data Source code
1 : /** 2 : * \file AttackReleaseFilter.h 3 : */ 4 : 5 : #ifndef ATK_DYNAMIC_ATTACKRELEASEFILTER_H 6 : #define ATK_DYNAMIC_ATTACKRELEASEFILTER_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 filter power of the input (computed with an AR1) 14 : template<typename DataType_> 15 : class ATK_DYNAMIC_EXPORT AttackReleaseFilter 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 AttackReleaseFilter(gsl::index nb_channels = 1); 33 : /// destructor 34 7 : ~AttackReleaseFilter() override = default; 35 : 36 : /// Sets the speed of the attack 37 : void set_attack(DataType_ attack); 38 : /// Gets the attack speed 39 : DataType_ get_attack() const; 40 : /// Sets the speed of the release 41 : void set_release(DataType_ release); 42 : /// Gets the release speed 43 : DataType_ get_release() const; 44 : 45 : protected: 46 : void process_impl(gsl::index size) const final; 47 : 48 : private: 49 : DataType_ attack{1}; 50 : DataType_ release{1}; 51 : }; 52 : } 53 : 54 : #endif