mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-26 13:48:38 -05:00
Can now spawn infinite(?) demodulators by holding shift
This commit is contained in:
parent
380145fdaa
commit
f2c59fedd1
@ -49,6 +49,10 @@ public:
|
|||||||
return demodMgr;
|
return demodMgr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void bindDemodulator(DemodulatorInstance *newDemod) {
|
||||||
|
sdrPostThread->bindDemodulator(newDemod);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PrimaryGLContext *m_glContext;
|
PrimaryGLContext *m_glContext;
|
||||||
|
|
||||||
|
@ -189,12 +189,17 @@ void PrimaryGLContext::DrawDemod(DemodulatorInstance *demod, float r, float g, f
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PrimaryGLContext::DrawFreqSelector(float uxPos, float r, float g, float b) {
|
void PrimaryGLContext::DrawFreqSelector(float uxPos, float r, float g, float b) {
|
||||||
DemodulatorInstance *demod = wxGetApp().getDemodTest();
|
DemodulatorInstance *demod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
||||||
|
|
||||||
|
int bw = 0;
|
||||||
|
|
||||||
if (!demod) {
|
if (!demod) {
|
||||||
return;
|
bw = 200000;
|
||||||
|
} else {
|
||||||
|
bw = demod->getParams().bandwidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
|
@ -117,11 +117,9 @@ void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void WaterfallCanvas::OnKeyUp(wxKeyEvent& event) {
|
void WaterfallCanvas::OnKeyUp(wxKeyEvent& event) {
|
||||||
switch (event.GetKeyCode()) {
|
|
||||||
case WXK_SHIFT:
|
// switch (event.GetKeyCode()) {
|
||||||
shiftDown = false;
|
// }
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaterfallCanvas::OnKeyDown(wxKeyEvent& event) {
|
void WaterfallCanvas::OnKeyDown(wxKeyEvent& event) {
|
||||||
@ -147,9 +145,6 @@ void WaterfallCanvas::OnKeyDown(wxKeyEvent& event) {
|
|||||||
break;
|
break;
|
||||||
case WXK_SPACE:
|
case WXK_SPACE:
|
||||||
break;
|
break;
|
||||||
case WXK_SHIFT:
|
|
||||||
shiftDown = true;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
event.Skip();
|
event.Skip();
|
||||||
return;
|
return;
|
||||||
@ -238,6 +233,8 @@ void WaterfallCanvas::OnIdle(wxIdleEvent &event) {
|
|||||||
void WaterfallCanvas::mouseMoved(wxMouseEvent& event) {
|
void WaterfallCanvas::mouseMoved(wxMouseEvent& event) {
|
||||||
mTracker.OnMouseMoved(event);
|
mTracker.OnMouseMoved(event);
|
||||||
|
|
||||||
|
shiftDown = event.ShiftDown();
|
||||||
|
|
||||||
DemodulatorInstance *demod = wxGetApp().getDemodMgr().getActiveDemodulator();
|
DemodulatorInstance *demod = wxGetApp().getDemodMgr().getActiveDemodulator();
|
||||||
|
|
||||||
if (mTracker.mouseDown()) {
|
if (mTracker.mouseDown()) {
|
||||||
@ -322,7 +319,7 @@ void WaterfallCanvas::mouseMoved(wxMouseEvent& event) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGetApp().getDemodMgr().setActiveDemodulator(activeDemodulator, false);
|
wxGetApp().getDemodMgr().setActiveDemodulator(activeDemodulator);
|
||||||
|
|
||||||
int freqDiff = ((int) activeDemodulator->getParams().frequency - freqPos);
|
int freqDiff = ((int) activeDemodulator->getParams().frequency - freqPos);
|
||||||
|
|
||||||
@ -373,29 +370,41 @@ void WaterfallCanvas::mouseWheelMoved(wxMouseEvent& event) {
|
|||||||
void WaterfallCanvas::mouseReleased(wxMouseEvent& event) {
|
void WaterfallCanvas::mouseReleased(wxMouseEvent& event) {
|
||||||
mTracker.OnMouseReleased(event);
|
mTracker.OnMouseReleased(event);
|
||||||
|
|
||||||
SetCursor(wxCURSOR_CROSS);
|
|
||||||
|
|
||||||
mTracker.setVertDragLock(true);
|
mTracker.setVertDragLock(true);
|
||||||
mTracker.setHorizDragLock(true);
|
mTracker.setHorizDragLock(true);
|
||||||
|
|
||||||
if (mTracker.getOriginDeltaMouseX() == 0 && mTracker.getOriginDeltaMouseY() == 0) {
|
if (mTracker.getOriginDeltaMouseX() == 0 && mTracker.getOriginDeltaMouseY() == 0) {
|
||||||
DemodulatorInstance *demod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
DemodulatorInstance *demod;
|
||||||
if (1) {
|
|
||||||
|
float pos = mTracker.getMouseX();
|
||||||
|
int center_freq = wxGetApp().getFrequency();
|
||||||
|
int freq = center_freq - (int) (0.5 * (float) SRATE) + (int) ((float) pos * (float) SRATE);
|
||||||
|
|
||||||
|
if (!shiftDown) {
|
||||||
|
demod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
||||||
|
} else {
|
||||||
|
demod = wxGetApp().getDemodMgr().newThread();
|
||||||
|
demod->getParams().frequency = freq;
|
||||||
|
|
||||||
|
if (DemodulatorInstance *last = wxGetApp().getDemodMgr().getLastActiveDemodulator()) {
|
||||||
|
demod->getParams().bandwidth = last->getParams().bandwidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
demod->run();
|
||||||
|
|
||||||
|
wxGetApp().bindDemodulator(demod);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dragState == WF_DRAG_NONE) {
|
||||||
|
|
||||||
if (demod == NULL) {
|
if (demod == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
float pos = mTracker.getMouseX();
|
|
||||||
|
|
||||||
int center_freq = wxGetApp().getFrequency();
|
|
||||||
|
|
||||||
int freq = center_freq - (int) (0.5 * (float) SRATE) + (int) ((float) pos * (float) SRATE);
|
|
||||||
|
|
||||||
DemodulatorThreadCommand command;
|
DemodulatorThreadCommand command;
|
||||||
command.cmd = DemodulatorThreadCommand::DEMOD_THREAD_CMD_SET_FREQUENCY;
|
command.cmd = DemodulatorThreadCommand::DEMOD_THREAD_CMD_SET_FREQUENCY;
|
||||||
command.int_value = freq;
|
command.int_value = freq;
|
||||||
|
|
||||||
demod->getCommandQueue()->push(command);
|
demod->getCommandQueue()->push(command);
|
||||||
|
|
||||||
((wxFrame*) parent)->GetStatusBar()->SetStatusText(
|
((wxFrame*) parent)->GetStatusBar()->SetStatusText(
|
||||||
|
Loading…
Reference in New Issue
Block a user