mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2025-02-03 09:44:26 -05:00
Save active modem to session
This commit is contained in:
parent
c011fb2575
commit
d8ed093659
@ -1349,6 +1349,9 @@ void AppFrame::saveSession(std::string fileName) {
|
|||||||
*demod->newChild("output_device") = outputDevices[(*instance_i)->getOutputDevice()].name;
|
*demod->newChild("output_device") = outputDevices[(*instance_i)->getOutputDevice()].name;
|
||||||
*demod->newChild("gain") = (*instance_i)->getGain();
|
*demod->newChild("gain") = (*instance_i)->getGain();
|
||||||
*demod->newChild("muted") = (*instance_i)->isMuted() ? 1 : 0;
|
*demod->newChild("muted") = (*instance_i)->isMuted() ? 1 : 0;
|
||||||
|
if ((*instance_i) == wxGetApp().getDemodMgr().getLastActiveDemodulator()) {
|
||||||
|
*demod->newChild("active") = 1;
|
||||||
|
}
|
||||||
|
|
||||||
ModemSettings saveSettings = (*instance_i)->readModemSettings();
|
ModemSettings saveSettings = (*instance_i)->readModemSettings();
|
||||||
if (saveSettings.size()) {
|
if (saveSettings.size()) {
|
||||||
@ -1408,6 +1411,7 @@ bool AppFrame::loadSession(std::string fileName) {
|
|||||||
|
|
||||||
int numDemodulators = 0;
|
int numDemodulators = 0;
|
||||||
DemodulatorInstance *loadedDemod = NULL;
|
DemodulatorInstance *loadedDemod = NULL;
|
||||||
|
DemodulatorInstance *newDemod = NULL;
|
||||||
|
|
||||||
while (demodulators->hasAnother("demodulator")) {
|
while (demodulators->hasAnother("demodulator")) {
|
||||||
DataNode *demod = demodulators->getNext("demodulator");
|
DataNode *demod = demodulators->getNext("demodulator");
|
||||||
@ -1469,8 +1473,16 @@ bool AppFrame::loadSession(std::string fileName) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DemodulatorInstance *newDemod = wxGetApp().getDemodMgr().newThread();
|
bool isActive = false;
|
||||||
loadedDemod = newDemod;
|
|
||||||
|
|
||||||
|
newDemod = wxGetApp().getDemodMgr().newThread();
|
||||||
|
|
||||||
|
if (demod->hasAnother("active")) {
|
||||||
|
isActive = true; // active only written to active demod, no need to parse..
|
||||||
|
loadedDemod = newDemod;
|
||||||
|
}
|
||||||
|
|
||||||
numDemodulators++;
|
numDemodulators++;
|
||||||
newDemod->setDemodulatorType(type);
|
newDemod->setDemodulatorType(type);
|
||||||
newDemod->writeModemSettings(mSettings);
|
newDemod->writeModemSettings(mSettings);
|
||||||
@ -1508,11 +1520,13 @@ bool AppFrame::loadSession(std::string fileName) {
|
|||||||
std::cout << "\t\tOutput Device: " << output_device << std::endl;
|
std::cout << "\t\tOutput Device: " << output_device << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((numDemodulators == 1) && loadedDemod) {
|
DemodulatorInstance *focusDemod = loadedDemod?loadedDemod:newDemod;
|
||||||
loadedDemod->setActive(true);
|
|
||||||
loadedDemod->setFollow(true);
|
if (focusDemod) {
|
||||||
loadedDemod->setTracking(true);
|
focusDemod->setActive(true);
|
||||||
wxGetApp().getDemodMgr().setActiveDemodulator(loadedDemod, false);
|
focusDemod->setFollow(true);
|
||||||
|
focusDemod->setTracking(true);
|
||||||
|
wxGetApp().getDemodMgr().setActiveDemodulator(focusDemod, false);
|
||||||
}
|
}
|
||||||
} catch (DataInvalidChildException &e) {
|
} catch (DataInvalidChildException &e) {
|
||||||
std::cout << e.what() << std::endl;
|
std::cout << e.what() << std::endl;
|
||||||
|
Loading…
Reference in New Issue
Block a user