Add 'R' toggle key + fixes from initial testing

This commit is contained in:
Charles J. Cliffe 2017-10-12 00:07:05 -04:00
parent f8e51df8cd
commit 38fab6ac51
8 changed files with 42 additions and 10 deletions

View File

@ -756,7 +756,7 @@ bool AppConfig::load() {
DataNode *rec_node = cfg.rootNode()->getNext("recording"); DataNode *rec_node = cfg.rootNode()->getNext("recording");
if (rec_node->hasAnother("path")) { if (rec_node->hasAnother("path")) {
DataNode *rec_path = cfg.rootNode()->getNext("path"); DataNode *rec_path = rec_node->getNext("path");
recordingPath = rec_path->element()->toString(); recordingPath = rec_path->element()->toString();
} }
} }

View File

@ -2502,6 +2502,7 @@ int AppFrame::OnGlobalKeyDown(wxKeyEvent &event) {
case 'S': case 'S':
case 'P': case 'P':
case 'M': case 'M':
case 'R':
return 1; return 1;
case '0': case '0':
case '1': case '1':
@ -2642,6 +2643,11 @@ int AppFrame::OnGlobalKeyUp(wxKeyEvent &event) {
wxGetApp().setSoloMode(!wxGetApp().getSoloMode()); wxGetApp().setSoloMode(!wxGetApp().getSoloMode());
return 1; return 1;
break; break;
case 'R':
if (activeDemod) {
activeDemod->setRecording(!activeDemod->isRecording());
}
break;
case 'P': case 'P':
wxGetApp().getSpectrumProcessor()->setPeakHold(!wxGetApp().getSpectrumProcessor()->getPeakHold()); wxGetApp().getSpectrumProcessor()->setPeakHold(!wxGetApp().getSpectrumProcessor()->getPeakHold());
if (wxGetApp().getDemodSpectrumProcessor()) { if (wxGetApp().getDemodSpectrumProcessor()) {

View File

@ -360,7 +360,11 @@ bool BookmarkMgr::getExpandState(std::string groupName) {
void BookmarkMgr::updateActiveList() { void BookmarkMgr::updateActiveList() {
std::lock_guard < std::recursive_mutex > lockData(busy_lock); std::lock_guard < std::recursive_mutex > lockData(busy_lock);
if (wxGetApp().isShuttingDown()) {
return;
}
BookmarkView *bmv = wxGetApp().getAppFrame()->getBookmarkView(); BookmarkView *bmv = wxGetApp().getAppFrame()->getBookmarkView();

View File

@ -203,6 +203,7 @@ CubicSDR::CubicSDR() : frequency(0), offset(0), ppm(0), snap(1), sampleRate(DEFA
sampleRateInitialized.store(false); sampleRateInitialized.store(false);
agcMode.store(true); agcMode.store(true);
soloMode.store(false); soloMode.store(false);
shuttingDown.store(false);
fdlgTarget = FrequencyDialog::FDIALOG_TARGET_DEFAULT; fdlgTarget = FrequencyDialog::FDIALOG_TARGET_DEFAULT;
stoppedDev = nullptr; stoppedDev = nullptr;
} }
@ -384,6 +385,8 @@ bool CubicSDR::OnInit() {
} }
int CubicSDR::OnExit() { int CubicSDR::OnExit() {
shuttingDown.store(true);
#if USE_HAMLIB #if USE_HAMLIB
if (rigIsActive()) { if (rigIsActive()) {
std::cout << "Terminating Rig thread.." << std::endl << std::flush; std::cout << "Terminating Rig thread.." << std::endl << std::flush;
@ -1025,6 +1028,11 @@ bool CubicSDR::getSoloMode() {
return soloMode.load(); return soloMode.load();
} }
bool CubicSDR::isShuttingDown()
{
return shuttingDown.load();
}
int CubicSDR::FilterEvent(wxEvent& event) { int CubicSDR::FilterEvent(wxEvent& event) {
if (!appframe) { if (!appframe) {
return -1; return -1;

View File

@ -170,6 +170,8 @@ public:
void setSoloMode(bool solo); void setSoloMode(bool solo);
bool getSoloMode(); bool getSoloMode();
bool isShuttingDown();
#ifdef USE_HAMLIB #ifdef USE_HAMLIB
RigThread *getRigThread(); RigThread *getRigThread();
@ -195,6 +197,7 @@ private:
std::atomic_llong sampleRate; std::atomic_llong sampleRate;
std::string antennaName; std::string antennaName;
std::atomic_bool agcMode; std::atomic_bool agcMode;
std::atomic_bool shuttingDown;
SDRThread *sdrThread = nullptr; SDRThread *sdrThread = nullptr;
SDREnumerator *sdrEnum = nullptr; SDREnumerator *sdrEnum = nullptr;

View File

@ -58,7 +58,6 @@ void DemodulatorMgr::terminateAll() {
DemodulatorInstancePtr d = demods.back(); DemodulatorInstancePtr d = demods.back();
demods.pop_back(); demods.pop_back();
wxGetApp().removeDemodulator(d);
deleteThread(d); deleteThread(d);
} }
} }

View File

@ -44,7 +44,7 @@ void DemodulatorThread::onBindOutput(std::string name, ThreadQueueBasePtr thread
audioVisOutputQueue = std::static_pointer_cast<DemodulatorThreadOutputQueue>(threadQueue); audioVisOutputQueue = std::static_pointer_cast<DemodulatorThreadOutputQueue>(threadQueue);
} }
if (name == "AudioSinkOutput") { if (name == "AudioSink") {
std::lock_guard < std::mutex > lock(m_mutexAudioVisOutputQueue); std::lock_guard < std::mutex > lock(m_mutexAudioVisOutputQueue);
audioSinkOutputQueue = std::static_pointer_cast<AudioThreadInputQueue>(threadQueue); audioSinkOutputQueue = std::static_pointer_cast<AudioThreadInputQueue>(threadQueue);

View File

@ -104,17 +104,25 @@ void PrimaryGLContext::DrawDemodInfo(DemodulatorInstancePtr demod, RGBA4f color,
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
bool soloMode = wxGetApp().getSoloMode(); bool soloMode = wxGetApp().getSoloMode();
bool isRecording = demod->isRecording();
bool isSolo = soloMode && demod == wxGetApp().getDemodMgr().getLastActiveDemodulator(); bool isSolo = soloMode && demod == wxGetApp().getDemodMgr().getLastActiveDemodulator();
RGBA4f labelBg(0, 0, 0, 0.35f);
if (isSolo) { if (isSolo) {
glColor4f(0.8f, 0.8f, 0, 0.35f); labelBg.r = labelBg.g = 0.8f;
} else if (demod->isMuted()) { } else if (demod->isMuted()) {
glColor4f(0.8f, 0, 0, 0.35f); labelBg.r = 0.8f;
} else if (soloMode) { } else if (soloMode) {
glColor4f(0.2f, 0, 0, 0.35f); labelBg.r = 0.2f;
} else {
glColor4f(0, 0, 0, 0.35f);
} }
// TODO: Better recording indicator... pulsating red circle?
if (isRecording) {
labelBg.g = 1.0f;
}
glColor4f(labelBg.r, labelBg.g, labelBg.b, labelBg.a);
glBegin(GL_QUADS); glBegin(GL_QUADS);
glVertex3f(uxPos - ofsLeft, hPos + labelHeight, 0.0); glVertex3f(uxPos - ofsLeft, hPos + labelHeight, 0.0);
@ -167,7 +175,11 @@ void PrimaryGLContext::DrawDemodInfo(DemodulatorInstancePtr demod, RGBA4f color,
if (demod->isDeltaLock()) { if (demod->isDeltaLock()) {
demodLabel.append(" [V]"); demodLabel.append(" [V]");
} }
if (isRecording) {
demodLabel.append(" [R]");
}
if (demod->getDemodulatorType() == "USB") { if (demod->getDemodulatorType() == "USB") {
GLFont::getFont(16, GLFont::getScaleFactor()).drawString(demodLabel, uxPos, hPos, GLFont::GLFONT_ALIGN_LEFT, GLFont::GLFONT_ALIGN_CENTER, 0, 0, true); GLFont::getFont(16, GLFont::getScaleFactor()).drawString(demodLabel, uxPos, hPos, GLFont::GLFONT_ALIGN_LEFT, GLFont::GLFONT_ALIGN_CENTER, 0, 0, true);
} else if (demod->getDemodulatorType() == "LSB") { } else if (demod->getDemodulatorType() == "LSB") {