29 lines
550 B
C
29 lines
550 B
C
|
#include <cmath>
|
||
|
#include <vector>
|
||
|
|
||
|
class pickup_cancel {
|
||
|
public:
|
||
|
pickup_cancel(float fst_f, float eps, int nharm);
|
||
|
float do_sample(float x_input);
|
||
|
|
||
|
bool is_in_sync();
|
||
|
|
||
|
|
||
|
float act_f;
|
||
|
float act_phi;
|
||
|
|
||
|
const float max_f;
|
||
|
const float min_f;
|
||
|
/* PLL filter time constant/fourier coeff time constant */
|
||
|
const float decay_cst;
|
||
|
|
||
|
float error_filter = 0.0f;
|
||
|
|
||
|
/* If we are correctly in sync, E[x*cos(phi)] = 0.
|
||
|
we do want to average over multiple periods.
|
||
|
*/
|
||
|
const int size;
|
||
|
std::vector<float> cosine_coeffs;
|
||
|
std::vector<float> sine_coeffs;
|
||
|
};
|