22 bool begin(
int len)
override {
24 if (p_fft_object==
nullptr) p_fft_object = cpp_kiss_fft_alloc(len,
false,
nullptr,
nullptr);
25 if (p_data==
nullptr) p_data =
new kiss_fft_cpx[len];
26 assert(p_fft_object!=
nullptr);
27 assert(p_data!=
nullptr);
28 return p_fft_object!=
nullptr && p_data!=
nullptr;
32 if (p_fft_object!=
nullptr) kiss_fft_free(p_fft_object);
33 if (p_fft_object_inv!=
nullptr) kiss_fft_free(p_fft_object_inv);
35 if (p_data!=
nullptr)
delete[] p_data;
36 p_fft_object =
nullptr;
40 p_data[idx].r = value;
44 cpp_kiss_fft (p_fft_object, p_data, p_data);
48 if(p_fft_object_inv==
nullptr) {
49 p_fft_object_inv = cpp_kiss_fft_alloc(len,
true,
nullptr,
nullptr);
51 cpp_kiss_fft (p_fft_object_inv, p_data, p_data);
60 return (p_data[idx].r * p_data[idx].r + p_data[idx].i * p_data[idx].i);
63 bool isValid()
override{
return p_fft_object!=
nullptr; }
67 float getValue(
int idx)
override {
return p_data[idx].r; }
71 bool setBin(
int pos,
float real,
float img)
override {
72 if (pos>=len)
return false;
78 if (pos>=len)
return false;
79 bin.real = p_data[pos].r;
80 bin.img = p_data[pos].i;
84 kiss_fft_cfg p_fft_object=
nullptr;
85 kiss_fft_cfg p_fft_object_inv=
nullptr;
86 kiss_fft_cpx *p_data =
nullptr;
102 return driverEx()->p_data;