Display demodulation type on waterfall

This commit is contained in:
Charles J. Cliffe 2015-01-03 18:45:34 -05:00
parent 6b03125fbb
commit 904050da13
3 changed files with 52 additions and 3 deletions

View File

@ -195,8 +195,55 @@ void PrimaryGLContext::DrawDemod(DemodulatorInstance *demod, float r, float g, f
glVertex3f((uxPos - 0.5) * 2.0 + ofs, 1.0, 0.0);
glEnd();
GLint vp[4];
glGetIntegerv( GL_VIEWPORT, vp);
float viewHeight = (float) vp[3];
float viewWidth = (float) vp[2];
float labelHeight = 20.0 / viewHeight;
float xOfs = (2.0 / viewWidth);
float yOfs = (2.0 / viewHeight);
float hPos = labelHeight;
glDisable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDisable(GL_COLOR_MATERIAL);
glEnable(GL_BLEND);
std::string demodStr;
GLFont::Align demodAlign;
switch (demod->getDemodulatorType()) {
case DEMOD_TYPE_FM:
demodStr = "FM";
demodAlign = GLFont::GLFONT_ALIGN_CENTER;
break;
case DEMOD_TYPE_AM:
demodStr = "AM";
demodAlign = GLFont::GLFONT_ALIGN_CENTER;
break;
case DEMOD_TYPE_LSB:
demodStr = "LSB";
demodAlign = GLFont::GLFONT_ALIGN_RIGHT;
break;
case DEMOD_TYPE_USB:
demodStr = "USB";
demodAlign = GLFont::GLFONT_ALIGN_LEFT;
break;
}
glColor3f(0, 0, 0);
getFont(PrimaryGLContext::GLFONT_SIZE16).drawString(demodStr, 2.0 * (uxPos - 0.5) + xOfs, -1.0 + hPos - yOfs, 16, demodAlign,
GLFont::GLFONT_ALIGN_CENTER);
glColor3f(0.8, 0.8, 0.8);
getFont(PrimaryGLContext::GLFONT_SIZE16).drawString(demodStr, 2.0 * (uxPos - 0.5), -1.0 + hPos, 16, demodAlign, GLFont::GLFONT_ALIGN_CENTER);
glDisable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
}
void PrimaryGLContext::DrawFreqSelector(float uxPos, float r, float g, float b, float w, int center_freq, int srate) {

View File

@ -655,7 +655,7 @@ void WaterfallCanvas::OnMouseMoved(wxMouseEvent& event) {
if (shiftDown) {
setStatusText("Click to create a new demodulator or hold ALT to drag range.");
} else {
setStatusText("Click to move active demodulator frequency or hold ALT to drag range; hold SHIFT to create new. A / Z to Zoom. Arrow keys (+SHIFT) to move center frequency.");
setStatusText("Click to move active demodulator frequency or hold ALT to drag range; hold SHIFT to create new. Right drag or A / Z to Zoom. Arrow keys (+SHIFT) to move center frequency.");
}
}

View File

@ -45,8 +45,6 @@ void WaterfallContext::Setup(int fft_size_in, int num_waterfall_lines_in) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
glPixelTransferi(GL_MAP_COLOR, GL_TRUE);
glPixelMapfv(GL_PIXEL_MAP_I_TO_R, 256, &(grad.getRed())[0]);
glPixelMapfv(GL_PIXEL_MAP_I_TO_G, 256, &(grad.getGreen())[0]);
@ -56,6 +54,8 @@ void WaterfallContext::Setup(int fft_size_in, int num_waterfall_lines_in) {
void WaterfallContext::Draw(std::vector<float> &points) {
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
if (points.size()) {
memmove(waterfall_tex + fft_size, waterfall_tex, (waterfall_lines - 1) * fft_size);
@ -90,5 +90,7 @@ void WaterfallContext::Draw(std::vector<float> &points) {
glVertex3f(-1.0, 1.0, 0.0);
glEnd();
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
}