mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-27 06:08:37 -05:00
Activate demodulator from session if there's only one
This commit is contained in:
parent
36fe309c6e
commit
5ceddcfa92
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user