23 bool begin(
int len)
override {
25 if (p_fft_object==
nullptr) p_fft_object = fft_init(len, FFT_REAL, FFT_FORWARD, NULL, NULL);
26 assert(p_fft_object!=
nullptr);
27 return p_fft_object!=
nullptr;
30 if (p_fft_object!=
nullptr) fft_destroy(p_fft_object);
33 p_fft_object->input[idx] = value;
37 fft_execute(p_fft_object);
41 irfft(p_fft_object->input, p_fft_object->output, p_fft_object->twiddle_factors, p_fft_object->size);
50 return (pow(p_fft_object->output[2*idx],2) + pow(p_fft_object->output[2*idx+1],2));
53 float getValue(
int idx) {
return p_fft_object->input[idx];}
55 bool setBin(
int pos,
float real,
float img)
override {
56 if (pos>=len)
return false;
57 p_fft_object->output[2*pos] = real;
58 p_fft_object->output[2*pos+1] = img;
62 if (pos>=len)
return false;
63 bin.real = p_fft_object->output[2*pos];
64 bin.img = p_fft_object->output[2*pos+1];
70 bool isValid()
override{
return p_fft_object!=
nullptr; }
72 fft_config_t *p_fft_object=
nullptr;
90 return driverEx()->p_fft_object->output;