Merge pull request #360 from cjcliffe/visual_squelch_break

Rough visual cue for demod instances, implement squelch break indicator
This commit is contained in:
Charles J. Cliffe 2016-06-03 20:08:18 -04:00
commit 8e8e1af4ae
4 changed files with 57 additions and 0 deletions

View File

@ -5,6 +5,31 @@
#include "RigThread.h" #include "RigThread.h"
#endif #endif
DemodVisualCue::DemodVisualCue() {
squelchBreak.store(false);
}
DemodVisualCue::~DemodVisualCue() {
}
void DemodVisualCue::triggerSquelchBreak(int counter) {
squelchBreak.store(counter);
}
int DemodVisualCue::getSquelchBreak() {
return squelchBreak.load();
}
void DemodVisualCue::step() {
if (squelchBreak.load()) {
squelchBreak--;
if (squelchBreak.load() < 0) {
squelchBreak.store(0);
}
}
}
DemodulatorInstance::DemodulatorInstance() : DemodulatorInstance::DemodulatorInstance() :
t_PreDemod(nullptr), t_Demod(nullptr), t_Audio(nullptr) { t_PreDemod(nullptr), t_Demod(nullptr), t_Audio(nullptr) {
@ -418,6 +443,10 @@ void DemodulatorInstance::setMuted(bool muted) {
wxGetApp().getDemodMgr().setLastMuted(muted); wxGetApp().getDemodMgr().setLastMuted(muted);
} }
DemodVisualCue *DemodulatorInstance::getVisualCue() {
return &visualCue;
}
DemodulatorThreadInputQueue *DemodulatorInstance::getIQInputDataPipe() { DemodulatorThreadInputQueue *DemodulatorInstance::getIQInputDataPipe() {
return pipeIQInputData; return pipeIQInputData;
} }

View File

@ -14,6 +14,20 @@
#include "DigitalConsole.h" #include "DigitalConsole.h"
#endif #endif
class DemodVisualCue {
public:
DemodVisualCue();
~DemodVisualCue();
void triggerSquelchBreak(int counter);
int getSquelchBreak();
void step();
private:
std::atomic_int squelchBreak;
};
class DemodulatorInstance { class DemodulatorInstance {
public: public:
@ -89,6 +103,8 @@ public:
bool isMuted(); bool isMuted();
void setMuted(bool muted); void setMuted(bool muted);
DemodVisualCue *getVisualCue();
DemodulatorThreadInputQueue *getIQInputDataPipe(); DemodulatorThreadInputQueue *getIQInputDataPipe();
ModemArgInfoList getModemArgs(); ModemArgInfoList getModemArgs();
@ -135,6 +151,7 @@ private:
std::atomic_bool follow, tracking; std::atomic_bool follow, tracking;
std::map<std::string, ModemSettings> lastModemSettings; std::map<std::string, ModemSettings> lastModemSettings;
std::map<std::string, int> lastModemBandwidth; std::map<std::string, int> lastModemBandwidth;
DemodVisualCue visualCue;
#if ENABLE_DIGITAL_LAB #if ENABLE_DIGITAL_LAB
ModemDigitalOutput *activeOutput; ModemDigitalOutput *activeOutput;
#endif #endif

View File

@ -157,6 +157,7 @@ void DemodulatorThread::run() {
wxGetApp().getDemodMgr().setActiveDemodulator(demodInstance, false); wxGetApp().getDemodMgr().setActiveDemodulator(demodInstance, false);
} }
squelchBreak = true; squelchBreak = true;
demodInstance->getVisualCue()->triggerSquelchBreak(120);
} else if (squelched && squelchBreak) { } else if (squelched && squelchBreak) {
squelchBreak = false; squelchBreak = false;
} }

View File

@ -338,6 +338,16 @@ void WaterfallCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
glContext->DrawDemod(demods[i], currentTheme->waterfallHighlight, currentCenterFreq, currentBandwidth); glContext->DrawDemod(demods[i], currentTheme->waterfallHighlight, currentCenterFreq, currentBandwidth);
} }
for (int i = 0, iMax = demods.size(); i < iMax; i++) {
demods[i]->getVisualCue()->step();
int squelchBreak = demods[i]->getVisualCue()->getSquelchBreak();
if (squelchBreak) {
glContext->setHoverAlpha((float(squelchBreak) / 60.0));
glContext->DrawDemod(demods[i], currentTheme->waterfallHover, currentCenterFreq, currentBandwidth);
}
}
glContext->EndDraw(); glContext->EndDraw();
SwapBuffers(); SwapBuffers();