mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-29 23:28:39 -05:00
Tuner debug, spinner index working
This commit is contained in:
parent
de2b25e148
commit
d7784a393d
@ -110,6 +110,23 @@ void TuningCanvas::OnIdle(wxIdleEvent &event) {
|
|||||||
|
|
||||||
void TuningCanvas::OnMouseMoved(wxMouseEvent& event) {
|
void TuningCanvas::OnMouseMoved(wxMouseEvent& event) {
|
||||||
InteractiveCanvas::OnMouseMoved(event);
|
InteractiveCanvas::OnMouseMoved(event);
|
||||||
|
int index;
|
||||||
|
|
||||||
|
index = glContext->GetTunerDigitIndex(mouseTracker.getMouseX(),11,-1.0,(1.0/3.0)*2.0); // freq
|
||||||
|
if (index > 0) {
|
||||||
|
std::cout << "freq " << index << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
index = glContext->GetTunerDigitIndex(mouseTracker.getMouseX(),7,-1.0+(2.25/3.0),(1.0/4.0)*2.0); // bw
|
||||||
|
if (index > 0) {
|
||||||
|
std::cout << "bw " << index << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
index = glContext->GetTunerDigitIndex(mouseTracker.getMouseX(),11,-1.0+(2.0/3.0)*2.0,(1.0/3.0)*2.0); // center
|
||||||
|
if (index > 0) {
|
||||||
|
std::cout << "ctr " << index << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TuningCanvas::OnMouseDown(wxMouseEvent& event) {
|
void TuningCanvas::OnMouseDown(wxMouseEvent& event) {
|
||||||
|
@ -108,6 +108,21 @@ void TuningContext::DrawTuner(long long freq, int count, float displayPos, float
|
|||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int TuningContext::GetTunerDigitIndex(float mPos, int count, float displayPos, float displayWidth) {
|
||||||
|
mPos -= 0.5;
|
||||||
|
mPos *= 2.0;
|
||||||
|
|
||||||
|
float delta = mPos-displayPos;
|
||||||
|
|
||||||
|
if (delta < 0 || delta > displayWidth) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int index = floor((delta/displayWidth)*(count));
|
||||||
|
|
||||||
|
return count-index;
|
||||||
|
}
|
||||||
|
|
||||||
void TuningContext::DrawDemodFreqBw(long long freq, unsigned int bw, long long center) {
|
void TuningContext::DrawDemodFreqBw(long long freq, unsigned int bw, long long center) {
|
||||||
GLint vp[4];
|
GLint vp[4];
|
||||||
glGetIntegerv( GL_VIEWPORT, vp);
|
glGetIntegerv( GL_VIEWPORT, vp);
|
||||||
@ -115,9 +130,6 @@ void TuningContext::DrawDemodFreqBw(long long freq, unsigned int bw, long long c
|
|||||||
float viewHeight = (float) vp[3];
|
float viewHeight = (float) vp[3];
|
||||||
float viewWidth = (float) vp[2];
|
float viewWidth = (float) vp[2];
|
||||||
|
|
||||||
#define NUM_BINS 11
|
|
||||||
short num_bin[NUM_BINS] = { 0, 0, 1, 0, 5, 7, 0, 0, 0, 0, 0 };
|
|
||||||
|
|
||||||
DrawTuner(freq,11,-1.0,(1.0/3.0)*2.0);
|
DrawTuner(freq,11,-1.0,(1.0/3.0)*2.0);
|
||||||
DrawTuner(bw,7,-1.0+(2.25/3.0),(1.0/4.0)*2.0);
|
DrawTuner(bw,7,-1.0+(2.25/3.0),(1.0/4.0)*2.0);
|
||||||
DrawTuner(center,11,-1.0+(2.0/3.0)*2.0,(1.0/3.0)*2.0);
|
DrawTuner(center,11,-1.0+(2.0/3.0)*2.0,(1.0/3.0)*2.0);
|
||||||
|
@ -14,6 +14,8 @@ public:
|
|||||||
void DrawBegin();
|
void DrawBegin();
|
||||||
void Draw(float r, float g, float b, float a, float p1, float p2);
|
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 DrawTuner(long long freq, int count, float displayPos, float displayWidth);
|
||||||
|
int GetTunerDigitIndex(float mPos, int count, float displayPos, float displayWidth);
|
||||||
|
|
||||||
void DrawDemodFreqBw(long long freq, unsigned int bw, long long center);
|
void DrawDemodFreqBw(long long freq, unsigned int bw, long long center);
|
||||||
void DrawEnd();
|
void DrawEnd();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user