mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-09-28 16:16:58 -04:00
Remember settings when toggling modem types
- Some additional race condition fixes for showing/hiding the modem property grid
This commit is contained in:
parent
4fa0cb7c67
commit
e68ab1e82f
@ -950,6 +950,8 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
|
|||||||
demodGainMeter->setLevel(demodGainMeter->getInputValue());
|
demodGainMeter->setLevel(demodGainMeter->getInputValue());
|
||||||
}
|
}
|
||||||
activeDemodulator = demod;
|
activeDemodulator = demod;
|
||||||
|
} else if (demod) {
|
||||||
|
// Wait state for current demodulator modem to activate..
|
||||||
} else {
|
} else {
|
||||||
DemodulatorMgr *mgr = &wxGetApp().getDemodMgr();
|
DemodulatorMgr *mgr = &wxGetApp().getDemodMgr();
|
||||||
|
|
||||||
|
@ -240,6 +240,10 @@ int DemodulatorInstance::getOutputDevice() {
|
|||||||
void DemodulatorInstance::setDemodulatorType(std::string demod_type_in) {
|
void DemodulatorInstance::setDemodulatorType(std::string demod_type_in) {
|
||||||
setGain(getGain());
|
setGain(getGain());
|
||||||
if (demodulatorPreThread) {
|
if (demodulatorPreThread) {
|
||||||
|
std::string currentDemodType = demodulatorPreThread->getDemodType();
|
||||||
|
if ((currentDemodType != "") && (currentDemodType != demod_type_in)) {
|
||||||
|
lastModemSettings[currentDemodType] = demodulatorPreThread->readModemSettings();
|
||||||
|
}
|
||||||
demodulatorPreThread->setDemodType(demod_type_in);
|
demodulatorPreThread->setDemodType(demod_type_in);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -367,3 +371,12 @@ void DemodulatorInstance::writeModemSettings(ModemSettings settings) {
|
|||||||
bool DemodulatorInstance::isModemInitialized() {
|
bool DemodulatorInstance::isModemInitialized() {
|
||||||
return demodulatorPreThread->isInitialized();
|
return demodulatorPreThread->isInitialized();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ModemSettings DemodulatorInstance::getLastModemSettings(std::string demodType) {
|
||||||
|
if (lastModemSettings.find(demodType) != lastModemSettings.end()) {
|
||||||
|
return lastModemSettings[demodType];
|
||||||
|
} else {
|
||||||
|
ModemSettings mods;
|
||||||
|
return mods;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -89,6 +89,7 @@ public:
|
|||||||
void writeModemSettings(ModemSettings settings);
|
void writeModemSettings(ModemSettings settings);
|
||||||
|
|
||||||
bool isModemInitialized();
|
bool isModemInitialized();
|
||||||
|
ModemSettings getLastModemSettings(std::string demodType);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
DemodulatorThreadInputQueue* pipeIQInputData;
|
DemodulatorThreadInputQueue* pipeIQInputData;
|
||||||
@ -113,4 +114,5 @@ private:
|
|||||||
std::atomic_int currentOutputDevice;
|
std::atomic_int currentOutputDevice;
|
||||||
std::atomic<float> currentAudioGain;
|
std::atomic<float> currentAudioGain;
|
||||||
std::atomic_bool follow, tracking;
|
std::atomic_bool follow, tracking;
|
||||||
|
std::map<std::string, ModemSettings> lastModemSettings;
|
||||||
};
|
};
|
||||||
|
@ -103,7 +103,15 @@ void DemodulatorPreThread::run() {
|
|||||||
demodType = newDemodType;
|
demodType = newDemodType;
|
||||||
sampleRateChanged.store(false);
|
sampleRateChanged.store(false);
|
||||||
audioSampleRateChanged.store(false);
|
audioSampleRateChanged.store(false);
|
||||||
|
ModemSettings lastSettings = parent->getLastModemSettings(newDemodType);
|
||||||
|
if (lastSettings.size() != 0) {
|
||||||
|
command.settings = lastSettings;
|
||||||
if (modemSettingsBuffered.size()) {
|
if (modemSettingsBuffered.size()) {
|
||||||
|
for (ModemSettings::const_iterator msi = modemSettingsBuffered.begin(); msi != modemSettingsBuffered.end(); msi++) {
|
||||||
|
command.settings[msi->first] = msi->second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
command.settings = modemSettingsBuffered;
|
command.settings = modemSettingsBuffered;
|
||||||
}
|
}
|
||||||
modemSettingsBuffered.clear();
|
modemSettingsBuffered.clear();
|
||||||
|
Loading…
Reference in New Issue
Block a user