Line data Source code
1 : /** 2 : * \file SimpleSinusGeneratorFilter.h 3 : */ 4 : 5 : #ifndef ATK_MOCK_SIMPLESINUSGENERATORFILTER_H 6 : #define ATK_MOCK_SIMPLESINUSGENERATORFILTER_H 7 : 8 : #include <ATK/Core/TypedBaseFilter.h> 9 : #include <ATK/Mock/config.h> 10 : 11 : namespace ATK 12 : { 13 : /// Filter creating a sinus signal (usng std::sin, so not precise enough and fast enough) 14 : template<class DataType_> 15 : class ATK_MOCK_EXPORT SimpleSinusGeneratorFilter final : public TypedBaseFilter<DataType_> 16 : { 17 : public: 18 : /// Simplify parent calls 19 : using Parent = TypedBaseFilter<DataType_>; 20 : using typename Parent::DataType; 21 : using Parent::outputs; 22 : using Parent::output_sampling_rate; 23 : 24 : /// Constructor 25 : SimpleSinusGeneratorFilter(); 26 : /// Destructor 27 370 : ~SimpleSinusGeneratorFilter() override = default; 28 : 29 : /// Sets the amplitude of the sinusoid 30 : void set_amplitude(DataType_ amplitude); 31 : /// Sets the frequency of the sinusoid 32 : void set_frequency(int frequency); 33 : 34 : protected: 35 : void process_impl(gsl::index size) const final; 36 : 37 : private: 38 : mutable double state = 0; 39 : DataType_ amplitude{1}; 40 : int frequency{1}; 41 : }; 42 : } 43 : 44 : #endif