mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-21 19:31:54 -05:00
Make sure squelch lock is released on de-activate too
This commit is contained in:
parent
1fd23b6d33
commit
9f5c674646
@ -214,6 +214,7 @@ void DemodulatorInstance::setActive(bool state) {
|
||||
}
|
||||
#endif
|
||||
audioThread->setActive(state);
|
||||
DemodulatorThread::releaseSquelchLock(this);
|
||||
} else if (!active && state) {
|
||||
#if ENABLE_DIGITAL_LAB
|
||||
if (activeOutput && getModemType() == "digital") {
|
||||
|
@ -26,10 +26,7 @@ DemodulatorThread::DemodulatorThread(DemodulatorInstance *parent)
|
||||
}
|
||||
|
||||
DemodulatorThread::~DemodulatorThread() {
|
||||
std::lock_guard < std::mutex > lock(squelchLockMutex);
|
||||
if (squelchLock.load() == demodInstance) {
|
||||
squelchLock.store(nullptr);
|
||||
}
|
||||
releaseSquelchLock(demodInstance);
|
||||
}
|
||||
|
||||
void DemodulatorThread::onBindOutput(std::string name, ThreadQueueBase *threadQueue) {
|
||||
@ -208,10 +205,7 @@ void DemodulatorThread::run() {
|
||||
}
|
||||
|
||||
} else if (squelched && squelchBreak) {
|
||||
std::lock_guard < std::mutex > lock(squelchLockMutex);
|
||||
if (squelchLock.load() == demodInstance) {
|
||||
squelchLock.store(nullptr);
|
||||
}
|
||||
releaseSquelchLock(demodInstance);
|
||||
squelchBreak = false;
|
||||
}
|
||||
}
|
||||
@ -403,3 +397,14 @@ void DemodulatorThread::setSquelchLevel(float signal_level_in) {
|
||||
float DemodulatorThread::getSquelchLevel() {
|
||||
return squelchLevel;
|
||||
}
|
||||
|
||||
bool DemodulatorThread::getSquelchBreak() {
|
||||
return squelchBreak;
|
||||
}
|
||||
|
||||
void DemodulatorThread::releaseSquelchLock(DemodulatorInstance *inst) {
|
||||
std::lock_guard < std::mutex > lock(squelchLockMutex);
|
||||
if (squelchLock.load() == inst) {
|
||||
squelchLock.store(nullptr);
|
||||
}
|
||||
}
|
@ -36,6 +36,8 @@ public:
|
||||
float getSquelchLevel();
|
||||
|
||||
bool getSquelchBreak();
|
||||
|
||||
static void releaseSquelchLock(DemodulatorInstance *inst);
|
||||
|
||||
protected:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user