mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-27 06:08:37 -05:00
FIX: Inactive demod bendwiths are restored to 0 from sessions, because they were erroneously saved as such.
The problem lies in DemodulatorPreThread: - settings were actually get/set unprotected from concurrent access (bendwiths, frequencies, sample rates...etc) so make them atomic. - If bandwith has changed, return the new value instead of the current one, just like frequencies.
This commit is contained in:
parent
4b48113936
commit
946a9801dc
@ -385,7 +385,7 @@ void DemodulatorMgr::setOutputDevices(std::map<int,RtAudio::DeviceInfo> devs) {
|
||||
|
||||
void DemodulatorMgr::saveInstance(DataNode *node, DemodulatorInstance *inst) {
|
||||
*node->newChild("bandwidth") = inst->getBandwidth();
|
||||
*node->newChild("frequency") = inst->getFrequency();
|
||||
*node->newChild("frequency") = inst->getFrequency();
|
||||
*node->newChild("type") = inst->getDemodulatorType();
|
||||
|
||||
node->newChild("user_label")->element()->set(inst->getDemodulatorUserLabel());
|
||||
|
@ -76,7 +76,7 @@ void DemodulatorPreThread::run() {
|
||||
iqInputQueue->pop(inp);
|
||||
|
||||
if (frequencyChanged.load()) {
|
||||
currentFrequency = newFrequency;
|
||||
currentFrequency.store(newFrequency);
|
||||
frequencyChanged.store(false);
|
||||
}
|
||||
|
||||
@ -326,7 +326,11 @@ void DemodulatorPreThread::setBandwidth(int bandwidth) {
|
||||
newBandwidth = bandwidth;
|
||||
}
|
||||
|
||||
int DemodulatorPreThread::getBandwidth() {
|
||||
int DemodulatorPreThread::getBandwidth() {
|
||||
if (bandwidthChanged.load()) {
|
||||
return newBandwidth;
|
||||
}
|
||||
|
||||
return currentBandwidth;
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include <queue>
|
||||
#include <vector>
|
||||
#include <atomic>
|
||||
|
||||
#include "CubicSDRDefs.h"
|
||||
#include "DemodDefs.h"
|
||||
@ -56,10 +57,10 @@ protected:
|
||||
Modem *cModem;
|
||||
ModemKit *cModemKit;
|
||||
|
||||
long long currentSampleRate, newSampleRate;
|
||||
long long currentFrequency, newFrequency;
|
||||
int currentBandwidth, newBandwidth;
|
||||
int currentAudioSampleRate, newAudioSampleRate;
|
||||
std::atomic_llong currentSampleRate, newSampleRate;
|
||||
std::atomic_llong currentFrequency, newFrequency;
|
||||
std::atomic_int currentBandwidth, newBandwidth;
|
||||
std::atomic_int currentAudioSampleRate, newAudioSampleRate;
|
||||
|
||||
std::atomic_bool sampleRateChanged, frequencyChanged, bandwidthChanged, audioSampleRateChanged;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user