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) {
|
void DemodulatorMgr::saveInstance(DataNode *node, DemodulatorInstance *inst) {
|
||||||
*node->newChild("bandwidth") = inst->getBandwidth();
|
*node->newChild("bandwidth") = inst->getBandwidth();
|
||||||
*node->newChild("frequency") = inst->getFrequency();
|
*node->newChild("frequency") = inst->getFrequency();
|
||||||
*node->newChild("type") = inst->getDemodulatorType();
|
*node->newChild("type") = inst->getDemodulatorType();
|
||||||
|
|
||||||
node->newChild("user_label")->element()->set(inst->getDemodulatorUserLabel());
|
node->newChild("user_label")->element()->set(inst->getDemodulatorUserLabel());
|
||||||
|
@ -76,7 +76,7 @@ void DemodulatorPreThread::run() {
|
|||||||
iqInputQueue->pop(inp);
|
iqInputQueue->pop(inp);
|
||||||
|
|
||||||
if (frequencyChanged.load()) {
|
if (frequencyChanged.load()) {
|
||||||
currentFrequency = newFrequency;
|
currentFrequency.store(newFrequency);
|
||||||
frequencyChanged.store(false);
|
frequencyChanged.store(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -326,7 +326,11 @@ void DemodulatorPreThread::setBandwidth(int bandwidth) {
|
|||||||
newBandwidth = bandwidth;
|
newBandwidth = bandwidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DemodulatorPreThread::getBandwidth() {
|
int DemodulatorPreThread::getBandwidth() {
|
||||||
|
if (bandwidthChanged.load()) {
|
||||||
|
return newBandwidth;
|
||||||
|
}
|
||||||
|
|
||||||
return currentBandwidth;
|
return currentBandwidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include <queue>
|
#include <queue>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <atomic>
|
||||||
|
|
||||||
#include "CubicSDRDefs.h"
|
#include "CubicSDRDefs.h"
|
||||||
#include "DemodDefs.h"
|
#include "DemodDefs.h"
|
||||||
@ -56,10 +57,10 @@ protected:
|
|||||||
Modem *cModem;
|
Modem *cModem;
|
||||||
ModemKit *cModemKit;
|
ModemKit *cModemKit;
|
||||||
|
|
||||||
long long currentSampleRate, newSampleRate;
|
std::atomic_llong currentSampleRate, newSampleRate;
|
||||||
long long currentFrequency, newFrequency;
|
std::atomic_llong currentFrequency, newFrequency;
|
||||||
int currentBandwidth, newBandwidth;
|
std::atomic_int currentBandwidth, newBandwidth;
|
||||||
int currentAudioSampleRate, newAudioSampleRate;
|
std::atomic_int currentAudioSampleRate, newAudioSampleRate;
|
||||||
|
|
||||||
std::atomic_bool sampleRateChanged, frequencyChanged, bandwidthChanged, audioSampleRateChanged;
|
std::atomic_bool sampleRateChanged, frequencyChanged, bandwidthChanged, audioSampleRateChanged;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user