mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-04 08:21:16 -05: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());
|
||||
}
|
||||
activeDemodulator = demod;
|
||||
} else if (demod) {
|
||||
// Wait state for current demodulator modem to activate..
|
||||
} else {
|
||||
DemodulatorMgr *mgr = &wxGetApp().getDemodMgr();
|
||||
|
||||
|
@ -240,6 +240,10 @@ int DemodulatorInstance::getOutputDevice() {
|
||||
void DemodulatorInstance::setDemodulatorType(std::string demod_type_in) {
|
||||
setGain(getGain());
|
||||
if (demodulatorPreThread) {
|
||||
std::string currentDemodType = demodulatorPreThread->getDemodType();
|
||||
if ((currentDemodType != "") && (currentDemodType != demod_type_in)) {
|
||||
lastModemSettings[currentDemodType] = demodulatorPreThread->readModemSettings();
|
||||
}
|
||||
demodulatorPreThread->setDemodType(demod_type_in);
|
||||
}
|
||||
}
|
||||
@ -366,4 +370,13 @@ void DemodulatorInstance::writeModemSettings(ModemSettings settings) {
|
||||
|
||||
bool DemodulatorInstance::isModemInitialized() {
|
||||
return demodulatorPreThread->isInitialized();
|
||||
}
|
||||
}
|
||||
|
||||
ModemSettings DemodulatorInstance::getLastModemSettings(std::string demodType) {
|
||||
if (lastModemSettings.find(demodType) != lastModemSettings.end()) {
|
||||
return lastModemSettings[demodType];
|
||||
} else {
|
||||
ModemSettings mods;
|
||||
return mods;
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,8 @@ public:
|
||||
void writeModemSettings(ModemSettings settings);
|
||||
|
||||
bool isModemInitialized();
|
||||
|
||||
ModemSettings getLastModemSettings(std::string demodType);
|
||||
|
||||
protected:
|
||||
DemodulatorThreadInputQueue* pipeIQInputData;
|
||||
DemodulatorThreadPostInputQueue* pipeIQDemodData;
|
||||
@ -113,4 +114,5 @@ private:
|
||||
std::atomic_int currentOutputDevice;
|
||||
std::atomic<float> currentAudioGain;
|
||||
std::atomic_bool follow, tracking;
|
||||
std::map<std::string, ModemSettings> lastModemSettings;
|
||||
};
|
||||
|
@ -103,7 +103,15 @@ void DemodulatorPreThread::run() {
|
||||
demodType = newDemodType;
|
||||
sampleRateChanged.store(false);
|
||||
audioSampleRateChanged.store(false);
|
||||
if (modemSettingsBuffered.size()) {
|
||||
ModemSettings lastSettings = parent->getLastModemSettings(newDemodType);
|
||||
if (lastSettings.size() != 0) {
|
||||
command.settings = lastSettings;
|
||||
if (modemSettingsBuffered.size()) {
|
||||
for (ModemSettings::const_iterator msi = modemSettingsBuffered.begin(); msi != modemSettingsBuffered.end(); msi++) {
|
||||
command.settings[msi->first] = msi->second;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
command.settings = modemSettingsBuffered;
|
||||
}
|
||||
modemSettingsBuffered.clear();
|
||||
|
Loading…
Reference in New Issue
Block a user