MCPcopy Create free account
hub / github.com/cjcliffe/CubicSDR / updateActiveDemodulators

Method updateActiveDemodulators

src/sdr/SDRPostThread.cpp:44–98  ·  view source on GitHub ↗

Update the active list of demodulators for handling

Source from the content-addressed store, hash-verified

42
43// Update the active list of demodulators for handling
44void SDRPostThread::updateActiveDemodulators() {
45 // In range?
46
47 runDemods.clear();
48 demodChannel.clear();
49
50 long long centerFreq = wxGetApp().getFrequency();
51
52 //retrieve the current list of demodulators:
53 auto demodulators = wxGetApp().getDemodMgr().getDemodulators();
54
55 for (const auto& demod : demodulators) {
56
57 // not in range?
58 if (demod->isDeltaLock()) {
59 if (demod->getFrequency() != centerFreq + demod->getDeltaLockOfs()) {
60 demod->setFrequency(centerFreq + demod->getDeltaLockOfs());
61 demod->updateLabel(demod->getFrequency());
62 demod->setFollow(false);
63 demod->setTracking(false);
64 }
65 }
66
67 if (abs(frequency - demod->getFrequency()) > (sampleRate / 2)) {
68 // deactivate if active
69
70 if (wxGetApp().getDemodMgr().getCurrentModem() == demod) {
71 demod->setActive(false);
72 }
73 else if (demod->isActive() && !demod->isFollow() && !demod->isTracking()) {
74 demod->setActive(false);
75 }
76
77 // follow if follow mode
78 if (demod->isFollow() && centerFreq != demod->getFrequency()) {
79 wxGetApp().setFrequency(demod->getFrequency());
80 demod->setFollow(false);
81 }
82 } else if (!demod->isActive()) { // in range, activate if not activated
83 demod->setActive(true);
84 if (wxGetApp().getDemodMgr().getCurrentModem() == nullptr) {
85
86 wxGetApp().getDemodMgr().setActiveDemodulator(demod);
87 }
88 }
89
90 if (!demod->isActive()) {
91 continue;
92 }
93
94 // Add active demods to the current run:
95 runDemods.push_back(demod);
96 demodChannel.push_back(-1);
97 }
98}
99
100
101void SDRPostThread::resetAllDemodulators() {

Callers

nothing calls this directly

Calls 15

getDemodulatorsMethod · 0.80
isDeltaLockMethod · 0.80
getDeltaLockOfsMethod · 0.80
updateLabelMethod · 0.80
setFollowMethod · 0.80
setTrackingMethod · 0.80
getCurrentModemMethod · 0.80
isFollowMethod · 0.80
isTrackingMethod · 0.80
setActiveDemodulatorMethod · 0.80
clearMethod · 0.45
getFrequencyMethod · 0.45

Tested by

no test coverage detected