mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2026-06-27 14:03:15 -04:00
Persist modem settings on new instances
This commit is contained in:
@@ -8,7 +8,13 @@
|
||||
DemodulatorMgr::DemodulatorMgr() :
|
||||
activeDemodulator(NULL), lastActiveDemodulator(NULL), activeVisualDemodulator(NULL), lastBandwidth(DEFAULT_DEMOD_BW), lastDemodType(
|
||||
DEFAULT_DEMOD_TYPE), lastSquelchEnabled(false), lastSquelch(-100), lastGain(1.0), lastMuted(false) {
|
||||
|
||||
setLastBandwidth("FM",200000);
|
||||
setLastBandwidth("FMS",200000);
|
||||
setLastBandwidth("AM",6000);
|
||||
setLastBandwidth("USB",5400);
|
||||
setLastBandwidth("LSB",5400);
|
||||
setLastBandwidth("DSB",5400);
|
||||
setLastBandwidth("IQ",48000);
|
||||
}
|
||||
|
||||
DemodulatorMgr::~DemodulatorMgr() {
|
||||
@@ -88,6 +94,7 @@ void DemodulatorMgr::setActiveDemodulator(DemodulatorInstance *demod, bool tempo
|
||||
if (!temporary) {
|
||||
if (activeDemodulator != NULL) {
|
||||
lastActiveDemodulator = activeDemodulator;
|
||||
updateLastState();
|
||||
} else {
|
||||
lastActiveDemodulator = demod;
|
||||
}
|
||||
@@ -121,8 +128,6 @@ DemodulatorInstance *DemodulatorMgr::getActiveDemodulator() {
|
||||
}
|
||||
|
||||
DemodulatorInstance *DemodulatorMgr::getLastActiveDemodulator() {
|
||||
updateLastState();
|
||||
|
||||
return lastActiveDemodulator;
|
||||
}
|
||||
|
||||
@@ -165,6 +170,8 @@ void DemodulatorMgr::updateLastState() {
|
||||
lastSquelchEnabled = lastActiveDemodulator->isSquelchEnabled();
|
||||
lastSquelch = lastActiveDemodulator->getSquelchLevel();
|
||||
lastGain = lastActiveDemodulator->getGain();
|
||||
lastModemSettings[lastDemodType] = lastActiveDemodulator->readModemSettings();
|
||||
lastBandwidthNamed[lastDemodType] = lastBandwidth;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -222,3 +229,17 @@ void DemodulatorMgr::setLastMuted(bool lastMuted) {
|
||||
this->lastMuted = lastMuted;
|
||||
}
|
||||
|
||||
ModemSettings DemodulatorMgr::getLastModemSettings(std::string modemType) {
|
||||
return lastModemSettings[modemType];
|
||||
}
|
||||
|
||||
void DemodulatorMgr::setLastModemSettings(std::string modemType, ModemSettings settings) {
|
||||
lastModemSettings[modemType] = settings;
|
||||
}
|
||||
|
||||
int DemodulatorMgr::getLastBandwidth(std::string modemType) {
|
||||
return lastBandwidthNamed[modemType];
|
||||
}
|
||||
void DemodulatorMgr::setLastBandwidth(std::string modemType, int lastBandwidth_in) {
|
||||
lastBandwidthNamed[modemType] = lastBandwidth_in;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user