mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2025-09-06 07:07:48 -04:00
Solo squelch break focus lock/tweak
This commit is contained in:
parent
6ea2b5b8e8
commit
2bbae7209f
@ -13,6 +13,9 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
std::atomic<DemodulatorInstance *> DemodulatorThread::squelchLock(nullptr);
|
||||||
|
std::mutex DemodulatorThread::squelchLockMutex;
|
||||||
|
|
||||||
DemodulatorThread::DemodulatorThread(DemodulatorInstance *parent)
|
DemodulatorThread::DemodulatorThread(DemodulatorInstance *parent)
|
||||||
: IOThread(), outputBuffers("DemodulatorThreadBuffers"), squelchLevel(-100),
|
: IOThread(), outputBuffers("DemodulatorThreadBuffers"), squelchLevel(-100),
|
||||||
signalLevel(-100), signalFloor(-30), signalCeil(30), squelchEnabled(false) {
|
signalLevel(-100), signalFloor(-30), signalCeil(30), squelchEnabled(false) {
|
||||||
@ -23,6 +26,10 @@ DemodulatorThread::DemodulatorThread(DemodulatorInstance *parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
DemodulatorThread::~DemodulatorThread() {
|
DemodulatorThread::~DemodulatorThread() {
|
||||||
|
std::lock_guard < std::mutex > lock(squelchLockMutex);
|
||||||
|
if (squelchLock.load() == demodInstance) {
|
||||||
|
squelchLock.store(nullptr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DemodulatorThread::onBindOutput(std::string name, ThreadQueueBase *threadQueue) {
|
void DemodulatorThread::onBindOutput(std::string name, ThreadQueueBase *threadQueue) {
|
||||||
@ -182,16 +189,29 @@ void DemodulatorThread::run() {
|
|||||||
signalLevel = signalLevel + (currentSignalLevel - signalLevel) * 0.05 * sampleTime * 30.0;
|
signalLevel = signalLevel + (currentSignalLevel - signalLevel) * 0.05 * sampleTime * 30.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool squelched = (squelchEnabled && (signalLevel < squelchLevel));
|
bool squelched = (muted.load() || (squelchEnabled && (signalLevel < squelchLevel)));
|
||||||
|
|
||||||
if (squelchEnabled) {
|
if (squelchEnabled) {
|
||||||
if (!squelched && !squelchBreak) {
|
if (!squelched && !squelchBreak) {
|
||||||
if (wxGetApp().getSoloMode() && !muted.load()) {
|
if (wxGetApp().getSoloMode()) {
|
||||||
wxGetApp().getDemodMgr().setActiveDemodulator(demodInstance, false);
|
std::lock_guard < std::mutex > lock(squelchLockMutex);
|
||||||
}
|
if (squelchLock.load() == nullptr) {
|
||||||
squelchBreak = true;
|
squelchLock.store(demodInstance);
|
||||||
demodInstance->getVisualCue()->triggerSquelchBreak(120);
|
wxGetApp().getDemodMgr().setActiveDemodulator(nullptr);
|
||||||
|
wxGetApp().getDemodMgr().setActiveDemodulator(demodInstance, false);
|
||||||
|
squelchBreak = true;
|
||||||
|
demodInstance->getVisualCue()->triggerSquelchBreak(120);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
squelchBreak = true;
|
||||||
|
demodInstance->getVisualCue()->triggerSquelchBreak(120);
|
||||||
|
}
|
||||||
|
|
||||||
} else if (squelched && squelchBreak) {
|
} else if (squelched && squelchBreak) {
|
||||||
|
std::lock_guard < std::mutex > lock(squelchLockMutex);
|
||||||
|
if (squelchLock.load() == demodInstance) {
|
||||||
|
squelchLock.store(nullptr);
|
||||||
|
}
|
||||||
squelchBreak = false;
|
squelchBreak = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,10 @@ protected:
|
|||||||
std::atomic<float> signalLevel, signalFloor, signalCeil;
|
std::atomic<float> signalLevel, signalFloor, signalCeil;
|
||||||
bool squelchEnabled, squelchBreak;
|
bool squelchEnabled, squelchBreak;
|
||||||
|
|
||||||
|
static std::atomic<DemodulatorInstance *> squelchLock;
|
||||||
|
static std::mutex squelchLockMutex;
|
||||||
|
|
||||||
|
|
||||||
Modem *cModem = nullptr;
|
Modem *cModem = nullptr;
|
||||||
ModemKit *cModemKit = nullptr;
|
ModemKit *cModemKit = nullptr;
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@ void SpectrumVisualProcessor::process() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!resampler || resampleBw != lastBandwidth || lastInputBandwidth != iqData->sampleRate) {
|
if (!resampler || resampleBw != lastBandwidth || lastInputBandwidth != iqData->sampleRate) {
|
||||||
float As = 120.0f;
|
float As = 480.0;
|
||||||
|
|
||||||
if (resampler) {
|
if (resampler) {
|
||||||
msresamp_crcf_destroy(resampler);
|
msresamp_crcf_destroy(resampler);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user