Demodulator options persist and apply to newly created

This commit is contained in:
Charles J. Cliffe
2015-02-02 20:10:55 -05:00
parent b4e4f3017f
commit 524cfbe0df
9 changed files with 167 additions and 32 deletions
+1 -1
View File
@@ -275,7 +275,7 @@ void PrimaryGLContext::DrawFreqSelector(float uxPos, float r, float g, float b,
long long bw = 0;
if (!demod) {
bw = defaultDemodParams.bandwidth;
bw = wxGetApp().getDemodMgr().getLastBandwidth();
} else {
bw = demod->getBandwidth();
}
+12 -5
View File
@@ -48,7 +48,7 @@ void TuningCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
if (activeDemod != NULL) {
glContext->DrawDemodFreqBw(activeDemod->getFrequency(), activeDemod->getBandwidth(), wxGetApp().getFrequency());
} else {
glContext->DrawDemodFreqBw(0, 0, wxGetApp().getFrequency());
glContext->DrawDemodFreqBw(0, wxGetApp().getDemodMgr().getLastBandwidth(), wxGetApp().getFrequency());
}
if (mouseTracker.mouseDown()) {
@@ -76,10 +76,17 @@ void TuningCanvas::OnIdle(wxIdleEvent &event) {
wxGetApp().getFrequency()
+ (int) (dragAccum * fabs(dragAccum * 10.0) * fabs(dragAccum * 10.0) * (float) wxGetApp().getSampleRate()));
} else if (fabs(moveVal) >= 1.0) {
if (uxDown < -0.275 && activeDemod != NULL) {
activeDemod->setFrequency(activeDemod->getFrequency() + (int) (moveVal * fabs(moveVal) * fabs(moveVal) * fabs(moveVal)));
} else if (activeDemod != NULL) {
activeDemod->setBandwidth(activeDemod->getBandwidth() + (int) (moveVal * fabs(moveVal) * fabs(moveVal) * fabs(moveVal)));
if (uxDown < -0.275) {
if (activeDemod != NULL) {
activeDemod->setFrequency(activeDemod->getFrequency() + (int) (moveVal * fabs(moveVal) * fabs(moveVal) * fabs(moveVal)));
}
} else {
int amt = (int) (moveVal * fabs(moveVal) * fabs(moveVal) * fabs(moveVal));
if (activeDemod != NULL) {
activeDemod->setBandwidth(activeDemod->getBandwidth() + amt);
} else {
wxGetApp().getDemodMgr().setLastBandwidth(wxGetApp().getDemodMgr().getLastBandwidth() + amt);
}
}
}
+1 -1
View File
@@ -82,7 +82,7 @@ void TuningContext::DrawDemodFreqBw(long long freq, unsigned int bw, long long c
glColor3f(ThemeMgr::mgr.currentTheme->text.r, ThemeMgr::mgr.currentTheme->text.g, ThemeMgr::mgr.currentTheme->text.b);
getFont(fontSize).drawString("Freq: ", -0.75, 0, fontHeight, GLFont::GLFONT_ALIGN_RIGHT, GLFont::GLFONT_ALIGN_CENTER);
if (bw) {
if (freq) {
freqStr.str("");
freqStr << std::fixed << freq << " Hz";
} else {
+14 -15
View File
@@ -753,6 +753,7 @@ void WaterfallCanvas::OnMouseReleased(wxMouseEvent& event) {
mouseTracker.setHorizDragLock(false);
DemodulatorInstance *demod;
DemodulatorMgr *mgr = &wxGetApp().getDemodMgr();
if (mouseTracker.getOriginDeltaMouseX() == 0 && mouseTracker.getOriginDeltaMouseY() == 0) {
float pos = mouseTracker.getMouseX();
@@ -767,14 +768,12 @@ void WaterfallCanvas::OnMouseReleased(wxMouseEvent& event) {
demod = wxGetApp().getDemodMgr().newThread();
demod->setFrequency(freq);
if (DemodulatorInstance *last = wxGetApp().getDemodMgr().getLastActiveDemodulator()) {
demod->setBandwidth(last->getBandwidth());
demod->setDemodulatorType(last->getDemodulatorType());
demod->setSquelchLevel(last->getSquelchLevel());
demod->setSquelchEnabled(last->isSquelchEnabled());
demod->setStereo(last->isStereo());
demod->setGain(last->getGain());
}
demod->setBandwidth(mgr->getLastBandwidth());
demod->setDemodulatorType(mgr->getLastDemodulatorType());
demod->setSquelchLevel(mgr->getLastSquelchLevel());
demod->setSquelchEnabled(mgr->isLastSquelchEnabled());
demod->setStereo(mgr->isLastStereo());
demod->setGain(mgr->getLastGain());
demod->run();
@@ -828,13 +827,13 @@ void WaterfallCanvas::OnMouseReleased(wxMouseEvent& event) {
demod = wxGetApp().getDemodMgr().newThread();
demod->setFrequency(freq);
demod->setBandwidth(bw);
if (DemodulatorInstance *last = wxGetApp().getDemodMgr().getLastActiveDemodulator()) {
demod->setDemodulatorType(last->getDemodulatorType());
demod->setSquelchLevel(last->getSquelchLevel());
demod->setSquelchEnabled(last->isSquelchEnabled());
demod->setStereo(last->isStereo());
demod->setGain(last->getGain());
}
demod->setDemodulatorType(mgr->getLastDemodulatorType());
demod->setSquelchLevel(mgr->getLastSquelchLevel());
demod->setSquelchEnabled(mgr->isLastSquelchEnabled());
demod->setStereo(mgr->isLastStereo());
demod->setGain(mgr->getLastGain());
demod->run();
wxGetApp().bindDemodulator(demod);