From 5ceddcfa92eb381704431b1223aee82fb4d44d64 Mon Sep 17 00:00:00 2001 From: "Charles J. Cliffe" Date: Sun, 16 Aug 2015 22:31:14 -0400 Subject: [PATCH] Activate demodulator from session if there's only one --- src/AppFrame.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/AppFrame.cpp b/src/AppFrame.cpp index df7e79f..4ceeb81 100644 --- a/src/AppFrame.cpp +++ b/src/AppFrame.cpp @@ -843,6 +843,9 @@ bool AppFrame::loadSession(std::string fileName) { DataNode *demodulators = l.rootNode()->getNext("demodulators"); + int numDemodulators = 0; + DemodulatorInstance *loadedDemod = NULL; + while (demodulators->hasAnother("demodulator")) { DataNode *demod = demodulators->getNext("demodulator"); @@ -860,6 +863,8 @@ bool AppFrame::loadSession(std::string fileName) { float gain = demod->hasAnother("gain") ? (float) *demod->getNext("gain") : 1.0; DemodulatorInstance *newDemod = wxGetApp().getDemodMgr().newThread(); + loadedDemod = newDemod; + numDemodulators++; newDemod->setDemodulatorType(type); newDemod->setBandwidth(bandwidth); newDemod->setFrequency(freq); @@ -897,6 +902,13 @@ bool AppFrame::loadSession(std::string fileName) { std::cout << "\t\tStereo: " << (stereo ? "true" : "false") << std::endl; std::cout << "\t\tOutput Device: " << output_device << std::endl; } + + if ((numDemodulators == 1) && loadedDemod) { + loadedDemod->setActive(true); + loadedDemod->setFollow(true); + loadedDemod->setTracking(true); + wxGetApp().getDemodMgr().setActiveDemodulator(loadedDemod); + } } catch (DataInvalidChildException &e) { std::cout << e.what() << std::endl; return false;