LibreVNA/Software/PC_Application/Traces/Math/dft.h

59 lines
1007 B
C
Raw Normal View History

2020-12-12 03:28:40 +08:00
#ifndef DFT_H
#define DFT_H
#include "tracemath.h"
#include "windowfunction.h"
#include <QThread>
#include <QSemaphore>
2020-12-12 03:28:40 +08:00
namespace Math {
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
{
friend class DFTThread;
Q_OBJECT
2020-12-12 03:28:40 +08:00
public:
DFT();
~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;
DFTThread *thread;
bool destructing;
QSemaphore semphr;
2020-12-12 03:28:40 +08:00
};
}
#endif // DFT_H