Line data Source code
1 : /** 2 : * \file TriangleCheckerFilter.h 3 : */ 4 : 5 : #ifndef ATK_MOCK_TRIANGLECHECKERFILTER_H 6 : #define ATK_MOCK_TRIANGLECHECKERFILTER_H 7 : 8 : #include <ATK/Core/TypedBaseFilter.h> 9 : #include <ATK/Core/TypeTraits.h> 10 : #include <ATK/Mock/config.h> 11 : 12 : namespace ATK 13 : { 14 : /// Filter that checks that the input is a synced triangle signal 15 : template<class DataType_> 16 : class ATK_MOCK_EXPORT TriangleCheckerFilter final : public TypedBaseFilter<DataType_> 17 : { 18 : public: 19 : /// Simplify parent calls 20 : using Parent = TypedBaseFilter<DataType_>; 21 : using typename Parent::DataType; 22 : using Parent::converted_inputs; 23 : using Parent::input_sampling_rate; 24 : 25 : /// Constructor 26 : TriangleCheckerFilter(); 27 : /// Destructor 28 145 : ~TriangleCheckerFilter() override = default; 29 : 30 : /// Sets the amplitude of the triangle 31 : void set_amplitude(DataType_ amplitude); 32 : /// Sets the frequency of the triangle 33 : void set_frequency(int frequency); 34 : 35 : protected: 36 : void process_impl(gsl::index size) const final; 37 : 38 : private: 39 : mutable double state = 0; 40 : mutable bool ascending = true; 41 : DataType amplitude{1}; 42 : int frequency{1}; 43 : }; 44 : } 45 : 46 : #endif