2020-12-12 03:28:40 +08:00
|
|
|
#ifndef DFT_H
|
|
|
|
#define DFT_H
|
|
|
|
|
|
|
|
#include "tracemath.h"
|
|
|
|
#include "windowfunction.h"
|
|
|
|
|
2021-12-30 22:23:07 +08:00
|
|
|
#include <QThread>
|
|
|
|
#include <QSemaphore>
|
|
|
|
|
2020-12-12 03:28:40 +08:00
|
|
|
namespace Math {
|
|
|
|
|
2021-12-30 22:23:07 +08:00
|
|
|
class DFT;
|
|
|
|
|
|
|
|
class DFTThread : public QThread
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
DFTThread(DFT &dft);
|
|
|
|
~DFTThread(){};
|
|
|
|
private:
|
|
|
|
void run() override;
|
|
|
|
DFT &dft;
|
|
|
|
};
|
|
|
|
|
2020-12-12 03:28:40 +08:00
|
|
|
class DFT : public TraceMath
|
|
|
|
{
|
2021-12-30 22:23:07 +08:00
|
|
|
friend class DFTThread;
|
|
|
|
Q_OBJECT
|
2020-12-12 03:28:40 +08:00
|
|
|
public:
|
|
|
|
DFT();
|
2021-12-30 22:23:07 +08:00
|
|
|
~DFT();
|
2020-12-12 03:28:40 +08:00
|
|
|
|
|
|
|
DataType outputType(DataType inputType) override;
|
|
|
|
QString description() override;
|
|
|
|
void edit() override;
|
|
|
|
|
|
|
|
static QWidget* createExplanationWidget();
|
|
|
|
|
|
|
|
virtual nlohmann::json toJSON() override;
|
|
|
|
virtual void fromJSON(nlohmann::json j) override;
|
|
|
|
Type getType() override {return Type::DFT;};
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void inputSamplesChanged(unsigned int begin, unsigned int end) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void updateDFT();
|
|
|
|
bool automaticDC;
|
|
|
|
double DCfreq;
|
|
|
|
WindowFunction window;
|
2021-12-30 22:23:07 +08:00
|
|
|
DFTThread *thread;
|
|
|
|
bool destructing;
|
|
|
|
QSemaphore semphr;
|
2020-12-12 03:28:40 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // DFT_H
|