2020-06-10 02:13:56 +00:00
|
|
|
#pragma once
|
2021-06-20 19:17:11 +00:00
|
|
|
#include <imgui/imgui.h>
|
|
|
|
#include <fftw3.h>
|
|
|
|
#include <dsp/types.h>
|
|
|
|
#include <dsp/stream.h>
|
|
|
|
#include <signal_path/vfo_manager.h>
|
|
|
|
#include <string>
|
|
|
|
#include <utils/event.h>
|
|
|
|
#include <mutex>
|
|
|
|
#include <gui/tuner.h>
|
2020-06-10 02:13:56 +00:00
|
|
|
|
2020-07-19 13:59:44 +00:00
|
|
|
#define WINDOW_FLAGS ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoBackground
|
2020-06-10 02:13:56 +00:00
|
|
|
|
2021-07-04 23:09:48 +00:00
|
|
|
enum {
|
|
|
|
FFT_WINDOW_RECTANGULAR,
|
|
|
|
FFT_WINDOW_BLACKMAN,
|
|
|
|
_FFT_WINDOW_COUNT
|
|
|
|
};
|
|
|
|
|
2021-06-20 19:17:11 +00:00
|
|
|
class MainWindow {
|
|
|
|
public:
|
|
|
|
void init();
|
|
|
|
void draw();
|
|
|
|
void setViewBandwidthSlider(float bandwidth);
|
|
|
|
bool sdrIsRunning();
|
|
|
|
void setFFTSize(int size);
|
2021-07-04 23:09:48 +00:00
|
|
|
void setFFTWindow(int win);
|
2021-06-20 19:17:11 +00:00
|
|
|
|
|
|
|
// TODO: Replace with it's own class
|
|
|
|
void setVFO(double freq);
|
|
|
|
|
2021-06-29 16:14:26 +00:00
|
|
|
bool isPlaying();
|
|
|
|
|
2021-06-23 19:45:38 +00:00
|
|
|
bool lockWaterfallControls = false;
|
|
|
|
|
2021-06-20 19:17:11 +00:00
|
|
|
private:
|
2021-07-04 23:09:48 +00:00
|
|
|
void generateFFTWindow(int win, int size);
|
2021-06-20 19:17:11 +00:00
|
|
|
static void fftHandler(dsp::complex_t* samples, int count, void* ctx);
|
|
|
|
static void vfoAddedHandler(VFOManager::VFO* vfo, void* ctx);
|
|
|
|
|
|
|
|
// FFT Variables
|
|
|
|
int fftSize = 8192 * 8;
|
|
|
|
std::mutex fft_mtx;
|
|
|
|
fftwf_complex *fft_in, *fft_out;
|
|
|
|
fftwf_plan fftwPlan;
|
2021-07-04 23:09:48 +00:00
|
|
|
float* appliedWindow;
|
2021-06-20 19:17:11 +00:00
|
|
|
|
|
|
|
// GUI Variables
|
|
|
|
bool firstMenuRender = true;
|
|
|
|
bool startedWithMenuClosed = false;
|
|
|
|
float fftMin = -70.0;
|
|
|
|
float fftMax = 0.0;
|
|
|
|
float bw = 8000000;
|
|
|
|
bool playing = false;
|
|
|
|
bool showCredits = false;
|
|
|
|
std::string audioStreamName = "";
|
|
|
|
std::string sourceName = "";
|
|
|
|
int menuWidth = 300;
|
|
|
|
bool grabbingMenu = false;
|
|
|
|
int newWidth = 300;
|
|
|
|
int fftHeight = 300;
|
|
|
|
bool showMenu = true;
|
|
|
|
int tuningMode = tuner::TUNER_MODE_NORMAL;
|
|
|
|
dsp::stream<dsp::complex_t> dummyStream;
|
|
|
|
bool demoWindow = false;
|
2021-07-04 23:09:48 +00:00
|
|
|
int selectedWindow = 0;
|
2021-06-20 19:17:11 +00:00
|
|
|
|
|
|
|
EventHandler<VFOManager::VFO*> vfoCreatedHandler;
|
|
|
|
|
|
|
|
};
|