More AppFrame cleanup, active/current modem verbage adjustments

This commit is contained in:
Charles J. Cliffe 2019-02-11 22:59:43 -05:00
parent abaf458ea1
commit 9ed085123a
14 changed files with 390 additions and 307 deletions

View File

@ -2092,42 +2092,278 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
updateDeviceParams();
}
//Refresh the current TX antenna on, if any:
handleTXAntennaChange();
DemodulatorInstancePtr demod = wxGetApp().getDemodMgr().getCurrentModem();
if (demod && demod->isModemInitialized()) {
handleCurrentModem();
} else if (demod) {
// Wait state for current demodulator modem to activate..
} else {
handleModeSelector();
handleGainMeter();
handleDemodWaterfallSpectrum();
handleSpectrumWaterfall();
handleMuteButton();
}
handleScopeProcessor();
handleScopeSpectrumProcessors();
handleModemProperties();
handlePeakHold();
#if USE_HAMLIB
handleRigMenu();
#endif
#ifdef _WIN32
if (scopeCanvas && scopeCanvas->HasFocus()) {
waterfallCanvas->SetFocus();
}
#endif
if (!this->IsActive()) {
std::this_thread::sleep_for(std::chrono::milliseconds(30));
} else {
if (wxGetApp().getConfig()->getPerfMode() == AppConfig::PERF_LOW) {
std::this_thread::sleep_for(std::chrono::milliseconds(30));
} else {
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
}
event.RequestMore();
}
void AppFrame::handleTXAntennaChange() {//Refresh the current TX antenna on, if any:
if ((antennaMenuItems.find(wxID_ANTENNA_CURRENT_TX) != antennaMenuItems.end()) && devInfo) {
std::string actualTxAntenna = devInfo->getAntennaName(SOAPY_SDR_TX, 0);
string actualTxAntenna = devInfo->getAntennaName(SOAPY_SDR_TX, 0);
if (currentTXantennaName != actualTxAntenna) {
currentTXantennaName = actualTxAntenna;
antennaMenuItems[wxID_ANTENNA_CURRENT_TX]->SetItemLabel(getSettingsLabel("TX Antenna", currentTXantennaName));
}
}
DemodulatorInstancePtr demod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
}
if (demod && demod->isModemInitialized()) {
if (demod->isTracking()) {
#if USE_HAMLIB
void AppFrame::handleRigMenu() {
if (rigEnableMenuItem->IsChecked()) {
if (!wxGetApp().rigIsActive()) {
rigEnableMenuItem->Check(false);
wxGetApp().getConfig()->setRigEnabled(false);
}
}
}
#endif
void AppFrame::handlePeakHold() {
int peakHoldMode = peakHoldButton->getSelection();
if (peakHoldButton->modeChanged()) {
wxGetApp().getSpectrumProcessor()->setPeakHold(peakHoldMode == 1);
//make the peak hold act on the current dmod also, like a zoomed-in version.
if (wxGetApp().getDemodSpectrumProcessor()) {
wxGetApp().getDemodSpectrumProcessor()->setPeakHold(peakHoldMode == 1);
}
peakHoldButton->clearModeChanged();
}
}
void AppFrame::handleModemProperties() {
DemodulatorInstancePtr demod = wxGetApp().getDemodMgr().getCurrentModem();
if (modemPropertiesUpdated.load() && demod && demod->isModemInitialized()) {
//reset notification flag
modemPropertiesUpdated.store(false);
modemProps->initProperties(demod->getModemArgs(), demod);
modemProps->updateTheme();
demodTray->Layout();
modemProps->fitColumns();
#if ENABLE_DIGITAL_LAB
if (demod->getModemType() == "digital") {
ModemDigitalOutputConsole *outp = (ModemDigitalOutputConsole *)demod->getOutput();
if (!outp->getDialog()) {
outp->setTitle(demod->getDemodulatorType() + ": " + frequencyToStr(demod->getFrequency()));
outp->setDialog(new DigitalConsole(this, outp)) ;
}
demod->showOutput();
}
#endif
} else if (!demod && modemPropertiesUpdated.load()) {
ModemArgInfoList dummyInfo;
modemProps->initProperties(dummyInfo, nullptr);
modemProps->updateTheme();
demodTray->Layout();
}
if (modemProps->IsShown() && modemProps->isCollapsed() && modemProps->GetMinWidth() > 22) {
modemProps->SetMinSize(wxSize(APPFRAME_MODEMPROPS_MINSIZE, -1));
modemProps->SetMaxSize(wxSize(APPFRAME_MODEMPROPS_MINSIZE, -1));
demodTray->Layout();
modemProps->fitColumns();
} else if (modemProps->IsShown() && !modemProps->isCollapsed() && modemProps->GetMinWidth() < 200) {
modemProps->SetMinSize(wxSize(APPFRAME_MODEMPROPS_MAXSIZE, -1));
modemProps->SetMaxSize(wxSize(APPFRAME_MODEMPROPS_MAXSIZE, -1));
demodTray->Layout();
modemProps->fitColumns();
}
}
void AppFrame::handleScopeSpectrumProcessors() {
SpectrumVisualProcessor *proc = wxGetApp().getSpectrumProcessor();
if (spectrumAvgMeter->inputChanged()) {
float val = spectrumAvgMeter->getInputValue();
if (val < 0.01) {
val = 0.01f;
}
if (val > 0.99) {
val = 0.99f;
}
spectrumAvgMeter->setLevel(val);
proc->setFFTAverageRate(val);
GetStatusBar()->SetStatusText(wxString::Format(wxT("Spectrum averaging speed changed to %0.2f%%."), val * 100.0));
}
SpectrumVisualProcessor *dproc = wxGetApp().getDemodSpectrumProcessor();
if (dproc) {
dproc->setView(demodWaterfallCanvas->getViewState(), demodWaterfallCanvas->getCenterFrequency(),
demodWaterfallCanvas->getBandwidth());
}
SpectrumVisualProcessor *wproc = waterfallDataThread->getProcessor();
if (waterfallSpeedMeter->inputChanged()) {
float val = waterfallSpeedMeter->getInputValue();
waterfallSpeedMeter->setLevel(val);
waterfallDataThread->setLinesPerSecond((int)ceil(val * val));
waterfallCanvas->setLinesPerSecond((int)ceil(val * val));
GetStatusBar()->SetStatusText(
wxString::Format(wxT("Waterfall max speed changed to %d lines per second."), (int)ceil(val * val)));
}
wproc->setView(waterfallCanvas->getViewState(), waterfallCanvas->getCenterFrequency(), waterfallCanvas->getBandwidth());
proc->setView(wproc->isView(), wproc->getCenterFrequency(), wproc->getBandwidth());
}
void AppFrame::handleScopeProcessor() {
if (scopeCanvas) {
scopeCanvas->setPPMMode(demodTuner->isAltDown());
wxGetApp().getScopeProcessor()->setScopeEnabled(scopeCanvas->scopeVisible());
wxGetApp().getScopeProcessor()->setSpectrumEnabled(scopeCanvas->spectrumVisible());
wxGetApp().getAudioVisualQueue()->set_max_num_items((scopeCanvas->scopeVisible() ? 1 : 0) + (scopeCanvas->spectrumVisible() ? 1 : 0));
wxGetApp().getScopeProcessor()->run();
}
}
void AppFrame::handleMuteButton() {
if (demodMuteButton->modeChanged()) {
int muteMode = demodMuteButton->getSelection();
if (muteMode == -1) {
wxGetApp().getDemodMgr().setLastMuted(false);
} else if (muteMode == 1) {
wxGetApp().getDemodMgr().setLastMuted(true);
}
demodMuteButton->clearModeChanged();
}
}
void AppFrame::handleSpectrumWaterfall() {
if (spectrumCanvas->getViewState() && abs(wxGetApp().getFrequency() - spectrumCanvas->getCenterFrequency()) > (wxGetApp().getSampleRate() / 2)) {
spectrumCanvas->setCenterFrequency(wxGetApp().getFrequency());
waterfallCanvas->setCenterFrequency(wxGetApp().getFrequency());
}
}
void AppFrame::handleDemodWaterfallSpectrum() {
if (demodWaterfallCanvas && wxGetApp().getFrequency() != demodWaterfallCanvas->getCenterFrequency()) {
demodWaterfallCanvas->setCenterFrequency(wxGetApp().getFrequency());
if (demodSpectrumCanvas) {
demodSpectrumCanvas->setCenterFrequency(wxGetApp().getFrequency());
}
}
}
void AppFrame::handleGainMeter() {
DemodulatorMgr *mgr = &wxGetApp().getDemodMgr();
demodGainMeter->setLevel(mgr->getLastGain());
if (demodSignalMeter->inputChanged()) {
mgr->setLastSquelchLevel(demodSignalMeter->getInputValue());
}
if (demodGainMeter->inputChanged()) {
mgr->setLastGain(demodGainMeter->getInputValue());
demodGainMeter->setLevel(demodGainMeter->getInputValue());
}
}
void AppFrame::handleModeSelector() {
DemodulatorMgr *mgr = &wxGetApp().getDemodMgr();
string dSelection = demodModeSelector->getSelectionLabel();
#ifdef ENABLE_DIGITAL_LAB
string dSelectionadv = demodModeSelectorAdv->getSelectionLabel();
// basic demodulators
if (dSelection != "" && dSelection != mgr->getLastDemodulatorType()) {
mgr->setLastDemodulatorType(dSelection);
mgr->setLastBandwidth(Modem::getModemDefaultSampleRate(dSelection));
demodTuner->setHalfBand(dSelection == "USB" || dSelection == "LSB");
demodModeSelectorAdv->setSelection(-1);
}
// advanced demodulators
else if(dSelectionadv != "" && dSelectionadv != mgr->getLastDemodulatorType()) {
mgr->setLastDemodulatorType(dSelectionadv);
mgr->setLastBandwidth(Modem::getModemDefaultSampleRate(dSelectionadv));
demodTuner->setHalfBand(false);
demodModeSelector->setSelection(-1);
}
#else
// basic demodulators
if (dSelection != "" && dSelection != mgr->getLastDemodulatorType()) {
mgr->setLastDemodulatorType(dSelection);
mgr->setLastBandwidth(Modem::getModemDefaultSampleRate(dSelection));
demodTuner->setHalfBand(dSelection=="USB" || dSelection=="LSB");
}
#endif
}
void AppFrame::handleCurrentModem() {
DemodulatorInstancePtr demod = wxGetApp().getDemodMgr().getCurrentModem();
if (demod->isTracking()) {
if (spectrumCanvas->getViewState()) {
long long diff = abs(demod->getFrequency() - spectrumCanvas->getCenterFrequency()) + (demod->getBandwidth()/2) + (demod->getBandwidth()/4);
long long diff = abs(demod->getFrequency() - spectrumCanvas->getCenterFrequency()) + (demod->getBandwidth() / 2) + (demod->getBandwidth() / 4);
if (diff > spectrumCanvas->getBandwidth()/2) {
if (demod->getBandwidth() > (int)spectrumCanvas->getBandwidth()) {
if (diff > spectrumCanvas->getBandwidth() / 2) {
if (demod->getBandwidth() > (int) spectrumCanvas->getBandwidth()) {
diff = abs(demod->getFrequency() - spectrumCanvas->getCenterFrequency());
} else {
diff = diff - spectrumCanvas->getBandwidth()/2;
diff = diff - spectrumCanvas->getBandwidth() / 2;
}
spectrumCanvas->moveCenterFrequency((demod->getFrequency() < spectrumCanvas->getCenterFrequency())?diff:-diff);
spectrumCanvas->moveCenterFrequency((demod->getFrequency() < spectrumCanvas->getCenterFrequency()) ? diff : -diff);
demod->setTracking(false);
}
} else {
demod->setTracking(false);
}
}
if (demod->getBandwidth() != wxGetApp().getDemodMgr().getLastBandwidth()) {
if (demod->getBandwidth() != wxGetApp().getDemodMgr().getLastBandwidth()) {
wxGetApp().getDemodMgr().setLastBandwidth(demod->getBandwidth());
}
if (demod.get() != activeDemodulator) {
if (demod.get() != activeDemodulator) {
demodSignalMeter->setInputValue(demod->getSquelchLevel());
demodGainMeter->setInputValue(demod->getGain());
wxGetApp().getDemodMgr().setLastGain(demod->getGain());
@ -2137,17 +2373,17 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
scopeCanvas->setDeviceName(outputDevices[outputDevice].name);
}
// outputDeviceMenuItems[outputDevice]->Check(true);
std::string dType = demod->getDemodulatorType();
string dType = demod->getDemodulatorType();
demodModeSelector->setSelection(dType);
#ifdef ENABLE_DIGITAL_LAB
demodModeSelectorAdv->setSelection(dType);
#endif
deltaLockButton->setSelection(demod->isDeltaLock()?1:-1);
demodMuteButton->setSelection(demod->isMuted()?1:-1);
deltaLockButton->setSelection(demod->isDeltaLock() ? 1 : -1);
demodMuteButton->setSelection(demod->isMuted() ? 1 : -1);
modemPropertiesUpdated.store(true);
demodTuner->setHalfBand(dType=="USB" || dType=="LSB");
demodTuner->setHalfBand(dType == "USB" || dType == "LSB");
}
if (!demodWaterfallCanvas || demodWaterfallCanvas->getDragState() == WaterfallCanvas::WF_DRAG_NONE) {
if (!demodWaterfallCanvas || demodWaterfallCanvas->getDragState() == WaterfallCanvas::WF_DRAG_NONE) {
long long centerFreq = demod->getFrequency();
unsigned int demodBw = (unsigned int) ceil((float) demod->getBandwidth() * 2.25);
@ -2172,14 +2408,15 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
demodWaterfallCanvas->setCenterFrequency(centerFreq);
demodSpectrumCanvas->setCenterFrequency(centerFreq);
}
std::string dSelection = demodModeSelector->getSelectionLabel();
string dSelection = demodModeSelector->getSelectionLabel();
#ifdef ENABLE_DIGITAL_LAB
std::string dSelectionadv = demodModeSelectorAdv->getSelectionLabel();
string dSelectionadv = demodModeSelectorAdv->getSelectionLabel();
// basic demodulators
if (dSelection != "" && dSelection != demod->getDemodulatorType()) {
demod->setDemodulatorType(dSelection);
demodTuner->setHalfBand(dSelection=="USB" || dSelection=="LSB");
demodTuner->setHalfBand(dSelection == "USB" || dSelection == "LSB");
demodModeSelectorAdv->setSelection(-1);
}
// advanced demodulators
@ -2249,216 +2486,30 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
soloModeButton->clearModeChanged();
} else {
if (wxGetApp().getSoloMode() != (soloMode==1)) {
soloModeButton->setSelection(wxGetApp().getSoloMode()?1:-1);
soloModeButton->setSelection(wxGetApp().getSoloMode() ? 1 : -1);
soloModeButton->Refresh();
}
}
if (demodWaterfallCanvas) {
demodWaterfallCanvas->setBandwidth(demodBw);
demodSpectrumCanvas->setBandwidth(demodBw);
}
}
demodSignalMeter->setLevel(demod->getSignalLevel());
demodSignalMeter->setMin(demod->getSignalFloor());
demodSignalMeter->setMax(demod->getSignalCeil());
demodGainMeter->setLevel(demod->getGain());
if (demodSignalMeter->inputChanged()) {
demodSignalMeter->setLevel(demod->getSignalLevel());
demodSignalMeter->setMin(demod->getSignalFloor());
demodSignalMeter->setMax(demod->getSignalCeil());
demodGainMeter->setLevel(demod->getGain());
if (demodSignalMeter->inputChanged()) {
demod->setSquelchLevel(demodSignalMeter->getInputValue());
}
if (demodGainMeter->inputChanged()) {
if (demodGainMeter->inputChanged()) {
demod->setGain(demodGainMeter->getInputValue());
demodGainMeter->setLevel(demodGainMeter->getInputValue());
}
activeDemodulator = demod.get();
} else if (demod) {
// Wait state for current demodulator modem to activate..
} else {
DemodulatorMgr *mgr = &wxGetApp().getDemodMgr();
std::string dSelection = demodModeSelector->getSelectionLabel();
#ifdef ENABLE_DIGITAL_LAB
std::string dSelectionadv = demodModeSelectorAdv->getSelectionLabel();
// basic demodulators
if (dSelection != "" && dSelection != mgr->getLastDemodulatorType()) {
mgr->setLastDemodulatorType(dSelection);
mgr->setLastBandwidth(Modem::getModemDefaultSampleRate(dSelection));
demodTuner->setHalfBand(dSelection=="USB" || dSelection=="LSB");
demodModeSelectorAdv->setSelection(-1);
}
// advanced demodulators
else if(dSelectionadv != "" && dSelectionadv != mgr->getLastDemodulatorType()) {
mgr->setLastDemodulatorType(dSelectionadv);
mgr->setLastBandwidth(Modem::getModemDefaultSampleRate(dSelectionadv));
demodTuner->setHalfBand(false);
demodModeSelector->setSelection(-1);
}
#else
// basic demodulators
if (dSelection != "" && dSelection != mgr->getLastDemodulatorType()) {
mgr->setLastDemodulatorType(dSelection);
mgr->setLastBandwidth(Modem::getModemDefaultSampleRate(dSelection));
demodTuner->setHalfBand(dSelection=="USB" || dSelection=="LSB");
}
#endif
demodGainMeter->setLevel(mgr->getLastGain());
if (demodSignalMeter->inputChanged()) {
mgr->setLastSquelchLevel(demodSignalMeter->getInputValue());
}
if (demodGainMeter->inputChanged()) {
mgr->setLastGain(demodGainMeter->getInputValue());
demodGainMeter->setLevel(demodGainMeter->getInputValue());
}
if (demodWaterfallCanvas && wxGetApp().getFrequency() != demodWaterfallCanvas->getCenterFrequency()) {
demodWaterfallCanvas->setCenterFrequency(wxGetApp().getFrequency());
if (demodSpectrumCanvas) {
demodSpectrumCanvas->setCenterFrequency(wxGetApp().getFrequency());
}
}
if (spectrumCanvas->getViewState() && abs(wxGetApp().getFrequency()-spectrumCanvas->getCenterFrequency()) > (wxGetApp().getSampleRate()/2)) {
spectrumCanvas->setCenterFrequency(wxGetApp().getFrequency());
waterfallCanvas->setCenterFrequency(wxGetApp().getFrequency());
}
if (demodMuteButton->modeChanged()) {
int muteMode = demodMuteButton->getSelection();
if (muteMode == -1) {
wxGetApp().getDemodMgr().setLastMuted(false);
} else if (muteMode == 1) {
wxGetApp().getDemodMgr().setLastMuted(true);
}
demodMuteButton->clearModeChanged();
}
}
if (scopeCanvas) {
scopeCanvas->setPPMMode(demodTuner->isAltDown());
wxGetApp().getScopeProcessor()->setScopeEnabled(scopeCanvas->scopeVisible());
wxGetApp().getScopeProcessor()->setSpectrumEnabled(scopeCanvas->spectrumVisible());
wxGetApp().getAudioVisualQueue()->set_max_num_items((scopeCanvas->scopeVisible()?1:0) + (scopeCanvas->spectrumVisible()?1:0));
wxGetApp().getScopeProcessor()->run();
}
SpectrumVisualProcessor *proc = wxGetApp().getSpectrumProcessor();
if (spectrumAvgMeter->inputChanged()) {
float val = spectrumAvgMeter->getInputValue();
if (val < 0.01) {
val = 0.01f;
}
if (val > 0.99) {
val = 0.99f;
}
spectrumAvgMeter->setLevel(val);
proc->setFFTAverageRate(val);
GetStatusBar()->SetStatusText(wxString::Format(wxT("Spectrum averaging speed changed to %0.2f%%."),val*100.0));
}
SpectrumVisualProcessor *dproc = wxGetApp().getDemodSpectrumProcessor();
if (dproc) {
dproc->setView(demodWaterfallCanvas->getViewState(), demodWaterfallCanvas->getCenterFrequency(),demodWaterfallCanvas->getBandwidth());
}
SpectrumVisualProcessor *wproc = waterfallDataThread->getProcessor();
if (waterfallSpeedMeter->inputChanged()) {
float val = waterfallSpeedMeter->getInputValue();
waterfallSpeedMeter->setLevel(val);
waterfallDataThread->setLinesPerSecond((int)ceil(val*val));
waterfallCanvas->setLinesPerSecond((int)ceil(val*val));
GetStatusBar()->SetStatusText(wxString::Format(wxT("Waterfall max speed changed to %d lines per second."),(int)ceil(val*val)));
}
wproc->setView(waterfallCanvas->getViewState(), waterfallCanvas->getCenterFrequency(), waterfallCanvas->getBandwidth());
proc->setView(wproc->isView(), wproc->getCenterFrequency(), wproc->getBandwidth());
demod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
if (modemPropertiesUpdated.load() && demod && demod->isModemInitialized()) {
//reset notification flag
modemPropertiesUpdated.store(false);
modemProps->initProperties(demod->getModemArgs(), demod);
modemProps->updateTheme();
demodTray->Layout();
modemProps->fitColumns();
#if ENABLE_DIGITAL_LAB
if (demod->getModemType() == "digital") {
ModemDigitalOutputConsole *outp = (ModemDigitalOutputConsole *)demod->getOutput();
if (!outp->getDialog()) {
outp->setTitle(demod->getDemodulatorType() + ": " + frequencyToStr(demod->getFrequency()));
outp->setDialog(new DigitalConsole(this, outp)) ;
}
demod->showOutput();
}
#endif
} else if (!demod && modemPropertiesUpdated.load()) {
ModemArgInfoList dummyInfo;
modemProps->initProperties(dummyInfo, nullptr);
modemProps->updateTheme();
demodTray->Layout();
}
if (modemProps->IsShown() && modemProps->isCollapsed() && modemProps->GetMinWidth() > 22) {
modemProps->SetMinSize(wxSize(APPFRAME_MODEMPROPS_MINSIZE,-1));
modemProps->SetMaxSize(wxSize(APPFRAME_MODEMPROPS_MINSIZE,-1));
demodTray->Layout();
modemProps->fitColumns();
} else if (modemProps->IsShown() && !modemProps->isCollapsed() && modemProps->GetMinWidth() < 200) {
modemProps->SetMinSize(wxSize(APPFRAME_MODEMPROPS_MAXSIZE,-1));
modemProps->SetMaxSize(wxSize(APPFRAME_MODEMPROPS_MAXSIZE,-1));
demodTray->Layout();
modemProps->fitColumns();
}
int peakHoldMode = peakHoldButton->getSelection();
if (peakHoldButton->modeChanged()) {
wxGetApp().getSpectrumProcessor()->setPeakHold(peakHoldMode == 1);
//make the peak hold act on the current dmod also, like a zoomed-in version.
if (wxGetApp().getDemodSpectrumProcessor()) {
wxGetApp().getDemodSpectrumProcessor()->setPeakHold(peakHoldMode == 1);
}
peakHoldButton->clearModeChanged();
}
#if USE_HAMLIB
if (rigEnableMenuItem->IsChecked()) {
if (!wxGetApp().rigIsActive()) {
rigEnableMenuItem->Check(false);
wxGetApp().getConfig()->setRigEnabled(false);
}
}
#endif
#ifdef _WIN32
if (scopeCanvas && scopeCanvas->HasFocus()) {
waterfallCanvas->SetFocus();
}
#endif
if (!this->IsActive()) {
std::this_thread::sleep_for(std::chrono::milliseconds(30));
} else {
if (wxGetApp().getConfig()->getPerfMode() == AppConfig::PERF_LOW) {
std::this_thread::sleep_for(std::chrono::milliseconds(30));
} else {
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
}
event.RequestMore();
activeDemodulator = demod.get();
}
@ -2586,9 +2637,9 @@ bool AppFrame::isUserDemodBusy() {
return (modemProps && modemProps->isMouseInView())
|| (waterfallCanvas->isMouseInView() && waterfallCanvas->isMouseDown())
|| (demodWaterfallCanvas && demodWaterfallCanvas->isMouseInView() && demodWaterfallCanvas->isMouseDown())
|| (wxGetApp().getDemodMgr().getLastActiveDemodulator() &&
wxGetApp().getDemodMgr().getActiveDemodulator() &&
wxGetApp().getDemodMgr().getLastActiveDemodulator() != wxGetApp().getDemodMgr().getActiveDemodulator());
|| (wxGetApp().getDemodMgr().getCurrentModem() &&
wxGetApp().getDemodMgr().getActiveContextModem() &&
wxGetApp().getDemodMgr().getCurrentModem() != wxGetApp().getDemodMgr().getActiveContextModem());
}
BookmarkView *AppFrame::getBookmarkView() {
@ -2671,7 +2722,7 @@ int AppFrame::OnGlobalKeyDown(wxKeyEvent &event) {
DemodulatorInstancePtr demod = nullptr;
DemodulatorInstancePtr lastDemod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
DemodulatorInstancePtr lastDemod = wxGetApp().getDemodMgr().getCurrentModem();
int snap = wxGetApp().getFrequencySnap();
@ -2739,7 +2790,7 @@ int AppFrame::OnGlobalKeyDown(wxKeyEvent &event) {
return 1;
break;
case WXK_TAB:
lastDemod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
lastDemod = wxGetApp().getDemodMgr().getCurrentModem();
if (!lastDemod) {
break;
}
@ -2798,8 +2849,8 @@ int AppFrame::OnGlobalKeyUp(wxKeyEvent &event) {
return 1;
}
DemodulatorInstancePtr activeDemod = wxGetApp().getDemodMgr().getActiveDemodulator();
DemodulatorInstancePtr lastDemod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
DemodulatorInstancePtr activeDemod = wxGetApp().getDemodMgr().getActiveContextModem();
DemodulatorInstancePtr lastDemod = wxGetApp().getDemodMgr().getCurrentModem();
#ifdef wxHAS_RAW_KEY_CODES
switch (event.GetRawKeyCode()) {
@ -2920,7 +2971,7 @@ void AppFrame::toggleActiveDemodRecording() {
return;
}
DemodulatorInstancePtr activeDemod = wxGetApp().getDemodMgr().getActiveDemodulator();
DemodulatorInstancePtr activeDemod = wxGetApp().getDemodMgr().getActiveContextModem();
if (activeDemod) {
activeDemod->setRecording(!activeDemod->isRecording());

View File

@ -325,4 +325,19 @@ private:
wxMenu *makeRigMenu();
#endif
void handleTXAntennaChange();
void handleCurrentModem();
void handleModeSelector();
void handleGainMeter();
void handleDemodWaterfallSpectrum();
void handleSpectrumWaterfall();
void handleMuteButton();
void handleScopeProcessor();
void handleScopeSpectrumProcessors();
void handleModemProperties();
void handlePeakHold();
#if USE_HAMLIB
void handleRigMenu();
#endif
};

View File

@ -944,7 +944,7 @@ void CubicSDR::showFrequencyInput(FrequencyDialog::FrequencyDialogTarget targetM
switch (targetMode) {
case FrequencyDialog::FDIALOG_TARGET_DEFAULT:
case FrequencyDialog::FDIALOG_TARGET_FREQ:
title = demodMgr.getActiveDemodulator()?demodTitle:freqTitle;
title = demodMgr.getActiveContextModem()?demodTitle:freqTitle;
break;
case FrequencyDialog::FDIALOG_TARGET_BANDWIDTH:
title = bwTitle;
@ -965,13 +965,13 @@ void CubicSDR::showFrequencyInput(FrequencyDialog::FrequencyDialogTarget targetM
break;
}
FrequencyDialog fdialog(appframe, -1, title, demodMgr.getActiveDemodulator(), wxPoint(-100,-100), wxSize(350, 75), wxDEFAULT_DIALOG_STYLE, targetMode, initString);
FrequencyDialog fdialog(appframe, -1, title, demodMgr.getActiveContextModem(), wxPoint(-100,-100), wxSize(350, 75), wxDEFAULT_DIALOG_STYLE, targetMode, initString);
fdialog.ShowModal();
}
void CubicSDR::showLabelInput() {
DemodulatorInstancePtr activeDemod = wxGetApp().getDemodMgr().getActiveDemodulator();
DemodulatorInstancePtr activeDemod = wxGetApp().getDemodMgr().getActiveContextModem();
if (activeDemod != nullptr) {

View File

@ -469,7 +469,8 @@ void DemodulatorInstance::setFrequency(long long freq) {
}
#endif
#if USE_HAMLIB
if (wxGetApp().rigIsActive() && wxGetApp().getRigThread()->getFollowModem() && wxGetApp().getDemodMgr().getLastActiveDemodulator().get() == this) {
if (wxGetApp().rigIsActive() && wxGetApp().getRigThread()->getFollowModem() &&
wxGetApp().getDemodMgr().getCurrentModem().get() == this) {
wxGetApp().getRigThread()->setFrequency(freq,true);
}
#endif

View File

@ -97,7 +97,7 @@ std::vector<DemodulatorInstancePtr> DemodulatorMgr::getOrderedDemodulators(bool
DemodulatorInstancePtr DemodulatorMgr::getPreviousDemodulator(DemodulatorInstancePtr demod, bool actives) {
std::lock_guard < std::recursive_mutex > lock(demods_busy);
if (!getLastActiveDemodulator()) {
if (!getCurrentModem()) {
return nullptr;
}
auto demods_ordered = getOrderedDemodulators(actives);
@ -114,7 +114,7 @@ DemodulatorInstancePtr DemodulatorMgr::getPreviousDemodulator(DemodulatorInstanc
DemodulatorInstancePtr DemodulatorMgr::getNextDemodulator(DemodulatorInstancePtr demod, bool actives) {
std::lock_guard < std::recursive_mutex > lock(demods_busy);
if (!getLastActiveDemodulator()) {
if (!getCurrentModem()) {
return nullptr;
}
auto demods_ordered = getOrderedDemodulators(actives);
@ -152,11 +152,11 @@ void DemodulatorMgr::deleteThread(DemodulatorInstancePtr demod) {
auto i = std::find(demods.begin(), demods.end(), demod);
if (activeDemodulator == demod) {
activeDemodulator = nullptr;
if (activeContextModem == demod) {
activeContextModem = nullptr;
}
if (lastActiveDemodulator == demod) {
lastActiveDemodulator = nullptr;
if (currentModem == demod) {
currentModem = nullptr;
}
if (activeVisualDemodulator == demod) {
activeVisualDemodulator = nullptr;
@ -215,25 +215,30 @@ bool DemodulatorMgr::anyDemodulatorsAt(long long freq, int bandwidth) {
void DemodulatorMgr::setActiveDemodulator(DemodulatorInstancePtr demod, bool temporary) {
std::lock_guard < std::recursive_mutex > lock(demods_busy);
// Should this be made the current modem (i.e. clicked, toggled)
if (!temporary) {
if (activeDemodulator != nullptr) {
lastActiveDemodulator = activeDemodulator;
if (activeContextModem != nullptr) {
currentModem = activeContextModem;
updateLastState();
} else {
lastActiveDemodulator = demod;
currentModem = demod;
}
updateLastState();
wxGetApp().getBookmarkMgr().updateActiveList();
#if USE_HAMLIB
if (wxGetApp().rigIsActive() && wxGetApp().getRigThread()->getFollowModem() && lastActiveDemodulator) {
wxGetApp().getRigThread()->setFrequency(lastActiveDemodulator->getFrequency(),true);
if (wxGetApp().rigIsActive() && wxGetApp().getRigThread()->getFollowModem() && currentModem) {
wxGetApp().getRigThread()->setFrequency(currentModem->getFrequency(),true);
}
#endif
wxGetApp().getBookmarkMgr().updateActiveList();
}
}
// TODO: This is probably unnecessary and confusing
if (activeVisualDemodulator) {
activeVisualDemodulator->setVisualOutputQueue(nullptr);
}
@ -241,15 +246,15 @@ void DemodulatorMgr::setActiveDemodulator(DemodulatorInstancePtr demod, bool tem
demod->setVisualOutputQueue(wxGetApp().getAudioVisualQueue());
activeVisualDemodulator = demod;
} else {
DemodulatorInstancePtr last = getLastActiveDemodulator();
DemodulatorInstancePtr last = getCurrentModem();
if (last) {
last->setVisualOutputQueue(wxGetApp().getAudioVisualQueue());
}
activeVisualDemodulator = last;
}
// :ODOT
activeDemodulator = demod;
activeContextModem = demod;
}
//Dangerous: this is only intended by some internal classes
@ -266,17 +271,27 @@ void DemodulatorMgr::setActiveDemodulatorByRawPointer(DemodulatorInstance* demod
}
}
DemodulatorInstancePtr DemodulatorMgr::getActiveDemodulator() {
/**
* Get the currently focused modem, i.e. the one hovered by interaction
* If no active context modem is available the current modem is returned
* @return Active Context Modem
*/
DemodulatorInstancePtr DemodulatorMgr::getActiveContextModem() {
std::lock_guard < std::recursive_mutex > lock(demods_busy);
if (activeDemodulator && !activeDemodulator->isActive()) {
activeDemodulator = getLastActiveDemodulator();
if (activeContextModem && !activeContextModem->isActive()) {
activeContextModem = getCurrentModem();
}
return activeDemodulator;
return activeContextModem;
}
DemodulatorInstancePtr DemodulatorMgr::getLastActiveDemodulator() {
return lastActiveDemodulator;
/**
* Get the last selected / focused modem
* This is the currently active modem
* @return Current Modem
*/
DemodulatorInstancePtr DemodulatorMgr::getCurrentModem() {
return currentModem;
}
DemodulatorInstancePtr DemodulatorMgr::getLastDemodulatorWith(const std::string& type,
@ -304,27 +319,27 @@ DemodulatorInstancePtr DemodulatorMgr::getLastDemodulatorWith(const std::string&
void DemodulatorMgr::updateLastState() {
std::lock_guard < std::recursive_mutex > lock(demods_busy);
if (std::find(demods.begin(), demods.end(), lastActiveDemodulator) == demods.end()) {
if (activeDemodulator && activeDemodulator->isActive()) {
lastActiveDemodulator = activeDemodulator;
} else if (activeDemodulator && !activeDemodulator->isActive()){
activeDemodulator = nullptr;
lastActiveDemodulator = nullptr;
if (std::find(demods.begin(), demods.end(), currentModem) == demods.end()) {
if (activeContextModem && activeContextModem->isActive()) {
currentModem = activeContextModem;
} else if (activeContextModem && !activeContextModem->isActive()){
activeContextModem = nullptr;
currentModem = nullptr;
}
}
if (lastActiveDemodulator && !lastActiveDemodulator->isActive()) {
lastActiveDemodulator = nullptr;
if (currentModem && !currentModem->isActive()) {
currentModem = nullptr;
}
if (lastActiveDemodulator) {
lastBandwidth = lastActiveDemodulator->getBandwidth();
lastDemodType = lastActiveDemodulator->getDemodulatorType();
lastDemodLock = lastActiveDemodulator->getDemodulatorLock()?true:false;
lastSquelchEnabled = lastActiveDemodulator->isSquelchEnabled();
lastSquelch = lastActiveDemodulator->getSquelchLevel();
lastGain = lastActiveDemodulator->getGain();
lastModemSettings[lastDemodType] = lastActiveDemodulator->readModemSettings();
if (currentModem) {
lastBandwidth = currentModem->getBandwidth();
lastDemodType = currentModem->getDemodulatorType();
lastDemodLock = currentModem->getDemodulatorLock()?true:false;
lastSquelchEnabled = currentModem->isSquelchEnabled();
lastSquelch = currentModem->getSquelchLevel();
lastGain = currentModem->getGain();
lastModemSettings[lastDemodType] = currentModem->readModemSettings();
}
}
@ -424,7 +439,7 @@ void DemodulatorMgr::saveInstance(DataNode *node, DemodulatorInstancePtr inst) {
*node->newChild("delta_lock") = inst->isDeltaLock() ? 1 : 0;
*node->newChild("delta_ofs") = inst->getDeltaLockOfs();
}
if (inst == getLastActiveDemodulator()) {
if (inst == getCurrentModem()) {
*node->newChild("active") = 1;
}

View File

@ -39,8 +39,8 @@ public:
// and only set a pre-existing demod
void setActiveDemodulatorByRawPointer(DemodulatorInstance* demod, bool temporary = true);
DemodulatorInstancePtr getActiveDemodulator();
DemodulatorInstancePtr getLastActiveDemodulator();
DemodulatorInstancePtr getActiveContextModem();
DemodulatorInstancePtr getCurrentModem();
DemodulatorInstancePtr getLastDemodulatorWith(const std::string& type,
const std::wstring& userLabel,
long long frequency,
@ -87,8 +87,8 @@ private:
std::vector<DemodulatorInstancePtr> demods;
DemodulatorInstancePtr activeDemodulator;
DemodulatorInstancePtr lastActiveDemodulator;
DemodulatorInstancePtr activeContextModem;
DemodulatorInstancePtr currentModem;
DemodulatorInstancePtr activeVisualDemodulator;
int lastBandwidth;

View File

@ -322,7 +322,8 @@ void DemodulatorThread::run() {
}
if (!squelched && ati != nullptr) {
if (!muted.load() && (!wxGetApp().getSoloMode() || (demodInstance == wxGetApp().getDemodMgr().getLastActiveDemodulator().get()))) {
if (!muted.load() && (!wxGetApp().getSoloMode() || (demodInstance ==
wxGetApp().getDemodMgr().getCurrentModem().get()))) {
//non-blocking push needed for audio out
if (!audioOutputQueue->try_push(ati)) {

View File

@ -356,7 +356,7 @@ wxTreeItemId BookmarkView::refreshBookmarks() {
void BookmarkView::doUpdateActiveList() {
auto demods = wxGetApp().getDemodMgr().getDemodulators();
auto lastActiveDemodulator = wxGetApp().getDemodMgr().getLastActiveDemodulator();
auto lastActiveDemodulator = wxGetApp().getDemodMgr().getCurrentModem();
//capture the previously selected item info BY COPY (because the original will be destroyed together with the destroyed tree items) to restore it again after
//having rebuilding the whole tree.

View File

@ -73,8 +73,8 @@ void RigThread::run() {
while (!stopping) {
std::this_thread::sleep_for(std::chrono::milliseconds(150));
auto activeDemod = wxGetApp().getDemodMgr().getActiveDemodulator();
auto lastDemod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
auto activeDemod = wxGetApp().getDemodMgr().getActiveContextModem();
auto lastDemod = wxGetApp().getDemodMgr().getCurrentModem();
if (freqChanged.load() && (controlMode.load() || setOneShot.load())) {
status = rig_get_freq(rig, RIG_VFO_CURR, &freq);

View File

@ -69,7 +69,7 @@ void SDRPostThread::updateActiveDemodulators() {
if (abs(frequency - demod->getFrequency()) > (sampleRate / 2)) {
// deactivate if active
if (wxGetApp().getDemodMgr().getLastActiveDemodulator() == demod) {
if (wxGetApp().getDemodMgr().getCurrentModem() == demod) {
demod->setActive(false);
}
@ -84,7 +84,7 @@ void SDRPostThread::updateActiveDemodulators() {
}
} else if (!demod->isActive()) { // in range, activate if not activated
demod->setActive(true);
if (wxGetApp().getDemodMgr().getLastActiveDemodulator() == nullptr) {
if (wxGetApp().getDemodMgr().getCurrentModem() == nullptr) {
wxGetApp().getDemodMgr().setActiveDemodulator(demod);
}
@ -305,7 +305,7 @@ void SDRPostThread::runSingleCH(SDRThreadIQData *data_in) {
// Handle active channels, channel 0 offset correction, de-interlacing and push data to demodulators
void SDRPostThread::runDemodChannels(int channelBandwidth) {
DemodulatorInstancePtr activeDemod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
DemodulatorInstancePtr activeDemod = wxGetApp().getDemodMgr().getCurrentModem();
// Calculate channel data size
size_t chanDataSize = dataOut.size()/numChannels;

View File

@ -108,7 +108,7 @@ void PrimaryGLContext::DrawDemodInfo(DemodulatorInstancePtr demod, RGBA4f color,
bool soloMode = wxGetApp().getSoloMode();
bool isRecording = demod->isRecording();
bool isSolo = soloMode && demod == wxGetApp().getDemodMgr().getLastActiveDemodulator();
bool isSolo = soloMode && demod == wxGetApp().getDemodMgr().getCurrentModem();
RGBA4f labelBg(0, 0, 0, 0.35f);
@ -433,7 +433,7 @@ void PrimaryGLContext::drawSingleDemodLabel(const std::wstring& demodStr, float
void PrimaryGLContext::DrawFreqSelector(float uxPos, RGBA4f color, float w, long long /* center_freq */, long long srate) {
DemodulatorInstancePtr demod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
DemodulatorInstancePtr demod = wxGetApp().getDemodMgr().getCurrentModem();
long long bw = 0;

View File

@ -91,7 +91,7 @@ void SpectrumCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
glLoadIdentity();
auto demods = wxGetApp().getDemodMgr().getDemodulators();
auto activeDemodulator = wxGetApp().getDemodMgr().getActiveDemodulator();
auto activeDemodulator = wxGetApp().getDemodMgr().getActiveContextModem();
for (int i = 0, iMax = demods.size(); i < iMax; i++) {
if (!demods[i]->isActive()) {
@ -111,7 +111,7 @@ void SpectrumCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
freq = roundf((float)freq/(float)snap)*snap;
}
auto lastActiveDemodulator = wxGetApp().getDemodMgr().getLastActiveDemodulator();
auto lastActiveDemodulator = wxGetApp().getDemodMgr().getCurrentModem();
bool isNew = (((waterfallCanvas->isShiftDown() || (lastActiveDemodulator && !lastActiveDemodulator->isActive())) && lastActiveDemodulator) || (!lastActiveDemodulator));

View File

@ -62,7 +62,7 @@ TuningCanvas::~TuningCanvas() {
bool TuningCanvas::changed() {
auto activeDemod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
auto activeDemod = wxGetApp().getDemodMgr().getCurrentModem();
long long current_freq = 0;
if (activeDemod != nullptr) {
@ -93,7 +93,7 @@ void TuningCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
glContext->DrawBegin();
auto activeDemod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
auto activeDemod = wxGetApp().getDemodMgr().getCurrentModem();
freq = 0;
if (activeDemod != nullptr) {
@ -171,7 +171,7 @@ void TuningCanvas::StepTuner(ActiveState state, int exponent, bool up) {
amount *= 2;
}
auto activeDemod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
auto activeDemod = wxGetApp().getDemodMgr().getCurrentModem();
if (state == TUNING_HOVER_FREQ && activeDemod) {
long long freq = activeDemod->getFrequency();
long long diff = abs(wxGetApp().getFrequency() - freq);
@ -328,7 +328,7 @@ void TuningCanvas::OnMouseMoved(wxMouseEvent& event) {
}
if (hoverState == TUNING_HOVER_BW || hoverState == TUNING_HOVER_FREQ) {
wxGetApp().getDemodMgr().setActiveDemodulator(wxGetApp().getDemodMgr().getLastActiveDemodulator());
wxGetApp().getDemodMgr().setActiveDemodulator(wxGetApp().getDemodMgr().getCurrentModem());
} else {
wxGetApp().getDemodMgr().setActiveDemodulator(nullptr);
}

View File

@ -267,11 +267,11 @@ void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
auto demods = wxGetApp().getDemodMgr().getDemodulators();
auto activeDemodulator = wxGetApp().getDemodMgr().getActiveDemodulator();
auto lastActiveDemodulator = wxGetApp().getDemodMgr().getLastActiveDemodulator();
auto activeDemodulator = wxGetApp().getDemodMgr().getActiveContextModem();
auto lastActiveDemodulator = wxGetApp().getDemodMgr().getCurrentModem();
bool isNew = shiftDown
|| (wxGetApp().getDemodMgr().getLastActiveDemodulator() && !wxGetApp().getDemodMgr().getLastActiveDemodulator()->isActive());
|| (wxGetApp().getDemodMgr().getCurrentModem() && !wxGetApp().getDemodMgr().getCurrentModem()->isActive());
int currentBandwidth = getBandwidth();
long long currentCenterFreq = getCenterFrequency();
@ -279,7 +279,7 @@ void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
ColorTheme *currentTheme = ThemeMgr::mgr.currentTheme;
std::string last_type = wxGetApp().getDemodMgr().getLastDemodulatorType();
if (mouseTracker.mouseInView() || wxGetApp().getDemodMgr().getActiveDemodulator()) {
if (mouseTracker.mouseInView() || wxGetApp().getDemodMgr().getActiveContextModem()) {
hoverAlpha += (1.0f-hoverAlpha)*0.1f;
if (hoverAlpha > 1.5f) {
hoverAlpha = 1.5f;
@ -392,7 +392,7 @@ void WaterfallCanvas::OnKeyUp(wxKeyEvent& event) {
void WaterfallCanvas::OnKeyDown(wxKeyEvent& event) {
InteractiveCanvas::OnKeyDown(event);
auto activeDemod = wxGetApp().getDemodMgr().getActiveDemodulator();
auto activeDemod = wxGetApp().getDemodMgr().getActiveContextModem();
long long originalFreq = getCenterFrequency();
long long freq = originalFreq;
@ -449,8 +449,8 @@ void WaterfallCanvas::OnKeyDown(wxKeyEvent& event) {
wxGetApp().showLabelInput();
break;
case 'C':
if (wxGetApp().getDemodMgr().getActiveDemodulator()) {
wxGetApp().setFrequency(wxGetApp().getDemodMgr().getActiveDemodulator()->getFrequency());
if (wxGetApp().getDemodMgr().getActiveContextModem()) {
wxGetApp().setFrequency(wxGetApp().getDemodMgr().getActiveContextModem()->getFrequency());
} else if (mouseTracker.mouseInView()) {
long long freq = getFrequencyAt(mouseTracker.getMouseX());
@ -589,7 +589,7 @@ void WaterfallCanvas::updateHoverState() {
void WaterfallCanvas::OnMouseMoved(wxMouseEvent& event) {
InteractiveCanvas::OnMouseMoved(event);
auto demod = wxGetApp().getDemodMgr().getActiveDemodulator();
auto demod = wxGetApp().getDemodMgr().getActiveContextModem();
if (mouseTracker.mouseDown()) {
if (demod == nullptr) {
@ -654,12 +654,12 @@ void WaterfallCanvas::OnMouseDown(wxMouseEvent& event) {
wxGetApp().getDemodMgr().updateLastState();
if (dragState && dragState != WF_DRAG_RANGE) {
auto demod = wxGetApp().getDemodMgr().getActiveDemodulator();
auto demod = wxGetApp().getDemodMgr().getActiveContextModem();
if (demod) {
dragOfs = (long long) (mouseTracker.getMouseX() * (float) getBandwidth()) + getCenterFrequency() - (getBandwidth() / 2) - demod->getFrequency();
dragBW = demod->getBandwidth();
}
wxGetApp().getDemodMgr().setActiveDemodulator(wxGetApp().getDemodMgr().getActiveDemodulator(), false);
wxGetApp().getDemodMgr().setActiveDemodulator(wxGetApp().getDemodMgr().getActiveContextModem(), false);
}
}
@ -674,14 +674,14 @@ void WaterfallCanvas::OnMouseReleased(wxMouseEvent& event) {
InteractiveCanvas::OnMouseReleased(event);
wxGetApp().getDemodMgr().updateLastState();
bool isNew = shiftDown || (wxGetApp().getDemodMgr().getLastActiveDemodulator() == nullptr)
|| (wxGetApp().getDemodMgr().getLastActiveDemodulator() && !wxGetApp().getDemodMgr().getLastActiveDemodulator()->isActive());
bool isNew = shiftDown || (wxGetApp().getDemodMgr().getCurrentModem() == nullptr)
|| (wxGetApp().getDemodMgr().getCurrentModem() && !wxGetApp().getDemodMgr().getCurrentModem()->isActive());
mouseTracker.setVertDragLock(false);
mouseTracker.setHorizDragLock(false);
DemodulatorInstancePtr demod = isNew?nullptr:wxGetApp().getDemodMgr().getLastActiveDemodulator();
DemodulatorInstancePtr activeDemod = isNew?nullptr:wxGetApp().getDemodMgr().getActiveDemodulator();
DemodulatorInstancePtr demod = isNew?nullptr: wxGetApp().getDemodMgr().getCurrentModem();
DemodulatorInstancePtr activeDemod = isNew?nullptr: wxGetApp().getDemodMgr().getActiveContextModem();
DemodulatorMgr *mgr = &wxGetApp().getDemodMgr();
@ -710,7 +710,7 @@ void WaterfallCanvas::OnMouseReleased(wxMouseEvent& event) {
if (dragState == WF_DRAG_NONE) {
if (!isNew && wxGetApp().getDemodMgr().getDemodulators().size()) {
mgr->updateLastState();
demod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
demod = wxGetApp().getDemodMgr().getCurrentModem();
} else {
isNew = true;
demod = wxGetApp().getDemodMgr().newThread();
@ -811,7 +811,7 @@ void WaterfallCanvas::OnMouseReleased(wxMouseEvent& event) {
if (!isNew && wxGetApp().getDemodMgr().getDemodulators().size()) {
mgr->updateLastState();
demod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
demod = wxGetApp().getDemodMgr().getCurrentModem();
} else {
demod = wxGetApp().getDemodMgr().newThread();
demod->setFrequency(freq);