2014-11-15 23:41:41 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "wx/glcanvas.h"
|
|
|
|
#include "wx/timer.h"
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <queue>
|
|
|
|
|
|
|
|
#include "SpectrumContext.h"
|
|
|
|
|
|
|
|
#include "fftw3.h"
|
2014-11-25 22:51:14 -05:00
|
|
|
#include "MouseTracker.h"
|
2014-11-15 23:41:41 -05:00
|
|
|
|
|
|
|
class SpectrumCanvas: public wxGLCanvas {
|
|
|
|
public:
|
2014-12-29 00:24:10 -05:00
|
|
|
std::vector<float> spectrum_points;
|
|
|
|
|
2014-11-15 23:41:41 -05:00
|
|
|
SpectrumCanvas(wxWindow *parent, int *attribList = NULL);
|
2014-12-28 05:13:46 -05:00
|
|
|
void Setup(int fft_size_in);
|
2014-11-15 23:41:41 -05:00
|
|
|
~SpectrumCanvas();
|
|
|
|
|
2014-12-28 05:13:46 -05:00
|
|
|
void setData(DemodulatorThreadIQData *input);
|
2014-12-29 00:24:10 -05:00
|
|
|
|
|
|
|
void SetView(int center_freq_in, int bandwidth_in);
|
|
|
|
void DisableView();
|
|
|
|
|
|
|
|
void SetCenterFrequency(unsigned int center_freq_in);
|
|
|
|
unsigned int GetCenterFrequency();
|
|
|
|
|
|
|
|
void SetBandwidth(unsigned int bandwidth_in);
|
|
|
|
unsigned int GetBandwidth();
|
|
|
|
|
2014-11-15 23:41:41 -05:00
|
|
|
private:
|
|
|
|
void OnPaint(wxPaintEvent& event);
|
|
|
|
|
|
|
|
void OnIdle(wxIdleEvent &event);
|
|
|
|
|
2014-11-25 00:35:06 -05:00
|
|
|
void mouseMoved(wxMouseEvent& event);
|
|
|
|
void mouseDown(wxMouseEvent& event);
|
|
|
|
void mouseWheelMoved(wxMouseEvent& event);
|
|
|
|
void mouseReleased(wxMouseEvent& event);
|
|
|
|
|
|
|
|
// void rightClick(wxMouseEvent& event);
|
|
|
|
void mouseLeftWindow(wxMouseEvent& event);
|
|
|
|
|
2014-11-15 23:41:41 -05:00
|
|
|
wxWindow *parent;
|
|
|
|
|
|
|
|
fftw_complex *in, *out;
|
|
|
|
fftw_plan plan;
|
|
|
|
|
|
|
|
float fft_ceil_ma, fft_ceil_maa;
|
|
|
|
float fft_floor_ma, fft_floor_maa;
|
|
|
|
|
|
|
|
std::vector<float> fft_result;
|
|
|
|
std::vector<float> fft_result_ma;
|
|
|
|
std::vector<float> fft_result_maa;
|
|
|
|
|
|
|
|
SpectrumContext *glContext;
|
2014-12-28 05:13:46 -05:00
|
|
|
int fft_size;
|
2014-11-25 00:35:06 -05:00
|
|
|
|
2014-12-29 00:24:10 -05:00
|
|
|
unsigned int center_freq;
|
|
|
|
unsigned int bandwidth;
|
|
|
|
|
|
|
|
bool isView;
|
|
|
|
|
2014-11-25 22:51:14 -05:00
|
|
|
MouseTracker mTracker;
|
2014-11-15 23:41:41 -05:00
|
|
|
// event table
|
|
|
|
wxDECLARE_EVENT_TABLE();
|
|
|
|
};
|
|
|
|
|