mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2026-06-09 01:14:45 -04:00
Custom build flags, Power level offset, Persistent modem props
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include "CubicSDR.h"
|
||||
#include "ColorTheme.h"
|
||||
#include "CubicSDRDefs.h"
|
||||
|
||||
@@ -10,6 +11,7 @@ SpectrumPanel::SpectrumPanel() {
|
||||
floorValue = 0;
|
||||
ceilValue = 1;
|
||||
showDb = false;
|
||||
useDbOfs = false;
|
||||
fftSize = DEFAULT_FFT_SIZE;
|
||||
bandwidth = DEFAULT_DEMOD_BW;
|
||||
freq = 0;
|
||||
@@ -83,6 +85,14 @@ bool SpectrumPanel::getShowDb() {
|
||||
return showDb;
|
||||
}
|
||||
|
||||
void SpectrumPanel::setUseDBOffset(bool useOfs) {
|
||||
this->useDbOfs = useOfs;
|
||||
}
|
||||
|
||||
bool SpectrumPanel::getUseDBOffset() {
|
||||
return useDbOfs;
|
||||
}
|
||||
|
||||
|
||||
void SpectrumPanel::setPoints(std::vector<float> &points) {
|
||||
this->points.assign(points.begin(), points.end());
|
||||
@@ -269,11 +279,11 @@ void SpectrumPanel::drawPanelContents() {
|
||||
if (showDb) {
|
||||
float dbPanelWidth = (1.0 / viewWidth)*88.0 * GLFont::getScaleFactor();
|
||||
float dbPanelHeight = (1.0/viewHeight)*14.0 * GLFont::getScaleFactor();
|
||||
|
||||
float dbOfs = useDbOfs?wxGetApp().getConfig()->getDBOffset():0;
|
||||
|
||||
std::stringstream ssLabel("");
|
||||
if (getCeilValue() != getFloorValue() && fftSize) {
|
||||
ssLabel << std::fixed << std::setprecision(1) << (20.0 * log10(2.0*(getCeilValue())/(double)fftSize)) << "dB";
|
||||
ssLabel << std::fixed << std::setprecision(1) << (dbOfs + 20.0 * log10(2.0*(getCeilValue())/(double)fftSize)) << "dB";
|
||||
}
|
||||
dbPanelCeil.setText(ssLabel.str(), GLFont::GLFONT_ALIGN_RIGHT);
|
||||
dbPanelCeil.setSize(dbPanelWidth, dbPanelHeight);
|
||||
@@ -282,7 +292,7 @@ void SpectrumPanel::drawPanelContents() {
|
||||
|
||||
ssLabel.str("");
|
||||
if (getCeilValue() != getFloorValue() && fftSize) {
|
||||
ssLabel << (20.0 * log10(2.0*(getFloorValue())/(double)fftSize)) << "dB";
|
||||
ssLabel << (dbOfs + 20.0 * log10(2.0*(getFloorValue())/(double)fftSize)) << "dB";
|
||||
}
|
||||
|
||||
dbPanelFloor.setText(ssLabel.str(), GLFont::GLFONT_ALIGN_RIGHT);
|
||||
|
||||
@@ -26,7 +26,10 @@ public:
|
||||
|
||||
void setShowDb(bool showDb);
|
||||
bool getShowDb();
|
||||
|
||||
|
||||
void setUseDBOffset(bool useOfs);
|
||||
bool getUseDBOffset();
|
||||
|
||||
protected:
|
||||
void drawPanelContents();
|
||||
|
||||
@@ -40,5 +43,5 @@ private:
|
||||
|
||||
GLTextPanel dbPanelCeil;
|
||||
GLTextPanel dbPanelFloor;
|
||||
bool showDb;
|
||||
};
|
||||
bool showDb, useDbOfs;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user