mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-23 12:18:37 -05:00
commit
6ac4661e2e
@ -244,6 +244,9 @@ SET (cubicsdr_sources
|
||||
src/util/GLExt.cpp
|
||||
src/util/GLFont.cpp
|
||||
src/util/DataTree.cpp
|
||||
src/panel/ScopePanel.cpp
|
||||
src/panel/SpectrumPanel.cpp
|
||||
src/panel/WaterfallPanel.cpp
|
||||
src/visual/ColorTheme.cpp
|
||||
src/visual/PrimaryGLContext.cpp
|
||||
src/visual/InteractiveCanvas.cpp
|
||||
@ -256,9 +259,7 @@ SET (cubicsdr_sources
|
||||
src/visual/ScopeCanvas.cpp
|
||||
src/visual/ScopeContext.cpp
|
||||
src/visual/SpectrumCanvas.cpp
|
||||
src/visual/SpectrumContext.cpp
|
||||
src/visual/WaterfallCanvas.cpp
|
||||
src/visual/WaterfallContext.cpp
|
||||
src/process/VisualProcessor.cpp
|
||||
src/process/ScopeVisualProcessor.cpp
|
||||
src/process/SpectrumVisualProcessor.cpp
|
||||
@ -296,6 +297,9 @@ SET (cubicsdr_headers
|
||||
src/util/GLExt.h
|
||||
src/util/GLFont.h
|
||||
src/util/DataTree.h
|
||||
src/panel/ScopePanel.h
|
||||
src/panel/SpectrumPanel.h
|
||||
src/panel/WaterfallPanel.h
|
||||
src/visual/ColorTheme.h
|
||||
src/visual/PrimaryGLContext.h
|
||||
src/visual/InteractiveCanvas.h
|
||||
@ -308,9 +312,7 @@ SET (cubicsdr_headers
|
||||
src/visual/ScopeCanvas.h
|
||||
src/visual/ScopeContext.h
|
||||
src/visual/SpectrumCanvas.h
|
||||
src/visual/SpectrumContext.h
|
||||
src/visual/WaterfallCanvas.h
|
||||
src/visual/WaterfallContext.h
|
||||
src/process/VisualProcessor.h
|
||||
src/process/ScopeVisualProcessor.h
|
||||
src/process/SpectrumVisualProcessor.h
|
||||
@ -339,11 +341,28 @@ SET (cubicsdr_headers
|
||||
external/cubicvr2/math/vec4.h
|
||||
)
|
||||
|
||||
set(REG_EXT "[^/]*([.]cpp|[.]c|[.]h|[.]hpp)$")
|
||||
|
||||
SOURCE_GROUP("Base" REGULAR_EXPRESSION src/${REG_EXT})
|
||||
SOURCE_GROUP("SDR" REGULAR_EXPRESSION src/sdr/${REG_EXT})
|
||||
SOURCE_GROUP("Demodulator" REGULAR_EXPRESSION src/demod/${REG_EXT})
|
||||
SOURCE_GROUP("Audio" REGULAR_EXPRESSION src/audio/${REG_EXT})
|
||||
SOURCE_GROUP("Utility" REGULAR_EXPRESSION src/util/${REG_EXT})
|
||||
SOURCE_GROUP("Panel" REGULAR_EXPRESSION src/panel/${REG_EXT})
|
||||
SOURCE_GROUP("Visual" REGULAR_EXPRESSION src/visual/${REG_EXT})
|
||||
SOURCE_GROUP("Process" REGULAR_EXPRESSION src/process/${REG_EXT})
|
||||
SOURCE_GROUP("UI" REGULAR_EXPRESSION src/ui/${REG_EXT})
|
||||
SOURCE_GROUP("_ext-RTAudio" REGULAR_EXPRESSION external/rtaudio/.*${REG_EXT})
|
||||
SOURCE_GROUP("_ext-LodePNG" REGULAR_EXPRESSION external/lodepng/.*${REG_EXT})
|
||||
SOURCE_GROUP("_ext-TinyXML" REGULAR_EXPRESSION external/tinyxml/.*${REG_EXT})
|
||||
SOURCE_GROUP("_ext-CubicVR2" REGULAR_EXPRESSION external/cubicvr2/.*${REG_EXT})
|
||||
|
||||
include_directories (
|
||||
${PROJECT_SOURCE_DIR}/src/sdr
|
||||
${PROJECT_SOURCE_DIR}/src/demod
|
||||
${PROJECT_SOURCE_DIR}/src/audio
|
||||
${PROJECT_SOURCE_DIR}/src/util
|
||||
${PROJECT_SOURCE_DIR}/src/panel
|
||||
${PROJECT_SOURCE_DIR}/src/visual
|
||||
${PROJECT_SOURCE_DIR}/src/process
|
||||
${PROJECT_SOURCE_DIR}/src/ui
|
||||
@ -586,7 +605,9 @@ IF (UNIX AND BUILD_DEB)
|
||||
${PROJECT_SOURCE_DIR}/font/vera_sans_mono24_0.png
|
||||
${PROJECT_SOURCE_DIR}/font/vera_sans_mono32_0.png
|
||||
${PROJECT_SOURCE_DIR}/font/vera_sans_mono48_0.png
|
||||
${PROJECT_SOURCE_DIR}/src/CubicSDR.png
|
||||
DESTINATION share/cubicsdr)
|
||||
|
||||
INSTALL(FILES CubicSDR.desktop
|
||||
DESTINATION share/applications)
|
||||
INCLUDE(CPack)
|
||||
ENDIF (UNIX AND BUILD_DEB)
|
||||
|
9
CubicSDR.desktop
Normal file
9
CubicSDR.desktop
Normal file
@ -0,0 +1,9 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Exec=CubicSDR %u
|
||||
Icon=/usr/share/cubicsdr/CubicSDR.png
|
||||
Terminal=false
|
||||
Name=CubicSDR
|
||||
GenericName=CubicSDR
|
||||
Comment=Software-Defined Radio Application
|
||||
Categories=Science;HamRadio;DataVisualization;
|
31
README.md
31
README.md
@ -21,9 +21,8 @@ Features and Status:
|
||||
- Simple UI
|
||||
- Devices
|
||||
- [x] RTL-SDR
|
||||
- [ ] rtl_tcp
|
||||
- [ ] HackRF
|
||||
- [ ] Whatever else I can get my hands on
|
||||
- [ ] rtl_tcp client
|
||||
- [ ] gr-osmosdr
|
||||
- Basic Features
|
||||
- [x] Device Selection
|
||||
- [x] Bandwidth
|
||||
@ -33,18 +32,21 @@ Features and Status:
|
||||
- [x] Device PPM
|
||||
- [ ] Default preferences
|
||||
- [ ] Audio defaults
|
||||
- [ ] Device defaults
|
||||
- [x] Device defaults
|
||||
- [ ] Bookmarks
|
||||
- [ ] History
|
||||
- [ ] Run as rtl_tcp server and visualize control
|
||||
- Neat Visuals
|
||||
- [x] Scope
|
||||
- [ ] 2D visuals
|
||||
- [x] Y Scope
|
||||
- [x] Spectrum
|
||||
- [x] Waterfall
|
||||
- [ ] Audio Spectrum
|
||||
- [ ] More 2D visuals
|
||||
- [x] Add faint grid for sense of scale
|
||||
- [ ] Audio Spectrum
|
||||
- [ ] X/Y Scope
|
||||
- [ ] Indicate outer spectrum edges when zoomed
|
||||
- [ ] 3D visuals
|
||||
- [ ] I/Q helix
|
||||
- Demodulation:
|
||||
- [ ] Basic modular expansion
|
||||
- [x] Multiple demodulators per IQ stream
|
||||
@ -56,7 +58,7 @@ Features and Status:
|
||||
- [x] LSB
|
||||
- [x] USB
|
||||
- [x] DSB
|
||||
- [ ] RAW
|
||||
- [x] I/Q
|
||||
- [ ] Controls
|
||||
- [x] Display Frequency and allow manual adjustments
|
||||
- [x] Allow selection of demodulation type
|
||||
@ -64,8 +66,10 @@ Features and Status:
|
||||
- [x] Display signal level and allow squelch control
|
||||
- [x] Display audio output selection
|
||||
- [x] Volume control
|
||||
- [ ] Demodulator input filtering
|
||||
- [ ] Audio filtering
|
||||
- [x] Direct frequency input
|
||||
- [ ] Mute
|
||||
- [ ] Waterfall speed
|
||||
- [ ] RTL-SDR Gain
|
||||
- Basic Input Controls
|
||||
- [x] Drag spectrum to change center frequency
|
||||
- [x] Hold shift and click on waterfall to create a new demodulator
|
||||
@ -88,6 +92,8 @@ Features and Status:
|
||||
- [ ] Recording
|
||||
- Implement digital demodulation supported by liquid-dsp: (http://liquidsdr.org/doc/modem.html)
|
||||
- [ ] Demodulator Lab
|
||||
- [ ] Demodulator I/Q input filtering
|
||||
- [ ] Audio output filtering
|
||||
- [ ] Toggle current demodulator exclusively into "Lab" mode
|
||||
- [ ] Additional visualizations for audio and I/Q stream
|
||||
- [ ] Audio Spectrum
|
||||
@ -115,9 +121,9 @@ Features and Status:
|
||||
- [ ] CPFSK
|
||||
- Optimization
|
||||
- [x] Eliminate large waterfall texture uploads
|
||||
- [ ] Update visuals to OpenGL 3.x
|
||||
- [ ] Update visuals to OpenGL 3.x / OpenGL ES
|
||||
- [ ] Resolve constant refresh on visuals that don't change often
|
||||
- [ ] Resolve driver/platform vertical sync issues
|
||||
- [ ] Resolve all driver/platform vertical sync issues
|
||||
- [ ] Group and divide IQ data distribution workload instead of 100% distribution per instance
|
||||
|
||||
|
||||
@ -140,6 +146,7 @@ Advanced Goals and ideas:
|
||||
* Take control of additional devices and spawning new demodulators (i.e. trunkers)
|
||||
* Script manager / live editor
|
||||
* Provide scriptable liquid-dsp modulation for trancievers?
|
||||
* Allow scripts to launch/run headless (no UI)
|
||||
- "PVR" like mode with waterfall time shifting
|
||||
- L/R and surround-sound balance settings for separating and listening to mono streams
|
||||
- Add tool for converting decimated I/Q recording to video
|
||||
|
2
external/cubicvr2/math/mat3.h
vendored
2
external/cubicvr2/math/mat3.h
vendored
@ -23,7 +23,9 @@ namespace CubicVR {
|
||||
__float a,b,c,d,e,f,g,h,i;
|
||||
|
||||
// __float operator [] (unsigned i) const { return ((__float *)this)[i]; }
|
||||
#ifndef _WIN32
|
||||
__float& operator [] (unsigned i) { return ((__float *)this)[i]; }
|
||||
#endif
|
||||
operator __float*() const { return (__float *)this; }
|
||||
|
||||
mat3(__float ai,__float bi,__float ci,__float di,__float ei,__float fi,__float gi,__float hi,__float ii) {
|
||||
|
3
external/cubicvr2/math/mat4.h
vendored
3
external/cubicvr2/math/mat4.h
vendored
@ -25,7 +25,10 @@ namespace CubicVR {
|
||||
__float a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p;
|
||||
|
||||
// __float operator [] (unsigned i) const { return ((__float *)this)[i]; }
|
||||
#ifndef _WIN32
|
||||
__float& operator [] (unsigned i) { return ((__float *)this)[i]; }
|
||||
#endif
|
||||
|
||||
operator __float*() const { return (__float *)this; }
|
||||
mat4(__float ai,__float bi,__float ci,__float di,__float ei,__float fi,__float gi,__float hi,__float ii,__float ji,__float ki,__float li,__float mi,__float ni,__float oi,__float pi) {
|
||||
a = ai; b = bi; c = ci; d = di; e = ei; f = fi; g = gi; h = hi; i = ii; j = ji; k = ki; l = li; m = mi; n = ni; o = oi; p = pi;
|
||||
|
3
external/cubicvr2/math/vec2.h
vendored
3
external/cubicvr2/math/vec2.h
vendored
@ -25,8 +25,9 @@ namespace CubicVR {
|
||||
__float& v() { return y; }
|
||||
|
||||
// __float operator [] (unsigned i) const { return ((__float *)this)[i]; }
|
||||
#ifndef _WIN32
|
||||
__float& operator [] (unsigned i) { return ((__float *)this)[i]; }
|
||||
|
||||
#endif
|
||||
vec2 (__float xi,__float yi) { x = xi; y = yi; }
|
||||
vec2 () { x = y = 0.0f; }
|
||||
|
||||
|
2
external/cubicvr2/math/vec3.h
vendored
2
external/cubicvr2/math/vec3.h
vendored
@ -29,7 +29,9 @@ namespace CubicVR {
|
||||
__float& g() { return y; }
|
||||
__float& b() { return z; }
|
||||
|
||||
#ifndef _WIN32
|
||||
__float& operator [] (unsigned i) { return ((__float *)this)[i]; }
|
||||
#endif
|
||||
vec3 (__float xi,__float yi,__float zi) { x = xi; y = yi; z = zi; }
|
||||
vec3 () { x = y = z = 0.0f; }
|
||||
|
||||
|
2
external/cubicvr2/math/vec4.h
vendored
2
external/cubicvr2/math/vec4.h
vendored
@ -28,7 +28,9 @@ namespace CubicVR {
|
||||
__float& a() { return w; }
|
||||
|
||||
// __float operator [] (unsigned i) const { return ((__float *)this)[i]; }
|
||||
#ifndef _WIN32
|
||||
__float& operator [] (unsigned i) { return ((__float *)this)[i]; }
|
||||
#endif
|
||||
|
||||
vec4 (__float xi,__float yi,__float zi,__float wi) { x = xi; y = yi; z = zi; w = wi; }
|
||||
vec4 () { x = y = z = w = 0.0f; }
|
||||
|
@ -35,10 +35,11 @@ EVT_CLOSE(AppFrame::OnClose)
|
||||
EVT_MENU(wxID_ANY, AppFrame::OnMenu)
|
||||
EVT_COMMAND(wxID_ANY, wxEVT_THREAD, AppFrame::OnThread)
|
||||
EVT_IDLE(AppFrame::OnIdle)
|
||||
EVT_TIMER(FRAME_TIMER_ID, AppFrame::OnTimer)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
AppFrame::AppFrame() :
|
||||
wxFrame(NULL, wxID_ANY, CUBICSDR_TITLE), activeDemodulator(NULL) {
|
||||
wxFrame(NULL, wxID_ANY, CUBICSDR_TITLE), activeDemodulator(NULL), frame_timer(this, FRAME_TIMER_ID) {
|
||||
|
||||
#ifdef __linux__
|
||||
SetIcon(wxICON(cubicsdr));
|
||||
@ -377,6 +378,8 @@ AppFrame::AppFrame() :
|
||||
wxAcceleratorTable accel(3, entries);
|
||||
SetAcceleratorTable(accel);
|
||||
|
||||
// frame rate = 1000 / 30 = 33ms
|
||||
frame_timer.Start(33);
|
||||
// static const int attribs[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, 0 };
|
||||
// wxLogStatus("Double-buffered display %s supported", wxGLCanvas::IsDisplaySupported(attribs) ? "is" : "not");
|
||||
// ShowFullScreen(true);
|
||||
@ -479,6 +482,11 @@ void AppFrame::OnMenu(wxCommandEvent& event) {
|
||||
ThemeMgr::mgr.setTheme(COLOR_THEME_RADAR);
|
||||
}
|
||||
|
||||
if (event.GetId() >= wxID_THEME_DEFAULT && event.GetId() <= wxID_THEME_RADAR) {
|
||||
demodTuner->Refresh();
|
||||
demodModeSelector->Refresh();
|
||||
}
|
||||
|
||||
switch (event.GetId()) {
|
||||
case wxID_BANDWIDTH_250K:
|
||||
wxGetApp().setSampleRate(250000);
|
||||
@ -587,6 +595,10 @@ void AppFrame::OnThread(wxCommandEvent& event) {
|
||||
}
|
||||
|
||||
void AppFrame::OnIdle(wxIdleEvent& event) {
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void AppFrame::OnTimer(wxTimerEvent& event) {
|
||||
|
||||
DemodulatorInstance *demod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
||||
|
||||
@ -733,7 +745,7 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
|
||||
|
||||
scopeCanvas->setPPMMode(demodTuner->isAltDown());
|
||||
|
||||
|
||||
wxGetApp().getScopeProcessor()->run();
|
||||
wxGetApp().getSpectrumDistributor()->run();
|
||||
|
||||
SpectrumVisualProcessor *proc = wxGetApp().getSpectrumProcesor();
|
||||
@ -752,6 +764,24 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
|
||||
|
||||
dproc->run();
|
||||
|
||||
scopeCanvas->Refresh();
|
||||
|
||||
waterfallCanvas->Refresh();
|
||||
spectrumCanvas->Refresh();
|
||||
|
||||
demodWaterfallCanvas->Refresh();
|
||||
demodSpectrumCanvas->Refresh();
|
||||
|
||||
demodSignalMeter->Refresh();
|
||||
demodGainMeter->Refresh();
|
||||
|
||||
if (demodTuner->getMouseTracker()->mouseInView() || demodTuner->changed()) {
|
||||
demodTuner->Refresh();
|
||||
}
|
||||
if (demodModeSelector->getMouseTracker()->mouseInView()) {
|
||||
demodModeSelector->Refresh();
|
||||
}
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@
|
||||
#define wxID_AUDIO_BANDWIDTH_BASE 9000
|
||||
#define wxID_AUDIO_DEVICE_MULTIPLIER 50
|
||||
|
||||
|
||||
#define FRAME_TIMER_ID 1000
|
||||
|
||||
// Define a new frame type
|
||||
class AppFrame: public wxFrame {
|
||||
@ -69,6 +69,7 @@ private:
|
||||
void OnClose(wxCloseEvent& event);
|
||||
void OnNewWindow(wxCommandEvent& event);
|
||||
void OnIdle(wxIdleEvent& event);
|
||||
void OnTimer(wxTimerEvent& event);
|
||||
|
||||
|
||||
ScopeCanvas *scopeCanvas;
|
||||
@ -96,6 +97,7 @@ private:
|
||||
wxMenuItem *iqSwapMenuItem;
|
||||
|
||||
std::string currentSessionFile;
|
||||
wxTimer frame_timer;
|
||||
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
};
|
||||
|
BIN
src/CubicSDR.png
Normal file
BIN
src/CubicSDR.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 64 KiB |
91
src/panel/ScopePanel.cpp
Normal file
91
src/panel/ScopePanel.cpp
Normal file
@ -0,0 +1,91 @@
|
||||
#include "ScopePanel.h"
|
||||
#include "ColorTheme.h"
|
||||
|
||||
ScopePanel::ScopePanel() : GLPanel(), scopeMode(SCOPE_MODE_Y) {
|
||||
bgPanel.setFill(GLPanelFillType::GLPANEL_FILL_GRAD_BAR_Y);
|
||||
bgPanelStereo[0].setFill(GLPanelFillType::GLPANEL_FILL_GRAD_BAR_Y);
|
||||
bgPanelStereo[0].setPosition(0, 0.5);
|
||||
bgPanelStereo[0].setSize(1, 0.5);
|
||||
bgPanelStereo[1].setFill(GLPanelFillType::GLPANEL_FILL_GRAD_BAR_Y);
|
||||
bgPanelStereo[1].setPosition(0, -0.5);
|
||||
bgPanelStereo[1].setSize(1, 0.5);
|
||||
}
|
||||
|
||||
void ScopePanel::setMode(ScopeMode scopeMode) {
|
||||
this->scopeMode = scopeMode;
|
||||
}
|
||||
|
||||
|
||||
void ScopePanel::setPoints(std::vector<float> &points) {
|
||||
this->points.assign(points.begin(),points.end());
|
||||
}
|
||||
|
||||
void ScopePanel::drawPanelContents() {
|
||||
|
||||
glLineWidth(1.0);
|
||||
|
||||
if (scopeMode == SCOPE_MODE_Y) {
|
||||
bgPanel.setFillColor(ThemeMgr::mgr.currentTheme->scopeBackground, ThemeMgr::mgr.currentTheme->scopeBackground * 2.0);
|
||||
bgPanel.calcTransform(transform);
|
||||
bgPanel.draw();
|
||||
|
||||
glLoadMatrixf(transform);
|
||||
glColor3f(ThemeMgr::mgr.currentTheme->scopeLine.r * 0.35, ThemeMgr::mgr.currentTheme->scopeLine.g * 0.35,
|
||||
ThemeMgr::mgr.currentTheme->scopeLine.b * 0.35);
|
||||
glBegin (GL_LINES);
|
||||
glVertex2f(-1.0, 0.0);
|
||||
glVertex2f(1.0, 0.0);
|
||||
glEnd();
|
||||
} else if (scopeMode == SCOPE_MODE_2Y) {
|
||||
bgPanelStereo[0].setFillColor(ThemeMgr::mgr.currentTheme->scopeBackground, ThemeMgr::mgr.currentTheme->scopeBackground * 2.0);
|
||||
bgPanelStereo[1].setFillColor(ThemeMgr::mgr.currentTheme->scopeBackground, ThemeMgr::mgr.currentTheme->scopeBackground * 2.0);
|
||||
|
||||
bgPanelStereo[0].calcTransform(transform);
|
||||
bgPanelStereo[0].draw();
|
||||
bgPanelStereo[1].calcTransform(transform);
|
||||
bgPanelStereo[1].draw();
|
||||
|
||||
glLoadMatrixf(transform);
|
||||
glColor3f(ThemeMgr::mgr.currentTheme->scopeLine.r, ThemeMgr::mgr.currentTheme->scopeLine.g, ThemeMgr::mgr.currentTheme->scopeLine.b);
|
||||
glBegin (GL_LINES);
|
||||
glVertex2f(-1.0, 0.0);
|
||||
glVertex2f(1.0, 0.0);
|
||||
glColor3f(ThemeMgr::mgr.currentTheme->scopeLine.r * 0.35, ThemeMgr::mgr.currentTheme->scopeLine.g * 0.35,
|
||||
ThemeMgr::mgr.currentTheme->scopeLine.b * 0.35);
|
||||
glVertex2f(-1.0, 0.5);
|
||||
glVertex2f(1.0, 0.5);
|
||||
glVertex2f(-1.0, -0.5);
|
||||
glVertex2f(1.0, -0.5);
|
||||
glEnd();
|
||||
|
||||
} else if (scopeMode == SCOPE_MODE_XY) {
|
||||
// ...
|
||||
}
|
||||
|
||||
if (points.size()) {
|
||||
glEnable (GL_BLEND);
|
||||
glEnable (GL_LINE_SMOOTH);
|
||||
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glColor4f(ThemeMgr::mgr.currentTheme->scopeLine.r, ThemeMgr::mgr.currentTheme->scopeLine.g, ThemeMgr::mgr.currentTheme->scopeLine.b, 1.0);
|
||||
glEnableClientState (GL_VERTEX_ARRAY);
|
||||
glVertexPointer(2, GL_FLOAT, 0, &points[0]);
|
||||
glLineWidth(1.5);
|
||||
if (scopeMode == SCOPE_MODE_Y) {
|
||||
glLoadMatrixf(bgPanel.transform);
|
||||
glDrawArrays(GL_LINE_STRIP, 0, points.size() / 2);
|
||||
} else if (scopeMode == SCOPE_MODE_2Y) {
|
||||
glLoadMatrixf(bgPanelStereo[0].transform);
|
||||
glDrawArrays(GL_LINE_STRIP, 0, points.size() / 4);
|
||||
|
||||
glLoadMatrixf(bgPanelStereo[1].transform);
|
||||
glDrawArrays(GL_LINE_STRIP, points.size() / 4, points.size() / 4);
|
||||
} else if (scopeMode == SCOPE_MODE_XY) {
|
||||
// ...
|
||||
}
|
||||
glLineWidth(1.0);
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
}
|
||||
|
23
src/panel/ScopePanel.h
Normal file
23
src/panel/ScopePanel.h
Normal file
@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include "GLPanel.h"
|
||||
|
||||
class ScopePanel : public GLPanel {
|
||||
|
||||
public:
|
||||
typedef enum ScopeMode { SCOPE_MODE_Y, SCOPE_MODE_2Y, SCOPE_MODE_XY } ScopeMode;
|
||||
|
||||
ScopePanel();
|
||||
|
||||
void setMode(ScopeMode scopeMode);
|
||||
void setPoints(std::vector<float> &points);
|
||||
|
||||
protected:
|
||||
void drawPanelContents();
|
||||
|
||||
private:
|
||||
std::vector<float> points;
|
||||
ScopeMode scopeMode;
|
||||
GLPanel bgPanel;
|
||||
GLPanel bgPanelStereo[2];
|
||||
};
|
@ -1,61 +1,62 @@
|
||||
#include "SpectrumContext.h"
|
||||
#include "SpectrumPanel.h"
|
||||
|
||||
#include "SpectrumCanvas.h"
|
||||
#include "CubicSDR.h"
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include "ColorTheme.h"
|
||||
|
||||
SpectrumContext::SpectrumContext(SpectrumCanvas *canvas, wxGLContext *sharedContext) :
|
||||
PrimaryGLContext(canvas, sharedContext), floorValue(0), ceilValue(1) {
|
||||
glDisable(GL_CULL_FACE);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
|
||||
SpectrumPanel::SpectrumPanel() : floorValue(0), ceilValue(1) {
|
||||
setFill(GLPANEL_FILL_GRAD_Y);
|
||||
setFillColor(ThemeMgr::mgr.currentTheme->fftBackground * 2.0, ThemeMgr::mgr.currentTheme->fftBackground);
|
||||
}
|
||||
|
||||
|
||||
float SpectrumContext::getFloorValue() const {
|
||||
float SpectrumPanel::getFloorValue() const {
|
||||
return floorValue;
|
||||
}
|
||||
|
||||
void SpectrumContext::setFloorValue(float floorValue) {
|
||||
void SpectrumPanel::setFloorValue(float floorValue) {
|
||||
this->floorValue = floorValue;
|
||||
}
|
||||
|
||||
float SpectrumContext::getCeilValue() const {
|
||||
float SpectrumPanel::getCeilValue() const {
|
||||
return ceilValue;
|
||||
}
|
||||
|
||||
void SpectrumContext::setCeilValue(float ceilValue) {
|
||||
void SpectrumPanel::setCeilValue(float ceilValue) {
|
||||
this->ceilValue = ceilValue;
|
||||
}
|
||||
|
||||
void SpectrumContext::Draw(std::vector<float> &points, long long freq, int bandwidth) {
|
||||
void SpectrumPanel::setFreq(long long freq) {
|
||||
this->freq = freq;
|
||||
}
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
glColor3f(ThemeMgr::mgr.currentTheme->fftBackground.r, ThemeMgr::mgr.currentTheme->fftBackground.g, ThemeMgr::mgr.currentTheme->fftBackground.b);
|
||||
glVertex2f(1, 0.5);
|
||||
glVertex2f(-1, 0.5);
|
||||
glColor3f(ThemeMgr::mgr.currentTheme->fftBackground.r*2.0, ThemeMgr::mgr.currentTheme->fftBackground.g*2.0, ThemeMgr::mgr.currentTheme->fftBackground.b*2.0);
|
||||
glVertex2f(-1, -1);
|
||||
glVertex2f(1, -1);
|
||||
glEnd();
|
||||
long long SpectrumPanel::getFreq() {
|
||||
return freq;
|
||||
}
|
||||
|
||||
void SpectrumPanel::setBandwidth(long long bandwidth) {
|
||||
this->bandwidth = bandwidth;
|
||||
}
|
||||
|
||||
long long SpectrumPanel::getBandwidth() {
|
||||
return bandwidth;
|
||||
}
|
||||
|
||||
void SpectrumPanel::setPoints(std::vector<float> &points) {
|
||||
this->points.assign(points.begin(), points.end());
|
||||
}
|
||||
|
||||
|
||||
void SpectrumPanel::drawPanelContents() {
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
glEnable(GL_LINE_SMOOTH);
|
||||
glHint( GL_LINE_SMOOTH_HINT, GL_NICEST );
|
||||
|
||||
glLoadMatrixf(transform * (CubicVR::mat4::translate(-1.0f, -0.75f, 0.0f) * CubicVR::mat4::scale(2.0f, 1.5f, 1.0f)));
|
||||
|
||||
if (points.size()) {
|
||||
glPushMatrix();
|
||||
glTranslatef(-1.0f, -0.75f, 0.0f);
|
||||
glScalef(2.0f, 1.5f, 1.0f);
|
||||
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
float range = ceilValue-floorValue;
|
||||
float ranges[3][4] = { { 90.0, 5000.0, 10.0, 100.0 }, { 20.0, 150.0, 10.0, 10.0 }, { -20.0, 30.0, 10.0, 1.0 } };
|
||||
@ -93,9 +94,10 @@ void SpectrumContext::Draw(std::vector<float> &points, long long freq, int bandw
|
||||
glVertexPointer(2, GL_FLOAT, 0, &points[0]);
|
||||
glDrawArrays(GL_LINE_STRIP, 0, points.size() / 2);
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
glLoadMatrixf(transform);
|
||||
|
||||
GLint vp[4];
|
||||
glGetIntegerv( GL_VIEWPORT, vp);
|
||||
|
||||
@ -124,7 +126,7 @@ void SpectrumContext::Draw(std::vector<float> &points, long long freq, int bandw
|
||||
float hPos = 1.0 - (16.0 / viewHeight);
|
||||
float lMhzPos = 1.0 - (5.0 / viewHeight);
|
||||
|
||||
for (float m = -1.0 + mhzStart, mMax = 1.0 + fabs(mhzStart); m <= mMax; m += mhzStep) {
|
||||
for (float m = -1.0 + mhzStart, mMax = 1.0 + ((mhzStart>0)?mhzStart:-mhzStart); m <= mMax; m += mhzStep) {
|
||||
label << std::fixed << currentMhz;
|
||||
|
||||
double fractpart, intpart;
|
||||
@ -155,7 +157,4 @@ void SpectrumContext::Draw(std::vector<float> &points, long long freq, int bandw
|
||||
}
|
||||
|
||||
glLineWidth(1.0);
|
||||
|
||||
// getFont(PrimaryGLContext::GLFONT_SIZE16).drawString("Welcome to CubicSDR -- This is a test string. 01234567890!@#$%^&*()_[]",0.0,0.0,16,GLFont::GLFONT_ALIGN_CENTER,GLFont::GLFONT_ALIGN_CENTER);
|
||||
CheckGLError();
|
||||
}
|
31
src/panel/SpectrumPanel.h
Normal file
31
src/panel/SpectrumPanel.h
Normal file
@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include "GLPanel.h"
|
||||
|
||||
class SpectrumPanel : public GLPanel {
|
||||
public:
|
||||
SpectrumPanel();
|
||||
|
||||
void setPoints(std::vector<float> &points);
|
||||
|
||||
float getFloorValue() const;
|
||||
void setFloorValue(float floorValue);
|
||||
|
||||
float getCeilValue() const;
|
||||
void setCeilValue(float ceilValue);
|
||||
|
||||
void setFreq(long long freq);
|
||||
long long getFreq();
|
||||
|
||||
void setBandwidth(long long bandwidth);
|
||||
long long getBandwidth();
|
||||
|
||||
protected:
|
||||
void drawPanelContents();
|
||||
|
||||
private:
|
||||
float floorValue, ceilValue;
|
||||
long long freq;
|
||||
long long bandwidth;
|
||||
std::vector<float> points;
|
||||
};
|
@ -1,18 +1,20 @@
|
||||
#include "WaterfallContext.h"
|
||||
#include "WaterfallCanvas.h"
|
||||
#include "CubicSDR.h"
|
||||
#include "WaterfallPanel.h"
|
||||
|
||||
WaterfallContext::WaterfallContext(WaterfallCanvas *canvas, wxGLContext *sharedContext) :
|
||||
PrimaryGLContext(canvas, sharedContext), fft_size(0), waterfall_lines(0), waterfall_slice(NULL), activeTheme(NULL) {
|
||||
WaterfallPanel::WaterfallPanel() : GLPanel(), fft_size(0), waterfall_lines(0), waterfall_slice(NULL), activeTheme(NULL) {
|
||||
setFillColor(RGB3f(0,0,0));
|
||||
for (int i = 0; i < 2; i++) {
|
||||
waterfall[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void WaterfallContext::Setup(int fft_size_in, int num_waterfall_lines_in) {
|
||||
void WaterfallPanel::setup(int fft_size_in, int num_waterfall_lines_in) {
|
||||
waterfall_lines = num_waterfall_lines_in;
|
||||
fft_size = fft_size_in;
|
||||
|
||||
if (points.size() != fft_size) {
|
||||
points.resize(fft_size);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (waterfall[i]) {
|
||||
glDeleteTextures(1, &waterfall[i]);
|
||||
@ -23,7 +25,7 @@ void WaterfallContext::Setup(int fft_size_in, int num_waterfall_lines_in) {
|
||||
}
|
||||
}
|
||||
|
||||
void WaterfallContext::refreshTheme() {
|
||||
void WaterfallPanel::refreshTheme() {
|
||||
glEnable (GL_TEXTURE_2D);
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
@ -36,13 +38,20 @@ void WaterfallContext::refreshTheme() {
|
||||
}
|
||||
}
|
||||
|
||||
void WaterfallContext::Draw(std::vector<float> &points) {
|
||||
void WaterfallPanel::setPoints(std::vector<float> &points) {
|
||||
int halfPts = points.size()/2;
|
||||
if (halfPts == fft_size) {
|
||||
for (int i = 0; i < fft_size; i++) {
|
||||
this->points[i] = points[i*2+1];
|
||||
}
|
||||
} else {
|
||||
this->points.assign(points.begin(), points.end());
|
||||
}
|
||||
}
|
||||
|
||||
void WaterfallPanel::step() {
|
||||
int half_fft_size = fft_size / 2;
|
||||
|
||||
glEnable (GL_TEXTURE_2D);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
|
||||
|
||||
if (!waterfall[0]) {
|
||||
glGenTextures(2, waterfall);
|
||||
|
||||
@ -72,15 +81,10 @@ void WaterfallContext::Draw(std::vector<float> &points) {
|
||||
delete[] waterfall_tex;
|
||||
}
|
||||
|
||||
if (activeTheme != ThemeMgr::mgr.currentTheme) {
|
||||
refreshTheme();
|
||||
activeTheme = ThemeMgr::mgr.currentTheme;
|
||||
}
|
||||
|
||||
if (points.size()) {
|
||||
for (int j = 0; j < 2; j++) {
|
||||
for (int i = 0, iMax = half_fft_size; i < iMax; i++) {
|
||||
float v = points[(j * half_fft_size + i) * 2 + 1];
|
||||
float v = points[j * half_fft_size + i];
|
||||
|
||||
float wv = v < 0 ? 0 : (v > 0.99 ? 0.99 : v);
|
||||
|
||||
@ -97,7 +101,24 @@ void WaterfallContext::Draw(std::vector<float> &points) {
|
||||
waterfall_ofs[j]--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WaterfallPanel::drawPanelContents() {
|
||||
if (!waterfall[0]) {
|
||||
return;
|
||||
}
|
||||
|
||||
int half_fft_size = fft_size / 2;
|
||||
|
||||
glLoadMatrixf(transform);
|
||||
|
||||
glEnable (GL_TEXTURE_2D);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
|
||||
|
||||
if (activeTheme != ThemeMgr::mgr.currentTheme) {
|
||||
refreshTheme();
|
||||
activeTheme = ThemeMgr::mgr.currentTheme;
|
||||
}
|
||||
glColor3f(1.0, 1.0, 1.0);
|
||||
|
||||
GLint vp[4];
|
26
src/panel/WaterfallPanel.h
Normal file
26
src/panel/WaterfallPanel.h
Normal file
@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include "GLPanel.h"
|
||||
|
||||
class WaterfallPanel : public GLPanel {
|
||||
public:
|
||||
WaterfallPanel();
|
||||
void setup(int fft_size_in, int num_waterfall_lines_in);
|
||||
void refreshTheme();
|
||||
void setPoints(std::vector<float> &points);
|
||||
void step();
|
||||
|
||||
protected:
|
||||
void drawPanelContents();
|
||||
|
||||
private:
|
||||
std::vector<float> points;
|
||||
|
||||
GLuint waterfall[2];
|
||||
int waterfall_ofs[2];
|
||||
int fft_size;
|
||||
int waterfall_lines;
|
||||
unsigned char *waterfall_slice;
|
||||
|
||||
ColorTheme *activeTheme;
|
||||
};
|
@ -24,11 +24,26 @@ void ScopeVisualProcessor::process() {
|
||||
renderData->waveform_points.resize(iMax * 2);
|
||||
}
|
||||
|
||||
float peak = 1.0f;
|
||||
|
||||
for (int i = 0; i < iMax; i++) {
|
||||
renderData->waveform_points[i * 2 + 1] = audioInputData->data[i] * 0.5f;
|
||||
renderData->waveform_points[i * 2] = ((double) i / (double) iMax);
|
||||
float p = fabs(audioInputData->data[i]);
|
||||
if (p > peak) {
|
||||
peak = p;
|
||||
}
|
||||
}
|
||||
|
||||
if (audioInputData->channels == 2) {
|
||||
for (int i = 0; i < iMax; i++) {
|
||||
renderData->waveform_points[i * 2] = (((double) (i % (iMax/2)) / (double) iMax) * 2.0 - 0.5) * 2.0;
|
||||
renderData->waveform_points[i * 2 + 1] = audioInputData->data[i] / peak;
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < iMax; i++) {
|
||||
renderData->waveform_points[i * 2] = (((double) i / (double) iMax) - 0.5) * 2.0;
|
||||
renderData->waveform_points[i * 2 + 1] = audioInputData->data[i] / peak;
|
||||
}
|
||||
}
|
||||
distribute(renderData);
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,8 @@ GLPanel::GLPanel() : fillType(GLPANEL_FILL_SOLID), contentsVisible(true), transf
|
||||
fill[1] = RGB3f(0.1,0.1,0.1);
|
||||
borderColor = RGB3f(0.8, 0.8, 0.8);
|
||||
setCoordinateSystem(GLPANEL_Y_UP);
|
||||
setMarginPx(0);
|
||||
setBorderPx(0);
|
||||
}
|
||||
|
||||
void GLPanel::genArrays() {
|
||||
@ -225,7 +227,7 @@ void GLPanel::drawPanelContents() {
|
||||
|
||||
void GLPanel::calcTransform(mat4 transform_in) {
|
||||
// compute local transform
|
||||
localTransform = mat4::translate(pos[0], pos[1], 0) * mat4::scale(size[0], size[1], 0);
|
||||
localTransform = mat4::translate(pos[0], pos[1], 0) * mat4::scale(size[0], size[1], 1);
|
||||
// compute global transform
|
||||
transform = transform_in * localTransform;
|
||||
|
||||
@ -250,10 +252,10 @@ void GLPanel::calcTransform(mat4 transform_in) {
|
||||
pdim = vec2((vmax.x - vmin.x) / 2.0 * view[0], (vmax.y - vmin.y) / 2.0 * view[1]);
|
||||
pvec = vec2(((vmax.x - vmin.x) / 2.0) / pdim.x, ((vmax.y - vmin.y) / 2.0) / pdim.y);
|
||||
|
||||
std::cout << umin << " :: " << ucenter << " :: " << pdim << " :: " << pvec << std::endl;
|
||||
// std::cout << umin << " :: " << ucenter << " :: " << pdim << " :: " << pvec << std::endl;
|
||||
|
||||
if (marginPx) {
|
||||
transform *= mat4::scale(1.0 - marginPx * 2.0 * pvec.x / size[0], 1.0 - marginPx * 2.0 * pvec.y / size[1], 0);
|
||||
transform *= mat4::scale(1.0 - marginPx * 2.0 * pvec.x / size[0], 1.0 - marginPx * 2.0 * pvec.y / size[1], 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,9 +36,6 @@ UITestCanvas::~UITestCanvas() {
|
||||
|
||||
void UITestCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
wxPaintDC dc(this);
|
||||
#ifdef __APPLE__ // force half-rate?
|
||||
glFinish();
|
||||
#endif
|
||||
const wxSize ClientSize = GetClientSize();
|
||||
|
||||
glContext->SetCurrent(*this);
|
||||
|
@ -36,6 +36,8 @@ void initGLExtensions() {
|
||||
|
||||
std::cout << std::endl << "Supported GL Extensions: " << std::endl << extensions << std::endl << std::endl;
|
||||
|
||||
const GLint interval = 1;
|
||||
|
||||
#ifdef _WIN32
|
||||
if (GLExtSupported("WGL_EXT_swap_control")) {
|
||||
std::cout << "Initializing WGL swap control extensions.." << std::endl;
|
||||
@ -48,8 +50,7 @@ void initGLExtensions() {
|
||||
|
||||
#ifdef __APPLE__
|
||||
// OSX is just ON / OFF
|
||||
const GLint gl_interval = 1;
|
||||
CGLSetParameter (CGLGetCurrentContext(), kCGLCPSwapInterval, &gl_interval);
|
||||
CGLSetParameter (CGLGetCurrentContext(), kCGLCPSwapInterval, &interval);
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
|
@ -35,6 +35,9 @@ public:
|
||||
b = other.b;
|
||||
return *this;
|
||||
}
|
||||
|
||||
RGB3f operator*(float v) { return RGB3f(r*v, g*v, b*v); }
|
||||
|
||||
};
|
||||
|
||||
class ColorTheme {
|
||||
|
@ -60,9 +60,6 @@ float MeterCanvas::getInputValue() {
|
||||
|
||||
void MeterCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
wxPaintDC dc(this);
|
||||
#ifdef __APPLE__ // force half-rate?
|
||||
glFinish();
|
||||
#endif
|
||||
const wxSize ClientSize = GetClientSize();
|
||||
|
||||
glContext->SetCurrent(*this);
|
||||
@ -82,7 +79,7 @@ void MeterCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
}
|
||||
|
||||
void MeterCanvas::OnIdle(wxIdleEvent &event) {
|
||||
Refresh(false);
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void MeterCanvas::OnMouseMoved(wxMouseEvent& event) {
|
||||
@ -115,6 +112,7 @@ void MeterCanvas::OnMouseReleased(wxMouseEvent& event) {
|
||||
void MeterCanvas::OnMouseLeftWindow(wxMouseEvent& event) {
|
||||
InteractiveCanvas::OnMouseLeftWindow(event);
|
||||
SetCursor(wxCURSOR_CROSS);
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void MeterCanvas::OnMouseEnterWindow(wxMouseEvent& event) {
|
||||
|
@ -47,9 +47,6 @@ int ModeSelectorCanvas::getHoveredSelection() {
|
||||
|
||||
void ModeSelectorCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
wxPaintDC dc(this);
|
||||
#ifdef __APPLE__ // force half-rate?
|
||||
glFinish();
|
||||
#endif
|
||||
const wxSize ClientSize = GetClientSize();
|
||||
|
||||
glContext->SetCurrent(*this);
|
||||
@ -75,7 +72,7 @@ void ModeSelectorCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
}
|
||||
|
||||
void ModeSelectorCanvas::OnIdle(wxIdleEvent &event) {
|
||||
Refresh(false);
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void ModeSelectorCanvas::OnMouseMoved(wxMouseEvent& event) {
|
||||
@ -109,6 +106,7 @@ void ModeSelectorCanvas::OnMouseReleased(wxMouseEvent& event) {
|
||||
void ModeSelectorCanvas::OnMouseLeftWindow(wxMouseEvent& event) {
|
||||
InteractiveCanvas::OnMouseLeftWindow(event);
|
||||
SetCursor (wxCURSOR_CROSS);
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void ModeSelectorCanvas::OnMouseEnterWindow(wxMouseEvent& event) {
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "AppFrame.h"
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
wxBEGIN_EVENT_TABLE(ScopeCanvas, wxGLCanvas) EVT_PAINT(ScopeCanvas::OnPaint)
|
||||
EVT_IDLE(ScopeCanvas::OnIdle)
|
||||
wxEND_EVENT_TABLE()
|
||||
@ -50,32 +51,21 @@ bool ScopeCanvas::getPPMMode() {
|
||||
|
||||
void ScopeCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
wxPaintDC dc(this);
|
||||
#ifdef __APPLE__ // force half-rate?
|
||||
glFinish();
|
||||
#endif
|
||||
const wxSize ClientSize = GetClientSize();
|
||||
|
||||
wxGetApp().getScopeProcessor()->run();
|
||||
if (!inputData.empty()) {
|
||||
ScopeRenderData *avData;
|
||||
inputData.pop(avData);
|
||||
|
||||
if (!avData) {
|
||||
return;
|
||||
}
|
||||
|
||||
int iMax = avData->waveform_points.size();
|
||||
|
||||
if (!iMax) {
|
||||
avData->decRefCount();
|
||||
return;
|
||||
}
|
||||
|
||||
waveform_points.assign(avData->waveform_points.begin(),avData->waveform_points.end());
|
||||
if (avData) {
|
||||
if (avData->waveform_points.size()) {
|
||||
scopePanel.setPoints(avData->waveform_points);
|
||||
setStereo(avData->channels == 2);
|
||||
}
|
||||
|
||||
avData->decRefCount();
|
||||
}
|
||||
}
|
||||
|
||||
glContext->SetCurrent(*this);
|
||||
initGLExtensions();
|
||||
@ -83,7 +73,10 @@ void ScopeCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
glViewport(0, 0, ClientSize.x, ClientSize.y);
|
||||
|
||||
glContext->DrawBegin();
|
||||
glContext->Plot(waveform_points, stereo, ppmMode);
|
||||
scopePanel.setMode(stereo?ScopePanel::SCOPE_MODE_2Y:ScopePanel::SCOPE_MODE_Y);
|
||||
scopePanel.calcTransform(CubicVR::mat4::identity());
|
||||
scopePanel.draw();
|
||||
glContext->DrawTunerTitles(ppmMode);
|
||||
if (!deviceName.empty()) {
|
||||
glContext->DrawDeviceName(deviceName);
|
||||
}
|
||||
@ -94,7 +87,7 @@ void ScopeCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
}
|
||||
|
||||
void ScopeCanvas::OnIdle(wxIdleEvent &event) {
|
||||
Refresh(false);
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
ScopeRenderDataQueue *ScopeCanvas::getInputQueue() {
|
||||
|
@ -8,12 +8,11 @@
|
||||
|
||||
#include "ScopeContext.h"
|
||||
#include "ScopeVisualProcessor.h"
|
||||
#include "ScopePanel.h"
|
||||
#include "fftw3.h"
|
||||
|
||||
class ScopeCanvas: public wxGLCanvas {
|
||||
public:
|
||||
std::vector<float> waveform_points;
|
||||
|
||||
ScopeCanvas(wxWindow *parent, int *attribList = NULL);
|
||||
~ScopeCanvas();
|
||||
|
||||
@ -29,6 +28,7 @@ private:
|
||||
void OnIdle(wxIdleEvent &event);
|
||||
|
||||
ScopeRenderDataQueue inputData;
|
||||
ScopePanel scopePanel;
|
||||
ScopeContext *glContext;
|
||||
std::string deviceName;
|
||||
bool stereo;
|
||||
|
@ -23,56 +23,8 @@ void ScopeContext::DrawBegin() {
|
||||
glDisable (GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
void ScopeContext::Plot(std::vector<float> &points, bool stereo, bool ppmMode) {
|
||||
if (stereo) {
|
||||
glBegin(GL_QUADS);
|
||||
glColor3f(ThemeMgr::mgr.currentTheme->scopeBackground.r, ThemeMgr::mgr.currentTheme->scopeBackground.g, ThemeMgr::mgr.currentTheme->scopeBackground.b);
|
||||
glVertex2f(1, 1);
|
||||
glVertex2f(-1, 1);
|
||||
glColor3f(ThemeMgr::mgr.currentTheme->scopeBackground.r*2.0, ThemeMgr::mgr.currentTheme->scopeBackground.g*2.0, ThemeMgr::mgr.currentTheme->scopeBackground.b*2.0);
|
||||
glVertex2f(-1, 0.5);
|
||||
glVertex2f(1, 0.5);
|
||||
|
||||
glVertex2f(-1, 0.5);
|
||||
glVertex2f(1, 0.5);
|
||||
glColor3f(ThemeMgr::mgr.currentTheme->scopeBackground.r, ThemeMgr::mgr.currentTheme->scopeBackground.g, ThemeMgr::mgr.currentTheme->scopeBackground.b);
|
||||
glVertex2f(1, 0.0);
|
||||
glVertex2f(-1, 0.0);
|
||||
|
||||
glColor3f(ThemeMgr::mgr.currentTheme->scopeBackground.r, ThemeMgr::mgr.currentTheme->scopeBackground.g, ThemeMgr::mgr.currentTheme->scopeBackground.b);
|
||||
glVertex2f(1, 0);
|
||||
glVertex2f(-1, 0);
|
||||
glColor3f(ThemeMgr::mgr.currentTheme->scopeBackground.r*2.0, ThemeMgr::mgr.currentTheme->scopeBackground.g*2.0, ThemeMgr::mgr.currentTheme->scopeBackground.b*2.0);
|
||||
glVertex2f(-1, -0.5);
|
||||
glVertex2f(1, -0.5);
|
||||
|
||||
glVertex2f(-1, -0.5);
|
||||
glVertex2f(1, -0.5);
|
||||
glColor3f(ThemeMgr::mgr.currentTheme->scopeBackground.r, ThemeMgr::mgr.currentTheme->scopeBackground.g, ThemeMgr::mgr.currentTheme->scopeBackground.b);
|
||||
glVertex2f(1, -1.0);
|
||||
glVertex2f(-1, -1.0);
|
||||
glEnd();
|
||||
} else {
|
||||
glBegin (GL_QUADS);
|
||||
glColor3f(ThemeMgr::mgr.currentTheme->scopeBackground.r, ThemeMgr::mgr.currentTheme->scopeBackground.g,
|
||||
ThemeMgr::mgr.currentTheme->scopeBackground.b);
|
||||
glVertex2f(1, 1);
|
||||
glVertex2f(-1, 1);
|
||||
glColor3f(ThemeMgr::mgr.currentTheme->scopeBackground.r * 2.0, ThemeMgr::mgr.currentTheme->scopeBackground.g * 2.0,
|
||||
ThemeMgr::mgr.currentTheme->scopeBackground.b * 2.0);
|
||||
glVertex2f(-1, 0);
|
||||
glVertex2f(1, 0);
|
||||
|
||||
glVertex2f(-1, 0);
|
||||
glVertex2f(1, 0);
|
||||
glColor3f(ThemeMgr::mgr.currentTheme->scopeBackground.r, ThemeMgr::mgr.currentTheme->scopeBackground.g,
|
||||
ThemeMgr::mgr.currentTheme->scopeBackground.b);
|
||||
glVertex2f(1, -1);
|
||||
glVertex2f(-1, -1);
|
||||
glEnd();
|
||||
}
|
||||
glLineWidth(1.0);
|
||||
|
||||
void ScopeContext::DrawTunerTitles(bool ppmMode) {
|
||||
glLoadIdentity();
|
||||
|
||||
GLint vp[4];
|
||||
glGetIntegerv(GL_VIEWPORT, vp);
|
||||
@ -84,64 +36,6 @@ void ScopeContext::Plot(std::vector<float> &points, bool stereo, bool ppmMode) {
|
||||
GLFont::getFont(GLFont::GLFONT_SIZE12).drawString(ppmMode?"Device PPM":"Frequency", -0.66, -1.0+hPos, 12, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER);
|
||||
GLFont::getFont(GLFont::GLFONT_SIZE12).drawString("Bandwidth", 0.0, -1.0+hPos, 12, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER);
|
||||
GLFont::getFont(GLFont::GLFONT_SIZE12).drawString("Center Frequency", 0.66, -1.0+hPos, 12, GLFont::GLFONT_ALIGN_CENTER, GLFont::GLFONT_ALIGN_CENTER);
|
||||
|
||||
|
||||
if (stereo) {
|
||||
glColor3f(ThemeMgr::mgr.currentTheme->scopeLine.r, ThemeMgr::mgr.currentTheme->scopeLine.g, ThemeMgr::mgr.currentTheme->scopeLine.b);
|
||||
glBegin (GL_LINES);
|
||||
glVertex2f(-1.0, 0.0);
|
||||
glVertex2f(1.0, 0.0);
|
||||
glColor3f(ThemeMgr::mgr.currentTheme->scopeLine.r * 0.35, ThemeMgr::mgr.currentTheme->scopeLine.g * 0.35,
|
||||
ThemeMgr::mgr.currentTheme->scopeLine.b * 0.35);
|
||||
glVertex2f(-1.0, 0.5);
|
||||
glVertex2f(1.0, 0.5);
|
||||
glVertex2f(-1.0, -0.5);
|
||||
glVertex2f(1.0, -0.5);
|
||||
glEnd();
|
||||
} else {
|
||||
glColor3f(ThemeMgr::mgr.currentTheme->scopeLine.r * 0.35, ThemeMgr::mgr.currentTheme->scopeLine.g * 0.35,
|
||||
ThemeMgr::mgr.currentTheme->scopeLine.b * 0.35);
|
||||
glBegin (GL_LINES);
|
||||
glVertex2f(-1.0, 0.0);
|
||||
glVertex2f(1.0, 0.0);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
if (points.size()) {
|
||||
glEnable (GL_BLEND);
|
||||
glEnable (GL_LINE_SMOOTH);
|
||||
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glColor4f(ThemeMgr::mgr.currentTheme->scopeLine.r, ThemeMgr::mgr.currentTheme->scopeLine.g, ThemeMgr::mgr.currentTheme->scopeLine.b, 1.0);
|
||||
glEnableClientState (GL_VERTEX_ARRAY);
|
||||
glVertexPointer(2, GL_FLOAT, 0, &points[0]);
|
||||
if (stereo) {
|
||||
glLineWidth(1.5);
|
||||
glPushMatrix();
|
||||
glTranslatef(-1.0f, 0.5f, 0.0f);
|
||||
glScalef(4.0f, 0.92f, 1.0f);
|
||||
glDrawArrays(GL_LINE_STRIP, 0, points.size() / 4);
|
||||
glPopMatrix();
|
||||
|
||||
glPushMatrix();
|
||||
glTranslatef(-3.0f, -0.5f, 0.0f);
|
||||
glPushMatrix();
|
||||
glScalef(4.0f, 0.92f, 1.0f);
|
||||
glDrawArrays(GL_LINE_STRIP, points.size() / 4, points.size() / 4);
|
||||
glPopMatrix();
|
||||
glPopMatrix();
|
||||
} else {
|
||||
glLineWidth(1.5);
|
||||
glPushMatrix();
|
||||
glTranslatef(-1.0f, 0.0f, 0.0f);
|
||||
glScalef(2.0f, 2.0f, 1.0f);
|
||||
glDrawArrays(GL_LINE_STRIP, 0, points.size() / 2);
|
||||
glPopMatrix();
|
||||
}
|
||||
glLineWidth(1.0);
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
}
|
||||
|
||||
void ScopeContext::DrawDeviceName(std::string deviceName) {
|
||||
|
@ -12,7 +12,7 @@ public:
|
||||
ScopeContext(ScopeCanvas *canvas, wxGLContext *sharedContext);
|
||||
|
||||
void DrawBegin();
|
||||
void Plot(std::vector<float> &points, bool stereo=false, bool ppmMode=false);
|
||||
void DrawTunerTitles(bool ppmMode=false);
|
||||
void DrawDeviceName(std::string deviceName);
|
||||
void DrawDivider();
|
||||
void DrawEnd();
|
||||
|
@ -29,7 +29,7 @@ wxEND_EVENT_TABLE()
|
||||
SpectrumCanvas::SpectrumCanvas(wxWindow *parent, int *attribList) :
|
||||
InteractiveCanvas(parent, attribList), waterfallCanvas(NULL) {
|
||||
|
||||
glContext = new SpectrumContext(this, &wxGetApp().GetContext(this));
|
||||
glContext = new PrimaryGLContext(this, &wxGetApp().GetContext(this));
|
||||
|
||||
mouseTracker.setVertDragLock(true);
|
||||
|
||||
@ -42,34 +42,34 @@ SpectrumCanvas::~SpectrumCanvas() {
|
||||
|
||||
void SpectrumCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
wxPaintDC dc(this);
|
||||
#ifdef __APPLE__ // force half-rate?
|
||||
glFinish();
|
||||
#endif
|
||||
const wxSize ClientSize = GetClientSize();
|
||||
|
||||
if (visualDataQueue.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!visualDataQueue.empty()) {
|
||||
SpectrumVisualData *vData;
|
||||
|
||||
visualDataQueue.pop(vData);
|
||||
|
||||
if (!vData) {
|
||||
return;
|
||||
if (vData) {
|
||||
spectrumPanel.setPoints(vData->spectrum_points);
|
||||
spectrumPanel.setFloorValue(vData->fft_floor);
|
||||
spectrumPanel.setCeilValue(vData->fft_ceiling);
|
||||
vData->decRefCount();
|
||||
}
|
||||
}
|
||||
|
||||
spectrum_points.assign(vData->spectrum_points.begin(),vData->spectrum_points.end());
|
||||
|
||||
vData->decRefCount();
|
||||
|
||||
glContext->SetCurrent(*this);
|
||||
initGLExtensions();
|
||||
|
||||
glViewport(0, 0, ClientSize.x, ClientSize.y);
|
||||
|
||||
glContext->BeginDraw(ThemeMgr::mgr.currentTheme->fftBackground.r, ThemeMgr::mgr.currentTheme->fftBackground.g, ThemeMgr::mgr.currentTheme->fftBackground.b);
|
||||
glContext->Draw(spectrum_points, getCenterFrequency(), getBandwidth());
|
||||
glContext->BeginDraw(0,0,0);
|
||||
|
||||
spectrumPanel.setFreq(getCenterFrequency());
|
||||
spectrumPanel.setBandwidth(getBandwidth());
|
||||
|
||||
spectrumPanel.calcTransform(CubicVR::mat4::identity());
|
||||
spectrumPanel.draw();
|
||||
|
||||
std::vector<DemodulatorInstance *> &demods = wxGetApp().getDemodMgr().getDemodulators();
|
||||
|
||||
@ -84,7 +84,7 @@ void SpectrumCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
|
||||
|
||||
void SpectrumCanvas::OnIdle(wxIdleEvent &event) {
|
||||
Refresh(false);
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
@ -159,10 +159,6 @@ void SpectrumCanvas::attachWaterfallCanvas(WaterfallCanvas* canvas_in) {
|
||||
waterfallCanvas = canvas_in;
|
||||
}
|
||||
|
||||
SpectrumContext* SpectrumCanvas::getSpectrumContext() {
|
||||
return glContext;
|
||||
}
|
||||
|
||||
SpectrumVisualDataQueue *SpectrumCanvas::getVisualDataQueue() {
|
||||
return &visualDataQueue;
|
||||
}
|
@ -1,31 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include "wx/glcanvas.h"
|
||||
#include "wx/timer.h"
|
||||
|
||||
#include <vector>
|
||||
#include <queue>
|
||||
|
||||
#include "InteractiveCanvas.h"
|
||||
#include "SpectrumContext.h"
|
||||
|
||||
#include "fftw3.h"
|
||||
#include "PrimaryGLContext.h"
|
||||
#include "MouseTracker.h"
|
||||
#include "SpectrumVisualProcessor.h"
|
||||
#include "SpectrumPanel.h"
|
||||
|
||||
class WaterfallCanvas;
|
||||
|
||||
class SpectrumCanvas: public InteractiveCanvas {
|
||||
public:
|
||||
std::vector<float> spectrum_points;
|
||||
|
||||
SpectrumCanvas(wxWindow *parent, int *attribList = NULL);
|
||||
~SpectrumCanvas();
|
||||
|
||||
void attachWaterfallCanvas(WaterfallCanvas *canvas_in);
|
||||
void moveCenterFrequency(long long freqChange);
|
||||
|
||||
SpectrumContext* getSpectrumContext();
|
||||
SpectrumVisualDataQueue *getVisualDataQueue();
|
||||
|
||||
private:
|
||||
@ -39,8 +32,9 @@ private:
|
||||
void OnMouseReleased(wxMouseEvent& event);
|
||||
void OnMouseLeftWindow(wxMouseEvent& event);
|
||||
|
||||
SpectrumContext *glContext;
|
||||
PrimaryGLContext *glContext;
|
||||
WaterfallCanvas *waterfallCanvas;
|
||||
SpectrumPanel spectrumPanel;
|
||||
|
||||
SpectrumVisualDataQueue visualDataQueue;
|
||||
|
||||
|
@ -1,23 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "PrimaryGLContext.h"
|
||||
#include "Gradient.h"
|
||||
|
||||
#define NUM_WATERFALL_LINES 512
|
||||
|
||||
class SpectrumCanvas;
|
||||
|
||||
class SpectrumContext: public PrimaryGLContext {
|
||||
public:
|
||||
SpectrumContext(SpectrumCanvas *canvas, wxGLContext *sharedContext);
|
||||
|
||||
void Draw(std::vector<float> &points, long long freq, int bandwidth);
|
||||
|
||||
float getFloorValue() const;
|
||||
void setFloorValue(float floorValue);
|
||||
float getCeilValue() const;
|
||||
void setCeilValue(float ceilValue);
|
||||
|
||||
private:
|
||||
float floorValue, ceilValue;
|
||||
};
|
@ -31,7 +31,7 @@ EVT_KEY_UP(TuningCanvas::OnKeyUp)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
TuningCanvas::TuningCanvas(wxWindow *parent, int *attribList) :
|
||||
InteractiveCanvas(parent, attribList), dragAccum(0), uxDown(0), top(false), bottom(false) {
|
||||
InteractiveCanvas(parent, attribList), dragAccum(0), uxDown(0), top(false), bottom(false), freq(-1), bw(-1), center(-1) {
|
||||
|
||||
glContext = new TuningContext(this, &wxGetApp().GetContext(this));
|
||||
|
||||
@ -57,11 +57,25 @@ TuningCanvas::~TuningCanvas() {
|
||||
|
||||
}
|
||||
|
||||
bool TuningCanvas::changed() {
|
||||
DemodulatorInstance *activeDemod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
||||
|
||||
long long current_freq = 0;
|
||||
if (activeDemod != NULL) {
|
||||
freq = activeDemod->getFrequency();
|
||||
}
|
||||
long long current_bw = wxGetApp().getDemodMgr().getLastBandwidth();
|
||||
long long current_center = wxGetApp().getFrequency();
|
||||
|
||||
if (current_freq != freq || current_bw != bw || current_center != center) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void TuningCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
wxPaintDC dc(this);
|
||||
#ifdef __APPLE__ // force half-rate?
|
||||
glFinish();
|
||||
#endif
|
||||
const wxSize ClientSize = GetClientSize();
|
||||
|
||||
glContext->SetCurrent(*this);
|
||||
@ -72,12 +86,12 @@ void TuningCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
|
||||
DemodulatorInstance *activeDemod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
||||
|
||||
long long freq = 0;
|
||||
freq = 0;
|
||||
if (activeDemod != NULL) {
|
||||
freq = activeDemod->getFrequency();
|
||||
}
|
||||
long long bw = wxGetApp().getDemodMgr().getLastBandwidth();
|
||||
long long center = wxGetApp().getFrequency();
|
||||
bw = wxGetApp().getDemodMgr().getLastBandwidth();
|
||||
center = wxGetApp().getFrequency();
|
||||
|
||||
if (mouseTracker.mouseDown()) {
|
||||
glContext->Draw(ThemeMgr::mgr.currentTheme->tuningBarDark.r, ThemeMgr::mgr.currentTheme->tuningBarDark.g, ThemeMgr::mgr.currentTheme->tuningBarDark.b,
|
||||
@ -238,8 +252,6 @@ void TuningCanvas::OnIdle(wxIdleEvent &event) {
|
||||
dragging = false;
|
||||
}
|
||||
}
|
||||
|
||||
Refresh(false);
|
||||
}
|
||||
|
||||
void TuningCanvas::OnMouseMoved(wxMouseEvent& event) {
|
||||
@ -373,6 +385,7 @@ void TuningCanvas::OnMouseLeftWindow(wxMouseEvent& event) {
|
||||
if (currentPPM != lastPPM) {
|
||||
wxGetApp().saveConfig();
|
||||
}
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void TuningCanvas::OnMouseEnterWindow(wxMouseEvent& event) {
|
||||
|
@ -22,6 +22,7 @@ public:
|
||||
~TuningCanvas();
|
||||
|
||||
void setHelpTip(std::string tip);
|
||||
bool changed();
|
||||
|
||||
private:
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
@ -66,6 +67,7 @@ private:
|
||||
int currentPPM;
|
||||
int lastPPM;
|
||||
|
||||
long long freq, bw, center;
|
||||
//
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
};
|
||||
|
@ -35,10 +35,10 @@ EVT_MOUSEWHEEL(WaterfallCanvas::OnMouseWheelMoved)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
WaterfallCanvas::WaterfallCanvas(wxWindow *parent, int *attribList) :
|
||||
InteractiveCanvas(parent, attribList), dragState(WF_DRAG_NONE), nextDragState(WF_DRAG_NONE), fft_size(0), waterfall_lines(
|
||||
0), mouseZoom(1), zoom(1), hoverAlpha(1.0), dragOfs(0) {
|
||||
InteractiveCanvas(parent, attribList), dragState(WF_DRAG_NONE), nextDragState(WF_DRAG_NONE), fft_size(0), waterfall_lines(0),
|
||||
dragOfs(0), mouseZoom(1), zoom(1), hoverAlpha(1.0) {
|
||||
|
||||
glContext = new WaterfallContext(this, &wxGetApp().GetContext(this));
|
||||
glContext = new PrimaryGLContext(this, &wxGetApp().GetContext(this));
|
||||
|
||||
SetCursor(wxCURSOR_CROSS);
|
||||
}
|
||||
@ -53,7 +53,7 @@ void WaterfallCanvas::setup(int fft_size_in, int waterfall_lines_in) {
|
||||
fft_size = fft_size_in;
|
||||
waterfall_lines = waterfall_lines_in;
|
||||
|
||||
glContext->Setup(fft_size, waterfall_lines);
|
||||
waterfallPanel.setup(fft_size, waterfall_lines);
|
||||
}
|
||||
|
||||
WaterfallCanvas::DragState WaterfallCanvas::getDragState() {
|
||||
@ -70,9 +70,6 @@ void WaterfallCanvas::attachSpectrumCanvas(SpectrumCanvas *canvas_in) {
|
||||
|
||||
void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
wxPaintDC dc(this);
|
||||
#ifdef __APPLE__ // force half-rate?
|
||||
glFinish();
|
||||
#endif
|
||||
|
||||
const wxSize ClientSize = GetClientSize();
|
||||
long double currentZoom = zoom;
|
||||
@ -139,28 +136,26 @@ void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
||||
}
|
||||
}
|
||||
|
||||
if (visualDataQueue.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
SpectrumVisualData *vData;
|
||||
|
||||
visualDataQueue.pop(vData);
|
||||
|
||||
if (!vData) {
|
||||
return;
|
||||
}
|
||||
|
||||
spectrum_points.assign(vData->spectrum_points.begin(),vData->spectrum_points.end());
|
||||
|
||||
vData->decRefCount();
|
||||
|
||||
glContext->SetCurrent(*this);
|
||||
initGLExtensions();
|
||||
glViewport(0, 0, ClientSize.x, ClientSize.y);
|
||||
|
||||
if (!visualDataQueue.empty()) {
|
||||
SpectrumVisualData *vData;
|
||||
|
||||
visualDataQueue.pop(vData);
|
||||
|
||||
if (vData) {
|
||||
waterfallPanel.setPoints(vData->spectrum_points);
|
||||
waterfallPanel.step();
|
||||
vData->decRefCount();
|
||||
}
|
||||
}
|
||||
|
||||
glContext->BeginDraw(0,0,0);
|
||||
glContext->Draw(spectrum_points);
|
||||
|
||||
waterfallPanel.calcTransform(CubicVR::mat4::identity());
|
||||
waterfallPanel.draw();
|
||||
|
||||
std::vector<DemodulatorInstance *> &demods = wxGetApp().getDemodMgr().getDemodulators();
|
||||
|
||||
@ -352,7 +347,7 @@ void WaterfallCanvas::OnKeyDown(wxKeyEvent& event) {
|
||||
}
|
||||
}
|
||||
void WaterfallCanvas::OnIdle(wxIdleEvent &event) {
|
||||
Refresh(false);
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void WaterfallCanvas::OnMouseMoved(wxMouseEvent& event) {
|
||||
|
@ -7,9 +7,9 @@
|
||||
#include <queue>
|
||||
|
||||
#include "InteractiveCanvas.h"
|
||||
#include "WaterfallContext.h"
|
||||
#include "MouseTracker.h"
|
||||
#include "SpectrumCanvas.h"
|
||||
#include "WaterfallPanel.h"
|
||||
|
||||
|
||||
class WaterfallCanvas: public InteractiveCanvas {
|
||||
@ -47,8 +47,8 @@ private:
|
||||
std::vector<float> spectrum_points;
|
||||
|
||||
SpectrumCanvas *spectrumCanvas;
|
||||
|
||||
WaterfallContext *glContext;
|
||||
PrimaryGLContext *glContext;
|
||||
WaterfallPanel waterfallPanel;
|
||||
|
||||
DragState dragState;
|
||||
DragState nextDragState;
|
||||
|
@ -1,25 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "PrimaryGLContext.h"
|
||||
#include "Gradient.h"
|
||||
#include "ColorTheme.h"
|
||||
|
||||
class WaterfallCanvas;
|
||||
|
||||
class WaterfallContext: public PrimaryGLContext {
|
||||
public:
|
||||
WaterfallContext(WaterfallCanvas *canvas, wxGLContext *sharedContext);
|
||||
|
||||
void Draw(std::vector<float> &points);
|
||||
void Setup(int fft_size_in, int num_waterfall_lines_in);
|
||||
void refreshTheme();
|
||||
|
||||
private:
|
||||
GLuint waterfall[2];
|
||||
int waterfall_ofs[2];
|
||||
int fft_size;
|
||||
int waterfall_lines;
|
||||
unsigned char *waterfall_slice;
|
||||
|
||||
ColorTheme *activeTheme;
|
||||
};
|
Loading…
Reference in New Issue
Block a user