mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2025-04-04 02:28:37 -04:00
Eliminate redundant visual data updates, temporary chain until shared PBO implementation
This commit is contained in:
parent
6d0fc54400
commit
d45d3842bf
@ -104,6 +104,7 @@ AppFrame::AppFrame() :
|
||||
waterfallCanvas = new WaterfallCanvas(this, NULL);
|
||||
waterfallCanvas->setup(2048, 512);
|
||||
waterfallCanvas->attachSpectrumCanvas(spectrumCanvas);
|
||||
waterfallCanvas->attachWaterfallCanvas(demodWaterfallCanvas);
|
||||
spectrumCanvas->attachWaterfallCanvas(waterfallCanvas);
|
||||
vbox->Add(waterfallCanvas, 20, wxEXPAND | wxALL, 0);
|
||||
|
||||
@ -390,47 +391,11 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
|
||||
activeDemodulator = demod;
|
||||
}
|
||||
|
||||
if (!wxGetApp().getIQVisualQueue()->empty()) {
|
||||
DemodulatorThreadIQData *iqData;
|
||||
wxGetApp().getIQVisualQueue()->pop(iqData);
|
||||
|
||||
if (iqData && iqData->data.size()) {
|
||||
// spectrumCanvas->setData(iqData);
|
||||
waterfallCanvas->setData(iqData);
|
||||
demodWaterfallCanvas->setData(iqData);
|
||||
} else {
|
||||
std::cout << "Incoming IQ data empty?" << std::endl;
|
||||
}
|
||||
work_done = true;
|
||||
}
|
||||
|
||||
if (!wxGetApp().getAudioVisualQueue()->empty()) {
|
||||
AudioThreadInput *demodAudioData;
|
||||
wxGetApp().getAudioVisualQueue()->pop(demodAudioData);
|
||||
if (demodAudioData && demodAudioData->data.size()) {
|
||||
if (scopeCanvas->waveform_points.size() != demodAudioData->data.size() * 2) {
|
||||
scopeCanvas->waveform_points.resize(demodAudioData->data.size() * 2);
|
||||
}
|
||||
|
||||
for (int i = 0, iMax = demodAudioData->data.size(); i < iMax; i++) {
|
||||
scopeCanvas->waveform_points[i * 2 + 1] = demodAudioData->data[i] * 0.5f;
|
||||
scopeCanvas->waveform_points[i * 2] = ((double) i / (double) iMax);
|
||||
}
|
||||
|
||||
scopeCanvas->setStereo(demodAudioData->channels == 2);
|
||||
} else {
|
||||
std::cout << "Incoming Demodulator data empty?" << std::endl;
|
||||
}
|
||||
work_done = true;
|
||||
}
|
||||
|
||||
if (!waterfallCanvas->HasFocus()) {
|
||||
waterfallCanvas->SetFocus();
|
||||
}
|
||||
|
||||
if (!work_done) {
|
||||
event.Skip();
|
||||
}
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void AppFrame::saveSession(std::string fileName) {
|
||||
|
@ -47,6 +47,25 @@ void ScopeCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
wxPaintDC dc(this);
|
||||
const wxSize ClientSize = GetClientSize();
|
||||
|
||||
if (!wxGetApp().getAudioVisualQueue()->empty()) {
|
||||
AudioThreadInput *demodAudioData;
|
||||
wxGetApp().getAudioVisualQueue()->pop(demodAudioData);
|
||||
if (demodAudioData && demodAudioData->data.size()) {
|
||||
if (waveform_points.size() != demodAudioData->data.size() * 2) {
|
||||
waveform_points.resize(demodAudioData->data.size() * 2);
|
||||
}
|
||||
|
||||
for (int i = 0, iMax = demodAudioData->data.size(); i < iMax; i++) {
|
||||
waveform_points[i * 2 + 1] = demodAudioData->data[i] * 0.5f;
|
||||
waveform_points[i * 2] = ((double) i / (double) iMax);
|
||||
}
|
||||
|
||||
setStereo(demodAudioData->channels == 2);
|
||||
} else {
|
||||
std::cout << "Incoming Demodulator data empty?" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
glContext->SetCurrent(*this);
|
||||
glViewport(0, 0, ClientSize.x, ClientSize.y);
|
||||
|
||||
|
@ -36,7 +36,7 @@ wxEND_EVENT_TABLE()
|
||||
WaterfallCanvas::WaterfallCanvas(wxWindow *parent, int *attribList) :
|
||||
InteractiveCanvas(parent, attribList), spectrumCanvas(NULL), dragState(WF_DRAG_NONE), nextDragState(WF_DRAG_NONE), fft_size(0), waterfall_lines(
|
||||
0), plan(
|
||||
NULL), in(NULL), out(NULL), resampler(NULL), resamplerRatio(0), lastInputBandwidth(0), zoom(1), mouseZoom(1) {
|
||||
NULL), in(NULL), out(NULL), resampler(NULL), resamplerRatio(0), lastInputBandwidth(0), zoom(1), mouseZoom(1), otherWaterfallCanvas(NULL), polling(true) {
|
||||
|
||||
glContext = new WaterfallContext(this, &wxGetApp().GetContext(this));
|
||||
|
||||
@ -92,6 +92,21 @@ void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
wxPaintDC dc(this);
|
||||
const wxSize ClientSize = GetClientSize();
|
||||
|
||||
|
||||
if (polling && !wxGetApp().getIQVisualQueue()->empty()) {
|
||||
DemodulatorThreadIQData *iqData;
|
||||
wxGetApp().getIQVisualQueue()->pop(iqData);
|
||||
|
||||
if (iqData && iqData->data.size()) {
|
||||
setData(iqData);
|
||||
if (otherWaterfallCanvas) {
|
||||
otherWaterfallCanvas->setData(iqData);
|
||||
}
|
||||
} else {
|
||||
std::cout << "Incoming IQ data empty?" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
glContext->SetCurrent(*this);
|
||||
glViewport(0, 0, ClientSize.x, ClientSize.y);
|
||||
|
||||
@ -824,3 +839,17 @@ void WaterfallCanvas::OnMouseRightReleased(wxMouseEvent& event) {
|
||||
mouseTracker.setHorizDragLock(false);
|
||||
mouseZoom = 1.0;
|
||||
}
|
||||
|
||||
void WaterfallCanvas::attachWaterfallCanvas(WaterfallCanvas* canvas_in) {
|
||||
otherWaterfallCanvas = canvas_in;
|
||||
otherWaterfallCanvas->setPolling(false);
|
||||
}
|
||||
|
||||
|
||||
bool WaterfallCanvas::isPolling() {
|
||||
return polling;
|
||||
}
|
||||
|
||||
void WaterfallCanvas::setPolling(bool polling) {
|
||||
this->polling = polling;
|
||||
}
|
||||
|
@ -29,6 +29,10 @@ public:
|
||||
DragState getNextDragState();
|
||||
|
||||
void attachSpectrumCanvas(SpectrumCanvas *canvas_in);
|
||||
void attachWaterfallCanvas(WaterfallCanvas *canvas_in);
|
||||
|
||||
bool isPolling();
|
||||
void setPolling(bool polling);
|
||||
|
||||
private:
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
@ -46,9 +50,12 @@ private:
|
||||
void OnMouseEnterWindow(wxMouseEvent& event);
|
||||
void OnMouseLeftWindow(wxMouseEvent& event);
|
||||
|
||||
SpectrumCanvas *spectrumCanvas;
|
||||
std::vector<float> spectrum_points;
|
||||
|
||||
SpectrumCanvas *spectrumCanvas;
|
||||
WaterfallCanvas *otherWaterfallCanvas;
|
||||
bool polling;
|
||||
|
||||
fftwf_complex *in, *out;
|
||||
fftwf_plan plan;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user