mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-23 12:18:37 -05:00
Merge pull request #133 from cjcliffe/processor_threads
Move visual processors to threads
This commit is contained in:
commit
36fe309c6e
@ -264,6 +264,7 @@ SET (cubicsdr_sources
|
||||
src/process/ScopeVisualProcessor.cpp
|
||||
src/process/SpectrumVisualProcessor.cpp
|
||||
src/process/FFTVisualDataThread.cpp
|
||||
src/process/SpectrumVisualDataThread.cpp
|
||||
src/ui/GLPanel.cpp
|
||||
external/rtaudio/RtAudio.cpp
|
||||
external/lodepng/lodepng.cpp
|
||||
@ -318,6 +319,7 @@ SET (cubicsdr_headers
|
||||
src/process/ScopeVisualProcessor.h
|
||||
src/process/SpectrumVisualProcessor.h
|
||||
src/process/FFTVisualDataThread.h
|
||||
src/process/SpectrumVisualDataThread.h
|
||||
src/ui/GLPanel.h
|
||||
src/ui/UITestCanvas.cpp
|
||||
src/ui/UITestCanvas.h
|
||||
|
@ -62,11 +62,11 @@ AppFrame::AppFrame() :
|
||||
demodModeSelector->setHelpTip("Choose modulation type: Frequency Modulation, Amplitude Modulation and Lower, Upper or Double Side-Band.");
|
||||
demodTray->Add(demodModeSelector, 2, wxEXPAND | wxALL, 0);
|
||||
|
||||
wxGetApp().getDemodSpectrumProcesor()->setup(1024);
|
||||
wxGetApp().getDemodSpectrumProcessor()->setup(1024);
|
||||
demodSpectrumCanvas = new SpectrumCanvas(this, attribList);
|
||||
demodSpectrumCanvas->setView(wxGetApp().getConfig()->getCenterFreq(), 300000);
|
||||
demodVisuals->Add(demodSpectrumCanvas, 3, wxEXPAND | wxALL, 0);
|
||||
wxGetApp().getDemodSpectrumProcesor()->attachOutput(demodSpectrumCanvas->getVisualDataQueue());
|
||||
wxGetApp().getDemodSpectrumProcessor()->attachOutput(demodSpectrumCanvas->getVisualDataQueue());
|
||||
|
||||
demodVisuals->AddSpacer(1);
|
||||
|
||||
@ -76,7 +76,7 @@ AppFrame::AppFrame() :
|
||||
demodWaterfallCanvas->attachSpectrumCanvas(demodSpectrumCanvas);
|
||||
demodSpectrumCanvas->attachWaterfallCanvas(demodWaterfallCanvas);
|
||||
demodVisuals->Add(demodWaterfallCanvas, 6, wxEXPAND | wxALL, 0);
|
||||
wxGetApp().getDemodSpectrumProcesor()->attachOutput(demodWaterfallCanvas->getVisualDataQueue());
|
||||
wxGetApp().getDemodSpectrumProcessor()->attachOutput(demodWaterfallCanvas->getVisualDataQueue());
|
||||
|
||||
demodTray->Add(demodVisuals, 30, wxEXPAND | wxALL, 0);
|
||||
|
||||
@ -113,9 +113,9 @@ AppFrame::AppFrame() :
|
||||
vbox->AddSpacer(1);
|
||||
|
||||
wxBoxSizer *spectrumSizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxGetApp().getSpectrumProcesor()->setup(2048);
|
||||
wxGetApp().getSpectrumProcessor()->setup(2048);
|
||||
spectrumCanvas = new SpectrumCanvas(this, attribList);
|
||||
wxGetApp().getSpectrumProcesor()->attachOutput(spectrumCanvas->getVisualDataQueue());
|
||||
wxGetApp().getSpectrumProcessor()->attachOutput(spectrumCanvas->getVisualDataQueue());
|
||||
|
||||
spectrumAvgMeter = new MeterCanvas(this, attribList);
|
||||
spectrumAvgMeter->setHelpTip("Spectrum averaging speed, click or drag to adjust.");
|
||||
@ -370,7 +370,7 @@ AppFrame::AppFrame() :
|
||||
float spectrumAvg = wxGetApp().getConfig()->getSpectrumAvgSpeed();
|
||||
|
||||
spectrumAvgMeter->setLevel(spectrumAvg);
|
||||
wxGetApp().getSpectrumProcesor()->setFFTAverageRate(spectrumAvg);
|
||||
wxGetApp().getSpectrumProcessor()->setFFTAverageRate(spectrumAvg);
|
||||
|
||||
int wflps =wxGetApp().getConfig()->getWaterfallLinesPerSec();
|
||||
|
||||
@ -488,7 +488,7 @@ void AppFrame::OnMenu(wxCommandEvent& event) {
|
||||
spectrumCanvas->setCenterFrequency(wxGetApp().getFrequency());
|
||||
waterfallDataThread->setLinesPerSecond(DEFAULT_WATERFALL_LPS);
|
||||
waterfallSpeedMeter->setLevel(sqrt(DEFAULT_WATERFALL_LPS));
|
||||
wxGetApp().getSpectrumProcesor()->setFFTAverageRate(0.65);
|
||||
wxGetApp().getSpectrumProcessor()->setFFTAverageRate(0.65);
|
||||
spectrumAvgMeter->setLevel(0.65);
|
||||
demodModeSelector->Refresh();
|
||||
demodTuner->Refresh();
|
||||
@ -607,12 +607,16 @@ void AppFrame::OnMenu(wxCommandEvent& event) {
|
||||
}
|
||||
|
||||
void AppFrame::OnClose(wxCloseEvent& event) {
|
||||
wxGetApp().getDemodSpectrumProcessor()->removeOutput(demodSpectrumCanvas->getVisualDataQueue());
|
||||
wxGetApp().getDemodSpectrumProcessor()->removeOutput(demodWaterfallCanvas->getVisualDataQueue());
|
||||
wxGetApp().getSpectrumProcessor()->removeOutput(spectrumCanvas->getVisualDataQueue());
|
||||
|
||||
wxGetApp().getConfig()->setWindow(this->GetPosition(), this->GetClientSize());
|
||||
wxGetApp().getConfig()->setWindowMaximized(this->IsMaximized());
|
||||
wxGetApp().getConfig()->setTheme(ThemeMgr::mgr.getTheme());
|
||||
wxGetApp().getConfig()->setSnap(wxGetApp().getFrequencySnap());
|
||||
wxGetApp().getConfig()->setCenterFreq(wxGetApp().getFrequency());
|
||||
wxGetApp().getConfig()->setSpectrumAvgSpeed(wxGetApp().getSpectrumProcesor()->getFFTAverageRate());
|
||||
wxGetApp().getConfig()->setSpectrumAvgSpeed(wxGetApp().getSpectrumProcessor()->getFFTAverageRate());
|
||||
wxGetApp().getConfig()->setWaterfallLinesPerSec(waterfallDataThread->getLinesPerSecond());
|
||||
wxGetApp().getConfig()->save();
|
||||
event.Skip();
|
||||
@ -742,7 +746,7 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
|
||||
wxGetApp().getScopeProcessor()->run();
|
||||
wxGetApp().getSpectrumDistributor()->run();
|
||||
|
||||
SpectrumVisualProcessor *proc = wxGetApp().getSpectrumProcesor();
|
||||
SpectrumVisualProcessor *proc = wxGetApp().getSpectrumProcessor();
|
||||
|
||||
if (spectrumAvgMeter->inputChanged()) {
|
||||
float val = spectrumAvgMeter->getInputValue();
|
||||
@ -755,20 +759,16 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
|
||||
GetStatusBar()->SetStatusText(wxString::Format(wxT("Spectrum averaging speed changed to %0.2f%%."),val*100.0));
|
||||
}
|
||||
|
||||
proc->setView(spectrumCanvas->getViewState());
|
||||
proc->setBandwidth(spectrumCanvas->getBandwidth());
|
||||
proc->setCenterFrequency(spectrumCanvas->getCenterFrequency());
|
||||
proc->setView(waterfallCanvas->getViewState());
|
||||
proc->setBandwidth(waterfallCanvas->getBandwidth());
|
||||
proc->setCenterFrequency(waterfallCanvas->getCenterFrequency());
|
||||
|
||||
proc->run();
|
||||
|
||||
SpectrumVisualProcessor *dproc = wxGetApp().getDemodSpectrumProcesor();
|
||||
SpectrumVisualProcessor *dproc = wxGetApp().getDemodSpectrumProcessor();
|
||||
|
||||
dproc->setView(demodWaterfallCanvas->getViewState());
|
||||
dproc->setBandwidth(demodWaterfallCanvas->getBandwidth());
|
||||
dproc->setCenterFrequency(demodWaterfallCanvas->getCenterFrequency());
|
||||
|
||||
dproc->run();
|
||||
|
||||
SpectrumVisualProcessor *wproc = waterfallDataThread->getProcessor();
|
||||
|
||||
if (waterfallSpeedMeter->inputChanged()) {
|
||||
|
@ -21,7 +21,7 @@
|
||||
IMPLEMENT_APP(CubicSDR)
|
||||
|
||||
CubicSDR::CubicSDR() : appframe(NULL), m_glContext(NULL), frequency(0), offset(0), ppm(0), snap(1), sampleRate(DEFAULT_SAMPLE_RATE), directSamplingMode(0),
|
||||
sdrThread(NULL), sdrPostThread(NULL), pipeSDRCommand(NULL), pipeSDRIQData(NULL), pipeIQVisualData(NULL), pipeAudioVisualData(NULL), t_SDR(NULL), t_PostSDR(NULL) {
|
||||
sdrThread(NULL), sdrPostThread(NULL), spectrumVisualThread(NULL), demodVisualThread(NULL), pipeSDRCommand(NULL), pipeSDRIQData(NULL), pipeIQVisualData(NULL), pipeAudioVisualData(NULL), t_SDR(NULL), t_PostSDR(NULL) {
|
||||
|
||||
}
|
||||
|
||||
@ -51,6 +51,9 @@ bool CubicSDR::OnInit() {
|
||||
directSamplingMode = 0;
|
||||
|
||||
// Visual Data
|
||||
spectrumVisualThread = new SpectrumVisualDataThread();
|
||||
demodVisualThread = new SpectrumVisualDataThread();
|
||||
|
||||
pipeIQVisualData = new DemodulatorThreadInputQueue();
|
||||
pipeIQVisualData->set_max_num_items(1);
|
||||
|
||||
@ -68,8 +71,8 @@ bool CubicSDR::OnInit() {
|
||||
spectrumDistributor.attachOutput(pipeDemodIQVisualData);
|
||||
spectrumDistributor.attachOutput(pipeSpectrumIQVisualData);
|
||||
|
||||
demodSpectrumProcessor.setInput(pipeDemodIQVisualData);
|
||||
spectrumProcessor.setInput(pipeSpectrumIQVisualData);
|
||||
getDemodSpectrumProcessor()->setInput(pipeDemodIQVisualData);
|
||||
getSpectrumProcessor()->setInput(pipeSpectrumIQVisualData);
|
||||
|
||||
pipeAudioVisualData = new DemodulatorThreadOutputQueue();
|
||||
pipeAudioVisualData->set_max_num_items(1);
|
||||
@ -80,7 +83,7 @@ bool CubicSDR::OnInit() {
|
||||
pipeSDRIQData = new SDRThreadIQDataQueue();
|
||||
pipeSDRCommand = new SDRThreadCommandQueue();
|
||||
|
||||
pipeSDRIQData->set_max_num_items(1);
|
||||
pipeSDRIQData->set_max_num_items(100);
|
||||
|
||||
sdrThread = new SDRThread();
|
||||
sdrThread->setInputQueue("SDRCommandQueue",pipeSDRCommand);
|
||||
@ -134,6 +137,8 @@ bool CubicSDR::OnInit() {
|
||||
|
||||
t_PostSDR = new std::thread(&SDRPostThread::threadMain, sdrPostThread);
|
||||
t_SDR = new std::thread(&SDRThread::threadMain, sdrThread);
|
||||
t_SpectrumVisual = new std::thread(&SpectrumVisualDataThread::threadMain, spectrumVisualThread);
|
||||
t_DemodVisual = new std::thread(&SpectrumVisualDataThread::threadMain, demodVisualThread);
|
||||
|
||||
appframe = new AppFrame();
|
||||
if (dev != NULL) {
|
||||
@ -168,12 +173,24 @@ int CubicSDR::OnExit() {
|
||||
sdrPostThread->terminate();
|
||||
t_PostSDR->join();
|
||||
|
||||
std::cout << "Terminating Visual Processor threads.." << std::endl;
|
||||
spectrumVisualThread->terminate();
|
||||
t_SpectrumVisual->join();
|
||||
|
||||
demodVisualThread->terminate();
|
||||
t_DemodVisual->join();
|
||||
|
||||
delete sdrThread;
|
||||
delete t_SDR;
|
||||
|
||||
delete sdrPostThread;
|
||||
delete t_PostSDR;
|
||||
|
||||
delete t_SpectrumVisual;
|
||||
delete spectrumVisualThread;
|
||||
delete t_DemodVisual;
|
||||
delete demodVisualThread;
|
||||
|
||||
delete pipeSDRCommand;
|
||||
|
||||
delete pipeIQVisualData;
|
||||
@ -273,12 +290,12 @@ ScopeVisualProcessor *CubicSDR::getScopeProcessor() {
|
||||
return &scopeProcessor;
|
||||
}
|
||||
|
||||
SpectrumVisualProcessor *CubicSDR::getSpectrumProcesor() {
|
||||
return &spectrumProcessor;
|
||||
SpectrumVisualProcessor *CubicSDR::getSpectrumProcessor() {
|
||||
return spectrumVisualThread->getProcessor();
|
||||
}
|
||||
|
||||
SpectrumVisualProcessor *CubicSDR::getDemodSpectrumProcesor() {
|
||||
return &demodSpectrumProcessor;
|
||||
SpectrumVisualProcessor *CubicSDR::getDemodSpectrumProcessor() {
|
||||
return demodVisualThread->getProcessor();
|
||||
}
|
||||
|
||||
VisualDataDistributor<DemodulatorThreadIQData> *CubicSDR::getSpectrumDistributor() {
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "ScopeVisualProcessor.h"
|
||||
#include "SpectrumVisualProcessor.h"
|
||||
#include "SpectrumVisualDataThread.h"
|
||||
|
||||
#include <wx/cmdline.h>
|
||||
|
||||
@ -57,8 +58,8 @@ public:
|
||||
int getDevice();
|
||||
|
||||
ScopeVisualProcessor *getScopeProcessor();
|
||||
SpectrumVisualProcessor *getSpectrumProcesor();
|
||||
SpectrumVisualProcessor *getDemodSpectrumProcesor();
|
||||
SpectrumVisualProcessor *getSpectrumProcessor();
|
||||
SpectrumVisualProcessor *getDemodSpectrumProcessor();
|
||||
VisualDataDistributor<DemodulatorThreadIQData> *getSpectrumDistributor();
|
||||
|
||||
DemodulatorThreadOutputQueue* getAudioVisualQueue();
|
||||
@ -96,6 +97,8 @@ private:
|
||||
|
||||
SDRThread *sdrThread;
|
||||
SDRPostThread *sdrPostThread;
|
||||
SpectrumVisualDataThread *spectrumVisualThread;
|
||||
SpectrumVisualDataThread *demodVisualThread;
|
||||
|
||||
SDRThreadCommandQueue* pipeSDRCommand;
|
||||
SDRThreadIQDataQueue* pipeSDRIQData;
|
||||
@ -106,13 +109,13 @@ private:
|
||||
DemodulatorThreadInputQueue* pipeWaterfallIQVisualData;
|
||||
|
||||
ScopeVisualProcessor scopeProcessor;
|
||||
SpectrumVisualProcessor spectrumProcessor;
|
||||
SpectrumVisualProcessor demodSpectrumProcessor;
|
||||
|
||||
VisualDataDistributor<DemodulatorThreadIQData> spectrumDistributor;
|
||||
|
||||
std::thread *t_SDR;
|
||||
std::thread *t_PostSDR;
|
||||
std::thread *t_SpectrumVisual;
|
||||
std::thread *t_DemodVisual;
|
||||
};
|
||||
|
||||
static const wxCmdLineEntryDesc commandLineInfo [] =
|
||||
|
@ -59,6 +59,6 @@ void FFTVisualDataThread::run() {
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << "FFT visual data thread terminated." << std::endl;
|
||||
std::cout << "FFT visual data thread done." << std::endl;
|
||||
}
|
||||
|
||||
|
25
src/process/SpectrumVisualDataThread.cpp
Normal file
25
src/process/SpectrumVisualDataThread.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
#include "SpectrumVisualDataThread.h"
|
||||
#include "CubicSDR.h"
|
||||
|
||||
SpectrumVisualDataThread::SpectrumVisualDataThread() {
|
||||
}
|
||||
|
||||
SpectrumVisualDataThread::~SpectrumVisualDataThread() {
|
||||
|
||||
}
|
||||
|
||||
SpectrumVisualProcessor *SpectrumVisualDataThread::getProcessor() {
|
||||
return &sproc;
|
||||
}
|
||||
|
||||
void SpectrumVisualDataThread::run() {
|
||||
std::cout << "Spectrum visual data thread started." << std::endl;
|
||||
|
||||
while(!terminated) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(12));
|
||||
sproc.run();
|
||||
}
|
||||
|
||||
std::cout << "Spectrum visual data thread done." << std::endl;
|
||||
}
|
||||
|
16
src/process/SpectrumVisualDataThread.h
Normal file
16
src/process/SpectrumVisualDataThread.h
Normal file
@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include "IOThread.h"
|
||||
#include "SpectrumVisualProcessor.h"
|
||||
|
||||
class SpectrumVisualDataThread : public IOThread {
|
||||
public:
|
||||
SpectrumVisualDataThread();
|
||||
~SpectrumVisualDataThread();
|
||||
SpectrumVisualProcessor *getProcessor();
|
||||
|
||||
void run();
|
||||
|
||||
protected:
|
||||
SpectrumVisualProcessor sproc;
|
||||
};
|
@ -221,14 +221,14 @@ void SDRPostThread::run() {
|
||||
data_in->decRefCount();
|
||||
}
|
||||
|
||||
buffers.purge();
|
||||
// buffers.purge();
|
||||
|
||||
if (iqVisualQueue && !iqVisualQueue->empty()) {
|
||||
DemodulatorThreadIQData *visualDataDummy;
|
||||
iqVisualQueue->pop(visualDataDummy);
|
||||
}
|
||||
|
||||
visualDataBuffers.purge();
|
||||
// visualDataBuffers.purge();
|
||||
|
||||
std::cout << "SDR post-processing thread done." << std::endl;
|
||||
}
|
||||
|
@ -295,7 +295,7 @@ void SDRThread::run() {
|
||||
}
|
||||
}
|
||||
|
||||
buffers.purge();
|
||||
// buffers.purge();
|
||||
|
||||
std::cout << "SDR thread done." << std::endl;
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ EVT_IDLE(SpectrumCanvas::OnIdle)
|
||||
EVT_MOTION(SpectrumCanvas::OnMouseMoved)
|
||||
EVT_LEFT_DOWN(SpectrumCanvas::OnMouseDown)
|
||||
EVT_LEFT_UP(SpectrumCanvas::OnMouseReleased)
|
||||
EVT_ENTER_WINDOW(SpectrumCanvas::OnMouseEnterWindow)
|
||||
EVT_LEAVE_WINDOW(SpectrumCanvas::OnMouseLeftWindow)
|
||||
EVT_MOUSEWHEEL(SpectrumCanvas::OnMouseWheelMoved)
|
||||
wxEND_EVENT_TABLE()
|
||||
@ -152,6 +153,11 @@ void SpectrumCanvas::OnMouseReleased(wxMouseEvent& event) {
|
||||
SetCursor(wxCURSOR_SIZEWE);
|
||||
}
|
||||
|
||||
void SpectrumCanvas::OnMouseEnterWindow(wxMouseEvent& event) {
|
||||
InteractiveCanvas::OnMouseEnterWindow(event);
|
||||
SetCursor(wxCURSOR_SIZEWE);
|
||||
}
|
||||
|
||||
void SpectrumCanvas::OnMouseLeftWindow(wxMouseEvent& event) {
|
||||
InteractiveCanvas::OnMouseLeftWindow(event);
|
||||
SetCursor(wxCURSOR_SIZEWE);
|
||||
|
@ -30,6 +30,7 @@ private:
|
||||
void OnMouseDown(wxMouseEvent& event);
|
||||
void OnMouseWheelMoved(wxMouseEvent& event);
|
||||
void OnMouseReleased(wxMouseEvent& event);
|
||||
void OnMouseEnterWindow(wxMouseEvent& event);
|
||||
void OnMouseLeftWindow(wxMouseEvent& event);
|
||||
|
||||
PrimaryGLContext *glContext;
|
||||
|
@ -105,45 +105,49 @@ void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
long long bw;
|
||||
if (currentZoom != 1) {
|
||||
long long freq = wxGetApp().getFrequency();
|
||||
bw = getBandwidth();
|
||||
|
||||
double mpos = 0;
|
||||
float mouseInView = false;
|
||||
|
||||
if (mouseTracker.mouseInView()) {
|
||||
mpos = mouseTracker.getMouseX();
|
||||
mouseInView = true;
|
||||
} else if (spectrumCanvas && spectrumCanvas->getMouseTracker()->mouseInView()) {
|
||||
mpos = spectrumCanvas->getMouseTracker()->getMouseX();
|
||||
mouseInView = true;
|
||||
}
|
||||
|
||||
if (currentZoom < 1) {
|
||||
centerFreq = getCenterFrequency();
|
||||
bw = getBandwidth();
|
||||
bw = (long long) ceil((long double) bw * currentZoom);
|
||||
if (bw < 30000) {
|
||||
bw = 30000;
|
||||
}
|
||||
if (mouseTracker.mouseInView()) {
|
||||
long long mfreqA = getFrequencyAt(mouseTracker.getMouseX());
|
||||
if (mouseInView) {
|
||||
long long mfreqA = getFrequencyAt(mpos);
|
||||
setBandwidth(bw);
|
||||
long long mfreqB = getFrequencyAt(mouseTracker.getMouseX());
|
||||
long long mfreqB = getFrequencyAt(mpos);
|
||||
centerFreq += mfreqA - mfreqB;
|
||||
}
|
||||
|
||||
setView(centerFreq, bw);
|
||||
if (spectrumCanvas) {
|
||||
spectrumCanvas->setView(centerFreq, bw);
|
||||
}
|
||||
} else {
|
||||
if (isView) {
|
||||
bw = getBandwidth();
|
||||
bw = (long long) ceil((long double) bw * currentZoom);
|
||||
|
||||
if (bw >= wxGetApp().getSampleRate()) {
|
||||
disableView();
|
||||
if (spectrumCanvas) {
|
||||
spectrumCanvas->disableView();
|
||||
}
|
||||
} else {
|
||||
if (mouseTracker.mouseInView()) {
|
||||
long long mfreqA = getFrequencyAt(mouseTracker.getMouseX());
|
||||
if (mouseInView) {
|
||||
long long mfreqA = getFrequencyAt(mpos);
|
||||
setBandwidth(bw);
|
||||
long long mfreqB = getFrequencyAt(mouseTracker.getMouseX());
|
||||
long long mfreqB = getFrequencyAt(mpos);
|
||||
centerFreq += mfreqA - mfreqB;
|
||||
}
|
||||
|
||||
setView(getCenterFrequency(), bw);
|
||||
if (spectrumCanvas) {
|
||||
spectrumCanvas->setView(centerFreq, bw);
|
||||
} else {
|
||||
setBandwidth(bw);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -154,7 +158,14 @@ void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
if (centerFreq > freq && (centerFreq + bandwidth / 2) > (freq + wxGetApp().getSampleRate() / 2)) {
|
||||
centerFreq = (freq + wxGetApp().getSampleRate() / 2) - bandwidth / 2;
|
||||
}
|
||||
|
||||
if (spectrumCanvas) {
|
||||
if ((spectrumCanvas->getCenterFrequency() != centerFreq) || (spectrumCanvas->getBandwidth() != bw)) {
|
||||
spectrumCanvas->setView(centerFreq,bw);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
glContext->SetCurrent(*this);
|
||||
initGLExtensions();
|
||||
@ -255,11 +266,13 @@ void WaterfallCanvas::OnKeyUp(wxKeyEvent& event) {
|
||||
case WXK_UP:
|
||||
case WXK_NUMPAD_UP:
|
||||
zoom = 1.0;
|
||||
mouseZoom = 0.95;
|
||||
break;
|
||||
case 'Z':
|
||||
case WXK_DOWN:
|
||||
case WXK_NUMPAD_DOWN:
|
||||
zoom = 1.0;
|
||||
mouseZoom = 1.05;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -276,11 +289,13 @@ void WaterfallCanvas::OnKeyDown(wxKeyEvent& event) {
|
||||
case 'A':
|
||||
case WXK_UP:
|
||||
case WXK_NUMPAD_UP:
|
||||
mouseZoom = 1.0;
|
||||
zoom = 0.95;
|
||||
break;
|
||||
case 'Z':
|
||||
case WXK_DOWN:
|
||||
case WXK_NUMPAD_DOWN:
|
||||
mouseZoom = 1.0;
|
||||
zoom = 1.05;
|
||||
break;
|
||||
case WXK_RIGHT:
|
||||
@ -349,6 +364,9 @@ void WaterfallCanvas::OnKeyDown(wxKeyEvent& event) {
|
||||
setStatusText("Set center frequency: %s", freq);
|
||||
}
|
||||
} else {
|
||||
if (spectrumCanvas) {
|
||||
spectrumCanvas->setCenterFrequency(freq);
|
||||
}
|
||||
wxGetApp().setFrequency(freq);
|
||||
setStatusText("Set center frequency: %s", freq);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user