2014-11-15 23:41:41 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "wx/glcanvas.h"
|
|
|
|
#include "wx/timer.h"
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <queue>
|
|
|
|
|
2015-01-02 21:32:24 -05:00
|
|
|
#include "InteractiveCanvas.h"
|
2014-11-15 23:41:41 -05:00
|
|
|
#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"
|
|
|
|
|
2015-01-02 21:32:24 -05:00
|
|
|
class WaterfallCanvas: public InteractiveCanvas {
|
2014-11-15 23:41:41 -05:00
|
|
|
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);
|
2015-01-03 17:07:39 -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-12-28 20:55:05 -05:00
|
|
|
DragState getDragState();
|
|
|
|
DragState getNextDragState();
|
|
|
|
|
2014-12-29 00:24:10 -05:00
|
|
|
void attachSpectrumCanvas(SpectrumCanvas *canvas_in);
|
2015-01-22 22:14:00 -05:00
|
|
|
void attachWaterfallCanvas(WaterfallCanvas *canvas_in);
|
|
|
|
|
|
|
|
bool isPolling();
|
|
|
|
void setPolling(bool polling);
|
2014-12-29 00:24:10 -05:00
|
|
|
|
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);
|
|
|
|
|
2015-01-03 17:07:39 -05:00
|
|
|
void OnMouseMoved(wxMouseEvent& event);
|
|
|
|
void OnMouseWheelMoved(wxMouseEvent& event);
|
|
|
|
void OnMouseDown(wxMouseEvent& event);
|
|
|
|
void OnMouseReleased(wxMouseEvent& event);
|
|
|
|
void OnMouseRightDown(wxMouseEvent& event);
|
|
|
|
void OnMouseRightReleased(wxMouseEvent& event);
|
|
|
|
void OnMouseEnterWindow(wxMouseEvent& event);
|
|
|
|
void OnMouseLeftWindow(wxMouseEvent& event);
|
2014-11-25 22:51:14 -05:00
|
|
|
|
2014-11-15 23:41:41 -05:00
|
|
|
std::vector<float> spectrum_points;
|
|
|
|
|
2015-01-22 22:14:00 -05:00
|
|
|
SpectrumCanvas *spectrumCanvas;
|
|
|
|
WaterfallCanvas *otherWaterfallCanvas;
|
|
|
|
bool polling;
|
|
|
|
|
2015-01-30 19:31:32 -05:00
|
|
|
fftwf_complex *in, *out, *fft_in_data, *fft_last_data;
|
|
|
|
unsigned int last_data_size;
|
2015-01-06 19:15:27 -05:00
|
|
|
fftwf_plan plan;
|
2014-11-15 23:41:41 -05:00
|
|
|
|
2015-01-06 19:15:27 -05:00
|
|
|
float fft_ceil_ma, fft_ceil_maa;
|
|
|
|
float fft_floor_ma, fft_floor_maa;
|
2014-11-15 23:41:41 -05:00
|
|
|
|
2015-01-06 19:15:27 -05:00
|
|
|
std::vector<float> fft_result;
|
|
|
|
std::vector<float> fft_result_ma;
|
|
|
|
std::vector<float> fft_result_maa;
|
2014-11-15 23:41:41 -05:00
|
|
|
|
|
|
|
WaterfallContext *glContext;
|
2014-11-30 21:14:17 -05:00
|
|
|
|
|
|
|
DragState dragState;
|
|
|
|
DragState nextDragState;
|
2014-11-25 22:51:14 -05:00
|
|
|
|
2014-12-28 05:13:46 -05:00
|
|
|
int fft_size;
|
|
|
|
int waterfall_lines;
|
2015-05-11 01:23:02 -04:00
|
|
|
int dragOfs;
|
2014-12-28 05:13:46 -05:00
|
|
|
|
|
|
|
msresamp_crcf resampler;
|
2015-01-03 17:07:39 -05:00
|
|
|
double resamplerRatio;
|
|
|
|
nco_crcf freqShifter;
|
2015-01-04 17:11:20 -05:00
|
|
|
long shiftFrequency;
|
2014-12-28 05:13:46 -05:00
|
|
|
|
2015-01-03 17:07:39 -05:00
|
|
|
int lastInputBandwidth;
|
|
|
|
float mouseZoom, zoom;
|
2015-03-06 21:11:14 -05:00
|
|
|
float hoverAlpha;
|
2014-12-28 05:13:46 -05:00
|
|
|
|
2015-01-03 17:07:39 -05:00
|
|
|
std::vector<liquid_float_complex> shiftBuffer;
|
|
|
|
std::vector<liquid_float_complex> resampleBuffer;
|
2015-01-30 19:31:32 -05:00
|
|
|
|
|
|
|
|
2014-12-11 20:50:58 -05:00
|
|
|
// event table
|
2014-11-15 23:41:41 -05:00
|
|
|
wxDECLARE_EVENT_TABLE();
|
|
|
|
};
|
|
|
|
|