2014-11-15 23:41:41 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "wx/glcanvas.h"
|
|
|
|
#include "wx/timer.h"
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <queue>
|
|
|
|
|
|
|
|
#include "WaterfallContext.h"
|
2014-11-25 22:51:14 -05:00
|
|
|
#include "MouseTracker.h"
|
2014-11-15 23:41:41 -05:00
|
|
|
|
|
|
|
#include "fftw3.h"
|
2014-11-16 23:20:48 -05:00
|
|
|
#include "Timer.h"
|
2014-11-15 23:41:41 -05:00
|
|
|
|
|
|
|
class WaterfallCanvas: public wxGLCanvas {
|
|
|
|
public:
|
2014-11-30 21:14:17 -05:00
|
|
|
enum DragState { WF_DRAG_NONE, WF_DRAG_BANDWIDTH_LEFT, WF_DRAG_BANDWIDTH_RIGHT, WF_DRAG_FREQUENCY };
|
|
|
|
|
2014-11-15 23:41:41 -05:00
|
|
|
WaterfallCanvas(wxWindow *parent, int *attribList = NULL);
|
|
|
|
~WaterfallCanvas();
|
|
|
|
|
|
|
|
void setData(std::vector<signed char> *data);
|
2014-11-30 18:54:13 -05:00
|
|
|
int GetFrequencyAt(float x);
|
|
|
|
|
2014-11-15 23:41:41 -05:00
|
|
|
private:
|
|
|
|
void OnPaint(wxPaintEvent& event);
|
|
|
|
void OnKeyDown(wxKeyEvent& event);
|
2014-12-10 00:34:27 -05:00
|
|
|
void OnKeyUp(wxKeyEvent& event);
|
2014-11-15 23:41:41 -05:00
|
|
|
|
|
|
|
void OnIdle(wxIdleEvent &event);
|
|
|
|
|
2014-11-25 22:51:14 -05:00
|
|
|
void mouseMoved(wxMouseEvent& event);
|
|
|
|
void mouseDown(wxMouseEvent& event);
|
|
|
|
void mouseWheelMoved(wxMouseEvent& event);
|
|
|
|
void mouseReleased(wxMouseEvent& event);
|
|
|
|
void mouseEnterWindow(wxMouseEvent& event);
|
|
|
|
void mouseLeftWindow(wxMouseEvent& event);
|
|
|
|
|
2014-11-15 23:41:41 -05:00
|
|
|
wxWindow *parent;
|
|
|
|
std::vector<float> spectrum_points;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
WaterfallContext *glContext;
|
2014-11-16 23:20:48 -05:00
|
|
|
Timer timer;
|
|
|
|
float frameTimer;
|
2014-11-25 22:51:14 -05:00
|
|
|
MouseTracker mTracker;
|
2014-11-30 21:14:17 -05:00
|
|
|
|
|
|
|
int activeDemodulatorBandwidth;
|
|
|
|
int activeDemodulatorFrequency;
|
|
|
|
|
|
|
|
DragState dragState;
|
|
|
|
DragState nextDragState;
|
2014-11-25 22:51:14 -05:00
|
|
|
|
2014-12-10 00:34:27 -05:00
|
|
|
bool shiftDown;
|
|
|
|
|
2014-11-15 23:41:41 -05:00
|
|
|
// event table
|
|
|
|
wxDECLARE_EVENT_TABLE();
|
|
|
|
};
|
|
|
|
|