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");
if (rec_node->hasAnother("path")) {
DataNode *rec_path = cfg.rootNode()->getNext("path");
DataNode *rec_path = rec_node->getNext("path");
recordingPath = rec_path->element()->toString();
}
}

View File

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

View File

@ -360,7 +360,11 @@ bool BookmarkMgr::getExpandState(std::string groupName) {
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();

View File

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

View File

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

View File

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

View File

@ -44,7 +44,7 @@ void DemodulatorThread::onBindOutput(std::string name, ThreadQueueBasePtr thread
audioVisOutputQueue = std::static_pointer_cast<DemodulatorThreadOutputQueue>(threadQueue);
}
if (name == "AudioSinkOutput") {
if (name == "AudioSink") {
std::lock_guard < std::mutex > lock(m_mutexAudioVisOutputQueue);
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);
bool soloMode = wxGetApp().getSoloMode();
bool isRecording = demod->isRecording();
bool isSolo = soloMode && demod == wxGetApp().getDemodMgr().getLastActiveDemodulator();
RGBA4f labelBg(0, 0, 0, 0.35f);
if (isSolo) {
glColor4f(0.8f, 0.8f, 0, 0.35f);
labelBg.r = labelBg.g = 0.8f;
} else if (demod->isMuted()) {
glColor4f(0.8f, 0, 0, 0.35f);
labelBg.r = 0.8f;
} else if (soloMode) {
glColor4f(0.2f, 0, 0, 0.35f);
} else {
glColor4f(0, 0, 0, 0.35f);
labelBg.r = 0.2f;
}
// 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);
glVertex3f(uxPos - ofsLeft, hPos + labelHeight, 0.0);
@ -167,7 +175,11 @@ void PrimaryGLContext::DrawDemodInfo(DemodulatorInstancePtr demod, RGBA4f color,
if (demod->isDeltaLock()) {
demodLabel.append(" [V]");
}
if (isRecording) {
demodLabel.append(" [R]");
}
if (demod->getDemodulatorType() == "USB") {
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") {