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-12-29 00:24:10 -05:00
|
|
|
#include "SpectrumCanvas.h"
|
2014-11-15 23:41:41 -05:00
|
|
|
|
|
|
|
#include "fftw3.h"
|
|
|
|
|
|
|
|
class WaterfallCanvas: public wxGLCanvas {
|
|
|
|
public:
|
2014-12-16 21:30:03 -05:00
|
|
|
enum DragState {
|
|
|
|
WF_DRAG_NONE, WF_DRAG_BANDWIDTH_LEFT, WF_DRAG_BANDWIDTH_RIGHT, WF_DRAG_FREQUENCY, WF_DRAG_RANGE
|
|
|
|
};
|
2014-11-30 21:14:17 -05:00
|
|
|
|
2014-11-15 23:41:41 -05:00
|
|
|
WaterfallCanvas(wxWindow *parent, int *attribList = NULL);
|
2014-12-28 05:13:46 -05:00
|
|
|
void Setup(int fft_size_in, int waterfall_lines_in);
|
2014-11-15 23:41:41 -05:00
|
|
|
~WaterfallCanvas();
|
|
|
|
|
2014-12-28 05:13:46 -05:00
|
|
|
void setData(DemodulatorThreadIQData *input);
|
2014-11-30 18:54:13 -05:00
|
|
|
int GetFrequencyAt(float x);
|
|
|
|
|
2014-12-28 05:13:46 -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-12-28 20:55:05 -05:00
|
|
|
DragState getDragState();
|
|
|
|
DragState getNextDragState();
|
|
|
|
|
2014-12-29 00:24:10 -05:00
|
|
|
void attachSpectrumCanvas(SpectrumCanvas *canvas_in);
|
|
|
|
|
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;
|
2014-12-29 00:24:10 -05:00
|
|
|
SpectrumCanvas *spectrumCanvas;
|
2014-11-15 23:41:41 -05:00
|
|
|
std::vector<float> spectrum_points;
|
|
|
|
|
|
|
|
fftw_complex *in, *out;
|
|
|
|
fftw_plan plan;
|
|
|
|
|
2015-01-01 18:08:54 -05:00
|
|
|
double fft_ceil_ma, fft_ceil_maa;
|
|
|
|
double fft_floor_ma, fft_floor_maa;
|
2014-11-15 23:41:41 -05:00
|
|
|
|
2015-01-01 18:08:54 -05:00
|
|
|
std::vector<double> fft_result;
|
|
|
|
std::vector<double> fft_result_ma;
|
|
|
|
std::vector<double> fft_result_maa;
|
2014-11-15 23:41:41 -05:00
|
|
|
|
|
|
|
WaterfallContext *glContext;
|
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-28 05:13:46 -05:00
|
|
|
bool shiftDown;
|
|
|
|
bool altDown;
|
|
|
|
bool ctrlDown;
|
|
|
|
|
|
|
|
int fft_size;
|
|
|
|
int waterfall_lines;
|
|
|
|
|
|
|
|
unsigned int center_freq;
|
|
|
|
unsigned int bandwidth;
|
|
|
|
|
|
|
|
bool isView;
|
|
|
|
msresamp_crcf resampler;
|
2015-01-01 18:08:54 -05:00
|
|
|
double resample_ratio;
|
2014-12-28 05:13:46 -05:00
|
|
|
nco_crcf nco_shift;
|
|
|
|
int shift_freq;
|
|
|
|
|
|
|
|
int last_input_bandwidth;
|
|
|
|
int last_bandwidth;
|
|
|
|
|
2015-01-01 21:10:54 -05:00
|
|
|
int zoom;
|
|
|
|
|
2014-12-28 05:13:46 -05:00
|
|
|
std::vector<liquid_float_complex> shift_buffer;
|
|
|
|
std::vector<liquid_float_complex> resampler_buffer;
|
|
|
|
|
2014-12-11 20:50:58 -05:00
|
|
|
// event table
|
2014-11-15 23:41:41 -05:00
|
|
|
wxDECLARE_EVENT_TABLE();
|
|
|
|
};
|
|
|
|
|