Line data Source code
1 : /** 2 : * \file TanFilter.cpp 3 : */ 4 : 5 : #include "TanFilter.h" 6 : 7 : #include <boost/math/constants/constants.hpp> 8 : 9 : #include <cassert> 10 : #include <cmath> 11 : 12 : namespace ATK 13 : { 14 : template<typename DataType_> 15 1 : TanFilter<DataType_>::TanFilter(gsl::index nb_channels) 16 1 : :Parent(nb_channels, nb_channels) 17 : { 18 1 : } 19 : 20 : template<typename DataType_> 21 2 : void TanFilter<DataType_>::setup() 22 : { 23 2 : coeff = boost::math::constants::pi<DataType_>() / input_sampling_rate; 24 2 : } 25 : 26 : template<typename DataType_> 27 1 : void TanFilter<DataType_>::process_impl(gsl::index size) const 28 : { 29 2 : for(gsl::index channel = 0; channel < nb_input_ports; ++channel) 30 : { 31 1 : const DataType* ATK_RESTRICT input = converted_inputs[channel]; 32 1 : DataType* ATK_RESTRICT output = outputs[channel]; 33 1001 : for(gsl::index i = 0; i < size; ++i) 34 : { 35 1000 : output[i] = static_cast<DataType>(tan(input[i] * coeff)); 36 : } 37 : } 38 1 : } 39 : 40 : #if ATK_ENABLE_INSTANTIATION 41 : template class TanFilter<float>; 42 : #endif 43 : template class TanFilter<double>; 44 : }