mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-23 12:18:37 -05:00
Spectrum panel init fixes, more FFT distributor tweaks
This commit is contained in:
parent
11121d8a0e
commit
7163cd13f2
@ -4,8 +4,16 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include "ColorTheme.h"
|
#include "ColorTheme.h"
|
||||||
|
#include "CubicSDRDefs.h"
|
||||||
|
|
||||||
|
SpectrumPanel::SpectrumPanel() {
|
||||||
|
floorValue = 0;
|
||||||
|
ceilValue = 1;
|
||||||
|
showDb = false;
|
||||||
|
fftSize = DEFAULT_FFT_SIZE;
|
||||||
|
bandwidth = DEFAULT_DEMOD_BW;
|
||||||
|
freq = 0;
|
||||||
|
|
||||||
SpectrumPanel::SpectrumPanel() : floorValue(0), ceilValue(1), showDb(false), fftSize(2048) {
|
|
||||||
setFill(GLPANEL_FILL_GRAD_Y);
|
setFill(GLPANEL_FILL_GRAD_Y);
|
||||||
setFillColor(ThemeMgr::mgr.currentTheme->fftBackground * 2.0, ThemeMgr::mgr.currentTheme->fftBackground);
|
setFillColor(ThemeMgr::mgr.currentTheme->fftBackground * 2.0, ThemeMgr::mgr.currentTheme->fftBackground);
|
||||||
|
|
||||||
@ -233,15 +241,18 @@ void SpectrumPanel::drawPanelContents() {
|
|||||||
float dbPanelHeight = (1.0/viewHeight)*14.0;
|
float dbPanelHeight = (1.0/viewHeight)*14.0;
|
||||||
|
|
||||||
|
|
||||||
std::stringstream ssLabel;
|
std::stringstream ssLabel("");
|
||||||
ssLabel << std::fixed << std::setprecision(1) << (20.0 * log10(2.0*(getCeilValue())/(double)fftSize)) << "dB";
|
if (getCeilValue() != getFloorValue() && fftSize) {
|
||||||
|
ssLabel << std::fixed << std::setprecision(1) << (20.0 * log10(2.0*(getCeilValue())/(double)fftSize)) << "dB";
|
||||||
|
}
|
||||||
dbPanelCeil.setText(ssLabel.str(), GLFont::GLFONT_ALIGN_RIGHT);
|
dbPanelCeil.setText(ssLabel.str(), GLFont::GLFONT_ALIGN_RIGHT);
|
||||||
dbPanelCeil.setSize(dbPanelWidth, dbPanelHeight);
|
dbPanelCeil.setSize(dbPanelWidth, dbPanelHeight);
|
||||||
dbPanelCeil.setPosition(-1.0 + dbPanelWidth, 1.0 - dbPanelHeight);
|
dbPanelCeil.setPosition(-1.0 + dbPanelWidth, 1.0 - dbPanelHeight);
|
||||||
|
|
||||||
ssLabel.str("");
|
ssLabel.str("");
|
||||||
ssLabel << (20.0 * log10(2.0*(getFloorValue())/(double)fftSize)) << "dB";
|
if (getCeilValue() != getFloorValue() && fftSize) {
|
||||||
|
ssLabel << (20.0 * log10(2.0*(getFloorValue())/(double)fftSize)) << "dB";
|
||||||
|
}
|
||||||
|
|
||||||
dbPanelFloor.setText(ssLabel.str(), GLFont::GLFONT_ALIGN_RIGHT);
|
dbPanelFloor.setText(ssLabel.str(), GLFont::GLFONT_ALIGN_RIGHT);
|
||||||
dbPanelFloor.setSize(dbPanelWidth, dbPanelHeight);
|
dbPanelFloor.setSize(dbPanelWidth, dbPanelHeight);
|
||||||
|
@ -16,7 +16,7 @@ int FFTDataDistributor::getLinesPerSecond() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FFTDataDistributor::process() {
|
void FFTDataDistributor::process() {
|
||||||
while (!input->empty()) {
|
if (!input->empty()) {
|
||||||
if (!isAnyOutputEmpty()) {
|
if (!isAnyOutputEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -33,7 +33,7 @@ void FFTDataDistributor::process() {
|
|||||||
}
|
}
|
||||||
inp->decRefCount();
|
inp->decRefCount();
|
||||||
} else {
|
} else {
|
||||||
continue;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// number of seconds contained in input
|
// number of seconds contained in input
|
||||||
|
@ -102,9 +102,9 @@ void ScopeCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
|||||||
wxPaintDC dc(this);
|
wxPaintDC dc(this);
|
||||||
const wxSize ClientSize = GetClientSize();
|
const wxSize ClientSize = GetClientSize();
|
||||||
|
|
||||||
#ifdef __APPLE__
|
//#ifdef __APPLE__
|
||||||
glFinish();
|
// glFinish();
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
while (!inputData.empty()) {
|
while (!inputData.empty()) {
|
||||||
ScopeRenderData *avData;
|
ScopeRenderData *avData;
|
||||||
|
@ -45,9 +45,9 @@ SpectrumCanvas::~SpectrumCanvas() {
|
|||||||
void SpectrumCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
void SpectrumCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||||
wxPaintDC dc(this);
|
wxPaintDC dc(this);
|
||||||
const wxSize ClientSize = GetClientSize();
|
const wxSize ClientSize = GetClientSize();
|
||||||
#ifdef __APPLE__
|
//#ifdef __APPLE__
|
||||||
glFinish();
|
// glFinish();
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
|
|
||||||
if (!visualDataQueue.empty()) {
|
if (!visualDataQueue.empty()) {
|
||||||
|
@ -75,9 +75,9 @@ void WaterfallCanvas::processInputQueue() {
|
|||||||
glContext->SetCurrent(*this);
|
glContext->SetCurrent(*this);
|
||||||
|
|
||||||
bool processed = false;
|
bool processed = false;
|
||||||
while (!visualDataQueue.empty()) {
|
int numVis = visualDataQueue.size();
|
||||||
|
for (int i = 0; i < numVis; i++) {
|
||||||
SpectrumVisualData *vData;
|
SpectrumVisualData *vData;
|
||||||
|
|
||||||
visualDataQueue.pop(vData);
|
visualDataQueue.pop(vData);
|
||||||
|
|
||||||
if (vData) {
|
if (vData) {
|
||||||
|
Loading…
Reference in New Issue
Block a user