Merge pull request #136 from cjcliffe/spectrum-y-axis-label

Show spectrum floor and peak decibels on y-axis
This commit is contained in:
Charles J. Cliffe 2015-08-18 00:13:14 -04:00
commit 9852967551
18 changed files with 350 additions and 252 deletions

View File

@ -128,6 +128,7 @@ AppFrame::AppFrame() :
wxBoxSizer *spectrumSizer = new wxBoxSizer(wxHORIZONTAL);
wxGetApp().getSpectrumProcessor()->setup(2048);
spectrumCanvas = new SpectrumCanvas(this, attribList);
spectrumCanvas->setShowDb(true);
wxGetApp().getSpectrumProcessor()->attachOutput(spectrumCanvas->getVisualDataQueue());
spectrumAvgMeter = new MeterCanvas(this, attribList);
@ -783,6 +784,9 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
if (val < 0.01) {
val = 0.01;
}
if (val > 0.99) {
val = 0.99;
}
spectrumAvgMeter->setLevel(val);
proc->setFFTAverageRate(val);

View File

@ -2,15 +2,24 @@
#include <sstream>
#include <iostream>
#include <iomanip>
#include "ColorTheme.h"
SpectrumPanel::SpectrumPanel() : floorValue(0), ceilValue(1) {
SpectrumPanel::SpectrumPanel() : floorValue(0), ceilValue(1), showDb(false) {
setFill(GLPANEL_FILL_GRAD_Y);
setFillColor(ThemeMgr::mgr.currentTheme->fftBackground * 2.0, ThemeMgr::mgr.currentTheme->fftBackground);
dbPanelCeil.setMarginPx(0);
dbPanelCeil.setFill(GLPanel::GLPANEL_FILL_GRAD_X);
dbPanelCeil.setFillColor(RGBA4f(0.2,0.2,0.2,5.0), RGBA4f(0.2,0.2,0.2,0.0));
dbPanelFloor.setMarginPx(0);
dbPanelFloor.setFill(GLPanel::GLPANEL_FILL_GRAD_X);
dbPanelFloor.setFillColor(RGBA4f(0.2,0.2,0.2,5.), RGBA4f(0.2,0.2,0.2,0.0));
}
float SpectrumPanel::getFloorValue() const {
float SpectrumPanel::getFloorValue() {
return floorValue;
}
@ -18,7 +27,7 @@ void SpectrumPanel::setFloorValue(float floorValue) {
this->floorValue = floorValue;
}
float SpectrumPanel::getCeilValue() const {
float SpectrumPanel::getCeilValue() {
return ceilValue;
}
@ -42,6 +51,23 @@ long long SpectrumPanel::getBandwidth() {
return bandwidth;
}
void SpectrumPanel::setShowDb(bool showDb) {
this->showDb = showDb;
if (showDb) {
addChild(&dbPanelCeil);
addChild(&dbPanelFloor);
} else {
removeChild(&dbPanelCeil);
removeChild(&dbPanelFloor);
}
}
bool SpectrumPanel::getShowDb() {
return showDb;
}
void SpectrumPanel::setPoints(std::vector<float> &points) {
this->points.assign(points.begin(), points.end());
}
@ -95,14 +121,14 @@ void SpectrumPanel::drawPanelContents() {
glDrawArrays(GL_LINE_STRIP, 0, points.size() / 2);
glDisableClientState(GL_VERTEX_ARRAY);
}
glLoadMatrixf(transform);
GLint vp[4];
glGetIntegerv( GL_VIEWPORT, vp);
float viewHeight = (float) vp[3];
float viewWidth = (float) vp[2];
glLoadMatrixf(transform);
long long leftFreq = (double) freq - ((double) bandwidth / 2.0);
long long rightFreq = leftFreq + (double) bandwidth;
@ -162,4 +188,25 @@ void SpectrumPanel::drawPanelContents() {
}
glLineWidth(1.0);
if (showDb) {
float dbPanelWidth = (1.0/viewWidth)*75.0;
float dbPanelHeight = (1.0/viewHeight)*14.0;
std::stringstream ssLabel;
ssLabel << std::fixed << std::setprecision(1) << (20.0 * log10(2.0*(getCeilValue())/2048.0)) << "dB";
dbPanelCeil.setText(ssLabel.str(), GLFont::GLFONT_ALIGN_RIGHT);
dbPanelCeil.setSize(dbPanelWidth, dbPanelHeight);
dbPanelCeil.setPosition(-1.0 + dbPanelWidth, 1.0 - dbPanelHeight);
ssLabel.str("");
ssLabel << (20.0 * log10(2.0*(getFloorValue())/2048.0)) << "dB";
dbPanelFloor.setText(ssLabel.str(), GLFont::GLFONT_ALIGN_RIGHT);
dbPanelFloor.setSize(dbPanelWidth, dbPanelHeight);
dbPanelFloor.setPosition(-1.0 + dbPanelWidth, - 1.0 + dbPanelHeight);
}
}

View File

@ -8,10 +8,10 @@ public:
void setPoints(std::vector<float> &points);
float getFloorValue() const;
float getFloorValue();
void setFloorValue(float floorValue);
float getCeilValue() const;
float getCeilValue();
void setCeilValue(float ceilValue);
void setFreq(long long freq);
@ -20,6 +20,9 @@ public:
void setBandwidth(long long bandwidth);
long long getBandwidth();
void setShowDb(bool showDb);
bool getShowDb();
protected:
void drawPanelContents();
@ -28,4 +31,8 @@ private:
long long freq;
long long bandwidth;
std::vector<float> points;
GLTextPanel dbPanelCeil;
GLTextPanel dbPanelFloor;
bool showDb;
};

View File

@ -1,7 +1,7 @@
#include "WaterfallPanel.h"
WaterfallPanel::WaterfallPanel() : GLPanel(), fft_size(0), waterfall_lines(0), waterfall_slice(NULL), activeTheme(NULL) {
setFillColor(RGB3f(0,0,0));
setFillColor(RGBA4f(0,0,0));
for (int i = 0; i < 2; i++) {
waterfall[i] = 0;
}

View File

@ -283,9 +283,6 @@ void SpectrumVisualProcessor::process() {
}
}
fft_ceil += 0.25;
fft_floor -= 1;
fft_ceil_ma = fft_ceil_ma + (fft_ceil - fft_ceil_ma) * 0.05;
fft_ceil_maa = fft_ceil_maa + (fft_ceil_ma - fft_ceil_maa) * 0.05;
@ -293,7 +290,7 @@ void SpectrumVisualProcessor::process() {
fft_floor_maa = fft_floor_maa + (fft_floor_ma - fft_floor_maa) * 0.05;
for (int i = 0, iMax = fftSize; i < iMax; i++) {
float v = (log10(fft_result_maa[i] - fft_floor_maa) / log10(fft_ceil_maa - fft_floor_maa));
float v = (log10(fft_result_maa[i]+0.25 - (fft_floor_maa-0.75)) / log10((fft_ceil_maa+0.25) - (fft_floor_maa-0.75)));
output->spectrum_points[i * 2] = ((float) i / (float) iMax);
output->spectrum_points[i * 2 + 1] = v;
}

View File

@ -9,9 +9,9 @@ GLPanel::GLPanel() : fillType(GLPANEL_FILL_SOLID), contentsVisible(true), transf
pos[1] = 0.0f;
size[0] = 1.0f;
size[1] = 1.0f;
fill[0] = RGB3f(0.5,0.5,0.5);
fill[1] = RGB3f(0.1,0.1,0.1);
borderColor = RGB3f(0.8, 0.8, 0.8);
fill[0] = RGBA4f(0.5,0.5,0.5);
fill[1] = RGBA4f(0.1,0.1,0.1);
borderColor = RGBA4f(0.8, 0.8, 0.8);
setCoordinateSystem(GLPANEL_Y_UP);
setMarginPx(0);
setBorderPx(0);
@ -23,8 +23,8 @@ void GLPanel::genArrays() {
if (fillType == GLPANEL_FILL_SOLID || fillType == GLPANEL_FILL_GRAD_X || fillType == GLPANEL_FILL_GRAD_Y) {
glPoints.reserve(2 * 4);
glPoints.resize(2 * 4);
glColors.reserve(3 * 4);
glColors.resize(3 * 4);
glColors.reserve(4 * 4);
glColors.resize(4 * 4);
float pts[2 * 4] = {
min, min,
@ -33,7 +33,7 @@ void GLPanel::genArrays() {
max, min
};
RGB3f c[4];
RGBA4f c[4];
if (fillType == GLPANEL_FILL_SOLID) {
c[0] = c[1] = c[2] = c[3] = fill[0];
@ -45,22 +45,22 @@ void GLPanel::genArrays() {
c[1] = c[2] = fill[1];
}
float clr[3 * 4] = {
c[0].r, c[0].g, c[0].b,
c[1].r, c[1].g, c[1].b,
c[2].r, c[2].g, c[2].b,
c[3].r, c[3].g, c[3].b
};
float clr[4 * 4] = {
c[0].r, c[0].g, c[0].b, c[0].a,
c[1].r, c[1].g, c[1].b, c[1].a,
c[2].r, c[2].g, c[2].b, c[2].a,
c[3].r, c[3].g, c[3].b, c[3].a
};
glPoints.assign(pts, pts + (2 * 4));
glColors.assign(clr, clr + (3 * 4));
glColors.assign(clr, clr + (4 * 4));
} else {
glPoints.reserve(2 * 8);
glPoints.resize(2 * 8);
glColors.reserve(3 * 8);
glColors.resize(3 * 8);
glColors.reserve(4 * 8);
glColors.resize(4 * 8);
RGB3f c[8];
RGBA4f c[8];
if (fillType == GLPANEL_FILL_GRAD_BAR_X) {
float pts[2 * 8] = {
@ -103,18 +103,18 @@ void GLPanel::genArrays() {
c[5] = c[6] = fill[0];
}
float clr[3 * 8] = {
c[0].r, c[0].g, c[0].b,
c[1].r, c[1].g, c[1].b,
c[2].r, c[2].g, c[2].b,
c[3].r, c[3].g, c[3].b,
c[4].r, c[4].g, c[4].b,
c[5].r, c[5].g, c[5].b,
c[6].r, c[6].g, c[6].b,
c[7].r, c[7].g, c[7].b
float clr[4 * 8] = {
c[0].r, c[0].g, c[0].b, c[0].a,
c[1].r, c[1].g, c[1].b, c[1].a,
c[2].r, c[2].g, c[2].b, c[2].a,
c[3].r, c[3].g, c[3].b, c[3].a,
c[4].r, c[4].g, c[4].b, c[4].a,
c[5].r, c[5].g, c[5].b, c[5].a,
c[6].r, c[6].g, c[6].b, c[6].a,
c[7].r, c[7].g, c[7].b, c[7].a
};
glColors.assign(clr, clr + (3 * 8));
glColors.assign(clr, clr + (4 * 8));
}
}
@ -175,12 +175,12 @@ void GLPanel::setFill(GLPanelFillType fill_mode) {
genArrays();
}
void GLPanel::setFillColor(RGB3f color1) {
void GLPanel::setFillColor(RGBA4f color1) {
fill[0] = color1;
genArrays();
}
void GLPanel::setFillColor(RGB3f color1, RGB3f color2) {
void GLPanel::setFillColor(RGBA4f color1, RGBA4f color2) {
fill[0] = color1;
fill[1] = color2;
genArrays();
@ -191,7 +191,7 @@ void GLPanel::setMarginPx(float marg) {
}
void GLPanel::setBorderColor(RGB3f clr) {
void GLPanel::setBorderColor(RGBA4f clr) {
borderColor = clr;
}
@ -207,7 +207,19 @@ void GLPanel::setBorderPx(float bordl, float bordr, float bordt, float bordb) {
}
void GLPanel::addChild(GLPanel *childPanel) {
children.push_back(childPanel);
std::vector<GLPanel *>::iterator i = std::find(children.begin(), children.end(), childPanel);
if (i == children.end()) {
children.push_back(childPanel);
}
}
void GLPanel::removeChild(GLPanel *childPanel) {
std::vector<GLPanel *>::iterator i = std::find(children.begin(), children.end(), childPanel);
if (i != children.end()) {
children.erase(i);
}
}
void GLPanel::drawChildren() {
@ -265,10 +277,12 @@ void GLPanel::draw() {
glLoadMatrixf(transform);
if (fillType != GLPANEL_FILL_NONE) {
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glVertexPointer(2, GL_FLOAT, 0, &glPoints[0]);
glColorPointer(3, GL_FLOAT, 0, &glColors[0]);
glColorPointer(4, GL_FLOAT, 0, &glColors[0]);
glDrawArrays(GL_QUADS, 0, glPoints.size() / 2);
@ -277,7 +291,7 @@ void GLPanel::draw() {
if (borderPx.left || borderPx.right || borderPx.top || borderPx.bottom) {
glEnable(GL_LINE_SMOOTH);
glColor3f(borderColor.r, borderColor.g, borderColor.b);
glColor4f(borderColor.r, borderColor.g, borderColor.b, borderColor.a);
if (borderPx.left) {
glLineWidth(borderPx.left);
@ -313,6 +327,7 @@ void GLPanel::draw() {
glDisable(GL_LINE_SMOOTH);
}
glDisable(GL_BLEND);
}
if (contentsVisible) {
@ -337,6 +352,8 @@ void GLPanel::draw() {
GLTextPanel::GLTextPanel() : GLPanel() {
coord = GLPANEL_Y_UP;
horizAlign = GLFont::GLFONT_ALIGN_CENTER;
vertAlign = GLFont::GLFONT_ALIGN_CENTER;
}
void GLTextPanel::drawPanelContents() {
@ -346,19 +363,19 @@ void GLTextPanel::drawPanelContents() {
float size;
if (pdim.y < 16) {
if (pdim.y <= 16) {
sz = GLFont::GLFONT_SIZE12;
size = 12;
} else if (pdim.y < 18) {
} else if (pdim.y <= 18) {
sz = GLFont::GLFONT_SIZE16;
size = 16;
} else if(pdim.y < 24) {
} else if(pdim.y <= 24) {
sz = GLFont::GLFONT_SIZE18;
size = 18;
} else if(pdim.y < 32) {
} else if(pdim.y <= 32) {
sz = GLFont::GLFONT_SIZE24;
size = 24;
} else if(pdim.y < 48) {
} else if(pdim.y <= 48) {
sz = GLFont::GLFONT_SIZE32;
size = 32;
} else {
@ -367,11 +384,13 @@ void GLTextPanel::drawPanelContents() {
}
GLFont::getFont(sz).drawString(textVal, mid, mid, size, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER, (int)pdim.x, (int)pdim.y);
GLFont::getFont(sz).drawString(textVal, mid, mid, size, horizAlign, vertAlign, (int)pdim.x, (int)pdim.y);
}
void GLTextPanel::setText(std::string text) {
void GLTextPanel::setText(std::string text, GLFont::Align hAlign, GLFont::Align vAlign) {
textVal = text;
horizAlign = hAlign;
vertAlign = vAlign;
}
std::string GLTextPanel::getText() {

View File

@ -42,8 +42,8 @@ public:
GLPanelCoordinateSystem coord;
float marginPx;
GLPanelEdges borderPx;
RGB3f fill[2];
RGB3f borderColor;
RGBA4f fill[2];
RGBA4f borderColor;
bool contentsVisible;
CubicVR::mat4 transform;
CubicVR::mat4 localTransform;
@ -68,15 +68,16 @@ public:
void setCoordinateSystem(GLPanelCoordinateSystem coord);
void setFill(GLPanelFillType fill_mode);
void setFillColor(RGB3f color1);
void setFillColor(RGB3f color1, RGB3f color2);
void setFillColor(RGBA4f color1);
void setFillColor(RGBA4f color1, RGBA4f color2);
void setMarginPx(float marg);
void setBorderColor(RGB3f clr);
void setBorderColor(RGBA4f clr);
void setBorderPx(float bord);
void setBorderPx(float bordl, float bordr, float bordt, float bordb);
void addChild(GLPanel *childPanel);
void removeChild(GLPanel *childPanel);
void drawChildren();
virtual void drawPanelContents();
@ -88,11 +89,13 @@ public:
class GLTextPanel : public GLPanel {
private:
std::string textVal;
GLFont::Align horizAlign;
GLFont::Align vertAlign;
public:
GLTextPanel();
void drawPanelContents();
void setText(std::string text);
void setText(std::string text, GLFont::Align hAlign = GLFont::GLFONT_ALIGN_CENTER, GLFont::Align vAlign = GLFont::GLFONT_ALIGN_CENTER);
std::string getText();
};

View File

@ -9,30 +9,30 @@ PrimaryGLContext(canvas, sharedContext) {
testPanel.setSize(1.0, 1.0);
testPanel.setMarginPx(10);
testPanel.setFill(GLPanel::GLPANEL_FILL_GRAD_BAR_Y);
testPanel.setFillColor(RGB3f(0.0,0.0,1.0), RGB3f(0.0,1.0,0.0));
testPanel.setFillColor(RGBA4f(0.0,0.0,1.0), RGBA4f(0.0,1.0,0.0));
testChildPanel.setPosition(0.0, 0.0);
testChildPanel.setMarginPx(5);
testChildPanel.setSize(1.0, 0.33);
testChildPanel.setCoordinateSystem(GLPanel::GLPANEL_Y_DOWN_ZERO_ONE);
testChildPanel.setFill(GLPanel::GLPANEL_FILL_GRAD_BAR_X);
testChildPanel.setFillColor(RGB3f(0.0,0.0,1.0), RGB3f(0.0,1.0,0.0));
testChildPanel.setFillColor(RGBA4f(0.0,0.0,1.0), RGBA4f(0.0,1.0,0.0));
testChildPanel.setBorderPx(1);
testChildPanel2.setPosition(0.0, -0.66);
testChildPanel2.setSize(1.0, 0.33);
testChildPanel2.setMarginPx(5);
testChildPanel2.setFill(GLPanel::GLPANEL_FILL_GRAD_X);
testChildPanel2.setFillColor(RGB3f(0.0,0.0,1.0), RGB3f(0.0,1.0,0.0));
testChildPanel2.setBorderColor(RGB3f(1.0,0.0,0.0));
testChildPanel2.setFillColor(RGBA4f(0.0,0.0,1.0), RGBA4f(0.0,1.0,0.0));
testChildPanel2.setBorderColor(RGBA4f(1.0,0.0,0.0));
testChildPanel2.setBorderPx(1);
testChildPanel3.setPosition(0.0, 0.66);
testChildPanel3.setSize(1.0, 0.33);
testChildPanel3.setMarginPx(5);
testChildPanel3.setFill(GLPanel::GLPANEL_FILL_GRAD_X);
testChildPanel3.setFillColor(RGB3f(0.0,0.0,1.0), RGB3f(0.0,1.0,0.0));
testChildPanel3.setBorderColor(RGB3f(1.0,0.0,0.0));
testChildPanel3.setFillColor(RGBA4f(0.0,0.0,1.0), RGBA4f(0.0,1.0,0.0));
testChildPanel3.setBorderColor(RGBA4f(1.0,0.0,0.0));
testChildPanel3.setBorderPx(1);
testText1.setText("Testing 123..");

View File

@ -41,27 +41,27 @@ DefaultColorTheme::DefaultColorTheme() {
waterfallGradient.addColor(GradientColor(1.0, 1.0, 0));
waterfallGradient.addColor(GradientColor(1.0, 0.2, 0.0));
waterfallGradient.generate(256);
waterfallHighlight = RGB3f(1, 1, 1);
waterfallNew = RGB3f(0, 1, 0);
waterfallHover = RGB3f(1, 1, 0);
waterfallDestroy = RGB3f(1, 0, 0);
fftLine = RGB3f(0.9, 0.9, 0.9);
fftHighlight = RGB3f(1, 1, 1);
scopeLine = RGB3f(0.9, 0.9, 0.9);
tuningBarLight = RGB3f(0.2, 0.2, 0.9);
tuningBarDark = RGB3f(0.0, 0.0, 0.35);
tuningBarUp = RGB3f(1.0, 139.0/255.0, 96.0/255.0);
tuningBarDown = RGB3f(148.0/255.0, 148.0/255.0, 1.0);
meterLevel = RGB3f(0.1, 0.75, 0.1);
meterValue = RGB3f(0.75, 0.1, 0.1);
text = RGB3f(1, 1, 1);
freqLine = RGB3f(1, 1, 1);
button = RGB3f(0.65, 0.65, 0.65);
buttonHighlight = RGB3f(1, 1, 0);
waterfallHighlight = RGBA4f(1, 1, 1);
waterfallNew = RGBA4f(0, 1, 0);
waterfallHover = RGBA4f(1, 1, 0);
waterfallDestroy = RGBA4f(1, 0, 0);
fftLine = RGBA4f(0.9, 0.9, 0.9);
fftHighlight = RGBA4f(1, 1, 1);
scopeLine = RGBA4f(0.9, 0.9, 0.9);
tuningBarLight = RGBA4f(0.2, 0.2, 0.9);
tuningBarDark = RGBA4f(0.0, 0.0, 0.35);
tuningBarUp = RGBA4f(1.0, 139.0/255.0, 96.0/255.0);
tuningBarDown = RGBA4f(148.0/255.0, 148.0/255.0, 1.0);
meterLevel = RGBA4f(0.1, 0.75, 0.1);
meterValue = RGBA4f(0.75, 0.1, 0.1);
text = RGBA4f(1, 1, 1);
freqLine = RGBA4f(1, 1, 1);
button = RGBA4f(0.65, 0.65, 0.65);
buttonHighlight = RGBA4f(1, 1, 0);
scopeBackground = RGB3f(0.1, 0.1, 0.1);
fftBackground = RGB3f(0.1, 0.1, 0.1);
generalBackground = RGB3f(0.1, 0.1, 0.1);
scopeBackground = RGBA4f(0.1, 0.1, 0.1);
fftBackground = RGBA4f(0.1, 0.1, 0.1);
generalBackground = RGBA4f(0.1, 0.1, 0.1);
}
@ -72,27 +72,27 @@ RadarColorTheme::RadarColorTheme() {
waterfallGradient.addColor(GradientColor(40.0 / 255.0, 240.0 / 255.0, 60.0 / 255.0));
waterfallGradient.addColor(GradientColor(250.0 / 255.0, 250.0 / 255.0, 250.0 / 255.0));
waterfallGradient.generate(256);
waterfallHighlight = RGB3f(1, 1, 1);
waterfallNew = RGB3f(0, 1, 0);
waterfallHover = RGB3f(1, 1, 0);
waterfallDestroy = RGB3f(1, 0, 0);
fftLine = RGB3f(0.8, 1.0, 0.8);
fftHighlight = RGB3f(1, 1, 1);
scopeLine = RGB3f(0.8, 1.0, 0.8);
tuningBarLight = RGB3f(0.0, 0.45, 0.0);
tuningBarDark = RGB3f(0.0, 0.1, 0.0);
tuningBarUp = RGB3f(1.0, 139.0/255.0, 96.0/255.0);
tuningBarDown = RGB3f(148.0/255.0, 0.0, 0.0);
meterLevel = RGB3f(0, 0.5, 0);
meterValue = RGB3f(0, 0.5, 0);
text = RGB3f(0.8, 1.0, 0.8);
freqLine = RGB3f(1, 1, 1);
button = RGB3f(0.65, 0.75, 0.65);
buttonHighlight = RGB3f(0.65, 1.0, 0.65);
waterfallHighlight = RGBA4f(1, 1, 1);
waterfallNew = RGBA4f(0, 1, 0);
waterfallHover = RGBA4f(1, 1, 0);
waterfallDestroy = RGBA4f(1, 0, 0);
fftLine = RGBA4f(0.8, 1.0, 0.8);
fftHighlight = RGBA4f(1, 1, 1);
scopeLine = RGBA4f(0.8, 1.0, 0.8);
tuningBarLight = RGBA4f(0.0, 0.45, 0.0);
tuningBarDark = RGBA4f(0.0, 0.1, 0.0);
tuningBarUp = RGBA4f(1.0, 139.0/255.0, 96.0/255.0);
tuningBarDown = RGBA4f(148.0/255.0, 0.0, 0.0);
meterLevel = RGBA4f(0, 0.5, 0);
meterValue = RGBA4f(0, 0.5, 0);
text = RGBA4f(0.8, 1.0, 0.8);
freqLine = RGBA4f(1, 1, 1);
button = RGBA4f(0.65, 0.75, 0.65);
buttonHighlight = RGBA4f(0.65, 1.0, 0.65);
scopeBackground = RGB3f(0.05, 0.1, 0.05);
fftBackground = RGB3f(0.05, 0.1, 0.05);
generalBackground = RGB3f(0.05, 0.1, 0.05);
scopeBackground = RGBA4f(0.05, 0.1, 0.05);
fftBackground = RGBA4f(0.05, 0.1, 0.05);
generalBackground = RGBA4f(0.05, 0.1, 0.05);
}
BlackAndWhiteColorTheme::BlackAndWhiteColorTheme() {
@ -101,27 +101,27 @@ BlackAndWhiteColorTheme::BlackAndWhiteColorTheme() {
waterfallGradient.addColor(GradientColor(0.75, 0.75, 0.75));
waterfallGradient.addColor(GradientColor(1.0, 1.0, 1.0));
waterfallGradient.generate(256);
waterfallHighlight = RGB3f(1, 1, 0.9);
waterfallNew = RGB3f(0, 1, 0);
waterfallHover = RGB3f(1, 1, 0);
waterfallDestroy = RGB3f(1, 0, 0);
fftLine = RGB3f(0.9, 0.9, 0.9);
fftHighlight = RGB3f(1, 1, 0.9);
scopeLine = RGB3f(0.9, 0.9, 0.9);
tuningBarLight = RGB3f(0.4, 0.4, 0.4);
tuningBarDark = RGB3f(0.1, 0.1, 0.1);
tuningBarUp = RGB3f(0.8, 0.8, 0.8);
tuningBarDown = RGB3f(0.4, 0.4, 0.4);
meterLevel = RGB3f(0.5, 0.5, 0.5);
meterValue = RGB3f(0.5, 0.5, 0.5);
text = RGB3f(1, 1, 1);
freqLine = RGB3f(1, 1, 1);
button = RGB3f(0.65, 0.65, 0.65);
buttonHighlight = RGB3f(1, 1, 1);
waterfallHighlight = RGBA4f(1, 1, 0.9);
waterfallNew = RGBA4f(0, 1, 0);
waterfallHover = RGBA4f(1, 1, 0);
waterfallDestroy = RGBA4f(1, 0, 0);
fftLine = RGBA4f(0.9, 0.9, 0.9);
fftHighlight = RGBA4f(1, 1, 0.9);
scopeLine = RGBA4f(0.9, 0.9, 0.9);
tuningBarLight = RGBA4f(0.4, 0.4, 0.4);
tuningBarDark = RGBA4f(0.1, 0.1, 0.1);
tuningBarUp = RGBA4f(0.8, 0.8, 0.8);
tuningBarDown = RGBA4f(0.4, 0.4, 0.4);
meterLevel = RGBA4f(0.5, 0.5, 0.5);
meterValue = RGBA4f(0.5, 0.5, 0.5);
text = RGBA4f(1, 1, 1);
freqLine = RGBA4f(1, 1, 1);
button = RGBA4f(0.65, 0.65, 0.65);
buttonHighlight = RGBA4f(1, 1, 1);
scopeBackground = RGB3f(0.1, 0.1, 0.1);
fftBackground = RGB3f(0.1, 0.1, 0.1);
generalBackground = RGB3f(0.1, 0.1, 0.1);
scopeBackground = RGBA4f(0.1, 0.1, 0.1);
fftBackground = RGBA4f(0.1, 0.1, 0.1);
generalBackground = RGBA4f(0.1, 0.1, 0.1);
}
@ -139,27 +139,27 @@ SharpColorTheme::SharpColorTheme() {
waterfallGradient.addColor(GradientColor(1.0, 0.25, 0.0));
waterfallGradient.addColor(GradientColor(0.5, 0.1, 0.0));
waterfallGradient.generate(256);
waterfallHighlight = RGB3f(0.9, 0.9, 1.0);
waterfallNew = RGB3f(0, 1, 0);
waterfallHover = RGB3f(1, 1, 0);
waterfallDestroy = RGB3f(1, 0, 0);
fftLine = RGB3f(0.9, 0.9, 1.0);
fftHighlight = RGB3f(0.9, 0.9, 1.0);
scopeLine = RGB3f(0.85, 0.85, 1.0);
tuningBarLight = RGB3f(28.0 / 255.0, 106.0 / 255.0, 179.0 / 255.0);
tuningBarDark = RGB3f(14.0 / 255.0, 53.0 / 255.0, 89.5 / 255.0);
tuningBarUp = RGB3f(0.7, 0.7, 0.7);
tuningBarDown = RGB3f(1.0, 0.0, 0.0);
meterLevel = RGB3f(28.0 / 255.0, 106.0 / 255.0, 179.0 / 255.0);
meterValue = RGB3f(190.0 / 255.0, 190.0 / 255.0, 60.0 / 255.0);
text = RGB3f(0.9, 0.9, 1);
freqLine = RGB3f(0.85, 0.85, 1.0);
button = RGB3f(217.0 / 255.0, 218.0 / 255.0, 228.0 / 255.0);
buttonHighlight = RGB3f(208.0 / 255.0, 249.0 / 255.0, 255.0 / 255.0);
waterfallHighlight = RGBA4f(0.9, 0.9, 1.0);
waterfallNew = RGBA4f(0, 1, 0);
waterfallHover = RGBA4f(1, 1, 0);
waterfallDestroy = RGBA4f(1, 0, 0);
fftLine = RGBA4f(0.9, 0.9, 1.0);
fftHighlight = RGBA4f(0.9, 0.9, 1.0);
scopeLine = RGBA4f(0.85, 0.85, 1.0);
tuningBarLight = RGBA4f(28.0 / 255.0, 106.0 / 255.0, 179.0 / 255.0);
tuningBarDark = RGBA4f(14.0 / 255.0, 53.0 / 255.0, 89.5 / 255.0);
tuningBarUp = RGBA4f(0.7, 0.7, 0.7);
tuningBarDown = RGBA4f(1.0, 0.0, 0.0);
meterLevel = RGBA4f(28.0 / 255.0, 106.0 / 255.0, 179.0 / 255.0);
meterValue = RGBA4f(190.0 / 255.0, 190.0 / 255.0, 60.0 / 255.0);
text = RGBA4f(0.9, 0.9, 1);
freqLine = RGBA4f(0.85, 0.85, 1.0);
button = RGBA4f(217.0 / 255.0, 218.0 / 255.0, 228.0 / 255.0);
buttonHighlight = RGBA4f(208.0 / 255.0, 249.0 / 255.0, 255.0 / 255.0);
scopeBackground = RGB3f(0.05, 0.05, 0.15);
fftBackground = RGB3f(0.05, 0.05, 0.15);
generalBackground = RGB3f(0.05, 0.05, 0.15);
scopeBackground = RGBA4f(0.05, 0.05, 0.15);
fftBackground = RGBA4f(0.05, 0.05, 0.15);
generalBackground = RGBA4f(0.05, 0.05, 0.15);
}
RadColorTheme::RadColorTheme() {
@ -170,27 +170,27 @@ RadColorTheme::RadColorTheme() {
waterfallGradient.addColor(GradientColor(1.0, 40.0 / 255.0, 40.0 / 255.0));
waterfallGradient.addColor(GradientColor(1.0, 1.0, 1.0));
waterfallGradient.generate(256);
waterfallHighlight = RGB3f(1, 1, 1);
waterfallNew = RGB3f(0, 1, 0);
waterfallHover = RGB3f(1, 1, 0);
waterfallDestroy = RGB3f(1, 0, 0);
fftLine = RGB3f(1.0, 0.9, 0.9);
fftHighlight = RGB3f(1, 1, 1);
scopeLine = RGB3f(1.0, 0.9, 0.9);
tuningBarLight = RGB3f(0.0, 0.45, 0.0);
tuningBarDark = RGB3f(0.0, 0.1, 0.0);
tuningBarUp = RGB3f(1.0, 0.0, 0.0);
tuningBarDown = RGB3f(0.0, 0.5, 1.0);
meterLevel = RGB3f(0, 0.5, 0);
meterValue = RGB3f(0.5, 0, 0);
text = RGB3f(1, 1, 1);
freqLine = RGB3f(1, 1, 1);
button = RGB3f(0.65, 0.65, 0.65);
buttonHighlight = RGB3f(0.76, 0.65, 0);
waterfallHighlight = RGBA4f(1, 1, 1);
waterfallNew = RGBA4f(0, 1, 0);
waterfallHover = RGBA4f(1, 1, 0);
waterfallDestroy = RGBA4f(1, 0, 0);
fftLine = RGBA4f(1.0, 0.9, 0.9);
fftHighlight = RGBA4f(1, 1, 1);
scopeLine = RGBA4f(1.0, 0.9, 0.9);
tuningBarLight = RGBA4f(0.0, 0.45, 0.0);
tuningBarDark = RGBA4f(0.0, 0.1, 0.0);
tuningBarUp = RGBA4f(1.0, 0.0, 0.0);
tuningBarDown = RGBA4f(0.0, 0.5, 1.0);
meterLevel = RGBA4f(0, 0.5, 0);
meterValue = RGBA4f(0.5, 0, 0);
text = RGBA4f(1, 1, 1);
freqLine = RGBA4f(1, 1, 1);
button = RGBA4f(0.65, 0.65, 0.65);
buttonHighlight = RGBA4f(0.76, 0.65, 0);
scopeBackground = RGB3f(13.0 / 255.0, 47.0 / 255.0, 9.0 / 255.0);
fftBackground = RGB3f(0, 0, 50.0 / 255.0);
generalBackground = RGB3f(13.0 / 255.0, 47.0 / 255.0, 9.0 / 255.0);
scopeBackground = RGBA4f(13.0 / 255.0, 47.0 / 255.0, 9.0 / 255.0);
fftBackground = RGBA4f(0, 0, 50.0 / 255.0);
generalBackground = RGBA4f(13.0 / 255.0, 47.0 / 255.0, 9.0 / 255.0);
}
TouchColorTheme::TouchColorTheme() {
@ -204,27 +204,27 @@ TouchColorTheme::TouchColorTheme() {
waterfallGradient.addColor(GradientColor(255.0 / 255.0, 0.0 / 255.0, 0.0 / 255.0));
waterfallGradient.addColor(GradientColor(255.0 / 255.0, 255.0 / 255.0, 255.0 / 255.0));
waterfallGradient.generate(256);
waterfallHighlight = RGB3f(1, 1, 1);
waterfallNew = RGB3f(0, 1, 0);
waterfallHover = RGB3f(1, 1, 0);
waterfallDestroy = RGB3f(1, 0, 0);
fftLine = RGB3f(234.0 / 255.0, 232.0 / 255.0, 247.0 / 255.0);
fftHighlight = RGB3f(1.0, 1.0, 1.0);
scopeLine = RGB3f(234.0 / 255.0, 232.0 / 255.0, 247.0 / 255.0);
tuningBarLight = RGB3f(0.2, 0.2, 0.7);
tuningBarDark = RGB3f(0.1, 0.1, 0.45);
tuningBarUp = RGB3f(0.5, 139.0/255.0, 96.0/255.0);
tuningBarDown = RGB3f(0.6, 108.0/255.0, 1.0);
meterLevel = RGB3f(61.0 / 255.0, 57.0 / 255.0, 88.0 / 255.0);
meterValue = RGB3f(61.0 / 255.0, 57.0 / 255.0, 88.0 / 255.0);
text = RGB3f(1, 1, 1);
freqLine = RGB3f(1, 1, 1);
button = RGB3f(1.0, 1.0, 1.0);
buttonHighlight = RGB3f(208.0 / 255.0, 202.0 / 255.0, 247.0 / 255.0);
waterfallHighlight = RGBA4f(1, 1, 1);
waterfallNew = RGBA4f(0, 1, 0);
waterfallHover = RGBA4f(1, 1, 0);
waterfallDestroy = RGBA4f(1, 0, 0);
fftLine = RGBA4f(234.0 / 255.0, 232.0 / 255.0, 247.0 / 255.0);
fftHighlight = RGBA4f(1.0, 1.0, 1.0);
scopeLine = RGBA4f(234.0 / 255.0, 232.0 / 255.0, 247.0 / 255.0);
tuningBarLight = RGBA4f(0.2, 0.2, 0.7);
tuningBarDark = RGBA4f(0.1, 0.1, 0.45);
tuningBarUp = RGBA4f(0.5, 139.0/255.0, 96.0/255.0);
tuningBarDown = RGBA4f(0.6, 108.0/255.0, 1.0);
meterLevel = RGBA4f(61.0 / 255.0, 57.0 / 255.0, 88.0 / 255.0);
meterValue = RGBA4f(61.0 / 255.0, 57.0 / 255.0, 88.0 / 255.0);
text = RGBA4f(1, 1, 1);
freqLine = RGBA4f(1, 1, 1);
button = RGBA4f(1.0, 1.0, 1.0);
buttonHighlight = RGBA4f(208.0 / 255.0, 202.0 / 255.0, 247.0 / 255.0);
scopeBackground = RGB3f(39.0 / 255.0, 36.0 / 255.0, 56.0 / 255.0);
fftBackground = RGB3f(39.0 / 255.0, 36.0 / 255.0, 56.0 / 255.0);
generalBackground = RGB3f(61.0 / 255.0, 57.0 / 255.0, 88.0 / 255.0);
scopeBackground = RGBA4f(39.0 / 255.0, 36.0 / 255.0, 56.0 / 255.0);
fftBackground = RGBA4f(39.0 / 255.0, 36.0 / 255.0, 56.0 / 255.0);
generalBackground = RGBA4f(61.0 / 255.0, 57.0 / 255.0, 88.0 / 255.0);
}
@ -239,27 +239,27 @@ HDColorTheme::HDColorTheme() {
waterfallGradient.addColor(GradientColor(255.0 / 255.0, 235.0 / 255.0, 100.0 / 255.0));
waterfallGradient.addColor(GradientColor(250.0 / 255.0, 250.0 / 255.0, 250.0 / 255.0));
waterfallGradient.generate(256);
waterfallHighlight = RGB3f(1, 1, 1);
waterfallNew = RGB3f(0, 1, 0);
waterfallHover = RGB3f(1, 1, 0);
waterfallDestroy = RGB3f(1, 0, 0);
fftLine = RGB3f(0.9, 0.9, 0.9);
fftHighlight = RGB3f(1, 1, 1);
scopeLine = RGB3f(0.9, 0.9, 0.9);
tuningBarLight = RGB3f(0.4, 0.4, 1.0);
tuningBarDark = RGB3f(0.1, 0.1, 0.45);
tuningBarUp = RGB3f(1.0, 139.0/255.0, 96.0/255.0);
tuningBarDown = RGB3f(148.0/255.0, 148.0/255.0, 1.0);
meterLevel = RGB3f(0, 0.5, 0);
meterValue = RGB3f(0.0, 0.0, 1.0);
text = RGB3f(1, 1, 1);
freqLine = RGB3f(1, 1, 1);
button = RGB3f(0, 0.7, 0.7);
buttonHighlight = RGB3f(1, 1, 1);
waterfallHighlight = RGBA4f(1, 1, 1);
waterfallNew = RGBA4f(0, 1, 0);
waterfallHover = RGBA4f(1, 1, 0);
waterfallDestroy = RGBA4f(1, 0, 0);
fftLine = RGBA4f(0.9, 0.9, 0.9);
fftHighlight = RGBA4f(1, 1, 1);
scopeLine = RGBA4f(0.9, 0.9, 0.9);
tuningBarLight = RGBA4f(0.4, 0.4, 1.0);
tuningBarDark = RGBA4f(0.1, 0.1, 0.45);
tuningBarUp = RGBA4f(1.0, 139.0/255.0, 96.0/255.0);
tuningBarDown = RGBA4f(148.0/255.0, 148.0/255.0, 1.0);
meterLevel = RGBA4f(0, 0.5, 0);
meterValue = RGBA4f(0.0, 0.0, 1.0);
text = RGBA4f(1, 1, 1);
freqLine = RGBA4f(1, 1, 1);
button = RGBA4f(0, 0.7, 0.7);
buttonHighlight = RGBA4f(1, 1, 1);
scopeBackground = RGB3f(0.0, 0.0, 48.0 / 255.0);
fftBackground = RGB3f(0.0, 0.0, 48.0 / 255.0);
generalBackground = RGB3f(0.0, 0.0, 0.0);
scopeBackground = RGBA4f(0.0, 0.0, 48.0 / 255.0);
fftBackground = RGBA4f(0.0, 0.0, 48.0 / 255.0);
generalBackground = RGBA4f(0.0, 0.0, 0.0);
}

View File

@ -15,55 +15,56 @@
#define COLOR_THEME_RADAR 6
#define COLOR_THEME_MAX 7
class RGB3f {
class RGBA4f {
public:
float r, g, b;
RGB3f(float r, float g, float b) :
r(r), g(g), b(b) {
float r, g, b, a;
RGBA4f(float r, float g, float b, float a = 1.0) :
r(r), g(g), b(b), a(a) {
}
RGB3f() :
RGB3f(0, 0, 0) {
RGBA4f() :
RGBA4f(0, 0, 0) {
}
~RGB3f() {
~RGBA4f() {
}
RGB3f & operator=(const RGB3f &other) {
RGBA4f & operator=(const RGBA4f &other) {
r = other.r;
g = other.g;
b = other.b;
a = other.a;
return *this;
}
RGB3f operator*(float v) { return RGB3f(r*v, g*v, b*v); }
RGBA4f operator*(float v) { return RGBA4f(r*v, g*v, b*v); }
};
class ColorTheme {
public:
RGB3f waterfallHighlight;
RGB3f waterfallNew;
RGB3f wfHighlight;
RGB3f waterfallHover;
RGB3f waterfallDestroy;
RGB3f fftLine;
RGB3f fftHighlight;
RGB3f scopeLine;
RGB3f tuningBarLight;
RGB3f tuningBarDark;
RGB3f tuningBarUp;
RGB3f tuningBarDown;
RGB3f meterLevel;
RGB3f meterValue;
RGB3f text;
RGB3f freqLine;
RGB3f button;
RGB3f buttonHighlight;
RGBA4f waterfallHighlight;
RGBA4f waterfallNew;
RGBA4f wfHighlight;
RGBA4f waterfallHover;
RGBA4f waterfallDestroy;
RGBA4f fftLine;
RGBA4f fftHighlight;
RGBA4f scopeLine;
RGBA4f tuningBarLight;
RGBA4f tuningBarDark;
RGBA4f tuningBarUp;
RGBA4f tuningBarDown;
RGBA4f meterLevel;
RGBA4f meterValue;
RGBA4f text;
RGBA4f freqLine;
RGBA4f button;
RGBA4f buttonHighlight;
RGB3f scopeBackground;
RGB3f fftBackground;
RGB3f generalBackground;
RGBA4f scopeBackground;
RGBA4f fftBackground;
RGBA4f generalBackground;
Gradient waterfallGradient;

View File

@ -59,7 +59,7 @@ PrimaryGLContext::PrimaryGLContext(wxGLCanvas *canvas, wxGLContext *sharedContex
//#endif
}
void PrimaryGLContext::DrawDemodInfo(DemodulatorInstance *demod, RGB3f color, long long center_freq, long long srate) {
void PrimaryGLContext::DrawDemodInfo(DemodulatorInstance *demod, RGBA4f color, long long center_freq, long long srate) {
if (!demod) {
return;
}
@ -151,7 +151,7 @@ void PrimaryGLContext::DrawDemodInfo(DemodulatorInstance *demod, RGB3f color, lo
}
void PrimaryGLContext::DrawDemod(DemodulatorInstance *demod, RGB3f color, long long center_freq, long long srate) {
void PrimaryGLContext::DrawDemod(DemodulatorInstance *demod, RGBA4f color, long long center_freq, long long srate) {
if (!demod) {
return;
}
@ -248,7 +248,7 @@ void PrimaryGLContext::DrawDemod(DemodulatorInstance *demod, RGB3f color, long l
}
void PrimaryGLContext::DrawFreqSelector(float uxPos, RGB3f color, float w, long long center_freq, long long srate) {
void PrimaryGLContext::DrawFreqSelector(float uxPos, RGBA4f color, float w, long long center_freq, long long srate) {
DemodulatorInstance *demod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
long long bw = 0;
@ -299,7 +299,7 @@ void PrimaryGLContext::DrawFreqSelector(float uxPos, RGB3f color, float w, long
}
void PrimaryGLContext::DrawRangeSelector(float uxPos1, float uxPos2, RGB3f color) {
void PrimaryGLContext::DrawRangeSelector(float uxPos1, float uxPos2, RGBA4f color) {
if (uxPos2 < uxPos1) {
float temp = uxPos2;
uxPos2=uxPos1;

View File

@ -21,10 +21,10 @@ public:
void BeginDraw(float r, float g, float b);
void EndDraw();
void DrawFreqSelector(float uxPos, RGB3f color, float w = 0, long long center_freq = -1, long long srate = 0);
void DrawRangeSelector(float uxPos1, float uxPos2, RGB3f color);
void DrawDemod(DemodulatorInstance *demod, RGB3f color, long long center_freq = -1, long long srate = 0);
void DrawDemodInfo(DemodulatorInstance *demod, RGB3f color, long long center_freq = -1, long long srate = 0);
void DrawFreqSelector(float uxPos, RGBA4f color, float w = 0, long long center_freq = -1, long long srate = 0);
void DrawRangeSelector(float uxPos1, float uxPos2, RGBA4f color);
void DrawDemod(DemodulatorInstance *demod, RGBA4f color, long long center_freq = -1, long long srate = 0);
void DrawDemodInfo(DemodulatorInstance *demod, RGBA4f color, long long center_freq = -1, long long srate = 0);
void setHoverAlpha(float hoverAlpha);

View File

@ -73,6 +73,8 @@ void SpectrumCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
spectrumPanel.calcTransform(CubicVR::mat4::identity());
spectrumPanel.draw();
glLoadIdentity();
std::vector<DemodulatorInstance *> &demods = wxGetApp().getDemodMgr().getDemodulators();
for (int i = 0, iMax = demods.size(); i < iMax; i++) {
@ -81,6 +83,8 @@ void SpectrumCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
glContext->EndDraw();
spectrumPanel.drawChildren();
SwapBuffers();
}
@ -122,10 +126,18 @@ void SpectrumCanvas::moveCenterFrequency(long long freqChange) {
freq -= freqChange;
}
wxGetApp().setFrequency(freq);
setStatusText("Set center frequency: %s", freq);
}
}
void SpectrumCanvas::setShowDb(bool showDb) {
spectrumPanel.setShowDb(showDb);
}
bool SpectrumCanvas::getShowDb() {
return spectrumPanel.getShowDb();
}
void SpectrumCanvas::OnMouseMoved(wxMouseEvent& event) {
InteractiveCanvas::OnMouseMoved(event);
if (mouseTracker.mouseDown()) {
@ -135,7 +147,7 @@ void SpectrumCanvas::OnMouseMoved(wxMouseEvent& event) {
moveCenterFrequency(freqChange);
}
} else {
setStatusText("Click and drag to adjust center frequency.");
setStatusText("Click and drag to adjust center frequency. 'B' to toggle decibels display.");
}
}

View File

@ -19,6 +19,9 @@ public:
void attachWaterfallCanvas(WaterfallCanvas *canvas_in);
void moveCenterFrequency(long long freqChange);
void setShowDb(bool showDb);
bool getShowDb();
SpectrumVisualDataQueue *getVisualDataQueue();
private:

View File

@ -98,10 +98,10 @@ void TuningCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
0.75, mouseTracker.getOriginMouseX(), mouseTracker.getMouseX());
}
RGB3f clr = top ? ThemeMgr::mgr.currentTheme->tuningBarUp : ThemeMgr::mgr.currentTheme->tuningBarDown;
RGBA4f clr = top ? ThemeMgr::mgr.currentTheme->tuningBarUp : ThemeMgr::mgr.currentTheme->tuningBarDown;
RGB3f clrDark = ThemeMgr::mgr.currentTheme->tuningBarDark;
RGB3f clrMid = ThemeMgr::mgr.currentTheme->tuningBarLight;
RGBA4f clrDark = ThemeMgr::mgr.currentTheme->tuningBarDark;
RGBA4f clrMid = ThemeMgr::mgr.currentTheme->tuningBarLight;
glContext->DrawTunerBarIndexed(1, 3, 11, freqDP, freqW, clrMid, 0.25, true, true); // freq
glContext->DrawTunerBarIndexed(4, 6, 11, freqDP, freqW, clrDark, 0.25, true, true);
@ -143,7 +143,7 @@ void TuningCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
glContext->DrawTuner(freq, 11, freqDP, freqW);
int snap = wxGetApp().getFrequencySnap();
if (snap != 1) {
glContext->DrawTunerDigitBox((int)log10(snap), 11, freqDP, freqW, RGB3f(1.0,0.0,0.0));
glContext->DrawTunerDigitBox((int)log10(snap), 11, freqDP, freqW, RGBA4f(1.0,0.0,0.0));
}
}
glContext->DrawTuner(bw, 7, bwDP, bwW);

View File

@ -112,7 +112,7 @@ void TuningContext::DrawTuner(long long freq, int count, float displayPos, float
}
void TuningContext::DrawTunerDigitBox(int index, int count, float displayPos, float displayWidth, RGB3f c) {
void TuningContext::DrawTunerDigitBox(int index, int count, float displayPos, float displayWidth, RGBA4f c) {
GLint vp[4];
glGetIntegerv( GL_VIEWPORT, vp);
@ -152,7 +152,7 @@ int TuningContext::GetTunerDigitIndex(float mPos, int count, float displayPos, f
return count - index;
}
void TuningContext::DrawTunerBarIndexed(int start, int end, int count, float displayPos, float displayWidth, RGB3f color, float alpha, bool top,
void TuningContext::DrawTunerBarIndexed(int start, int end, int count, float displayPos, float displayWidth, RGBA4f color, float alpha, bool top,
bool bottom) {
float ofs = (displayWidth / (float) count);
float p2 = displayPos + ofs * (float) (count - start + 1);

View File

@ -14,9 +14,9 @@ public:
void DrawBegin();
void Draw(float r, float g, float b, float a, float p1, float p2);
void DrawTuner(long long freq, int count, float displayPos, float displayWidth);
void DrawTunerDigitBox(int index, int count, float displayPos, float displayWidth, RGB3f c);
void DrawTunerDigitBox(int index, int count, float displayPos, float displayWidth, RGBA4f c);
int GetTunerDigitIndex(float mPos, int count, float displayPos, float displayWidth);
void DrawTunerBarIndexed(int start, int end, int count, float displayPos, float displayWidth, RGB3f color, float alpha, bool top, bool bottom);
void DrawTunerBarIndexed(int start, int end, int count, float displayPos, float displayWidth, RGBA4f color, float alpha, bool top, bool bottom);
void DrawDemodFreqBw(long long freq, unsigned int bw, long long center);
void DrawEnd();

View File

@ -338,6 +338,11 @@ void WaterfallCanvas::OnKeyDown(wxKeyEvent& event) {
activeDemod->setStereo(true);
}
break;
case 'B':
if (spectrumCanvas) {
spectrumCanvas->setShowDb(!spectrumCanvas->getShowDb());
}
break;
case WXK_SPACE:
wxGetApp().showFrequencyInput();
break;