Solo mode :)

This commit is contained in:
Charles J. Cliffe 2016-02-11 01:09:15 -05:00
parent 5a26669832
commit 16ba35a892
6 changed files with 64 additions and 4 deletions

View File

@ -174,6 +174,18 @@ AppFrame::AppFrame() :
demodGainMeter->SetMinSize(wxSize(12,24));
demodGainTray->Add(demodGainMeter, 8, wxEXPAND | wxALL, 0);
demodGainTray->AddSpacer(1);
soloModeButton = new ModeSelectorCanvas(demodPanel, attribList);
soloModeButton->addChoice(1, "S");
soloModeButton->setPadding(-1,-1);
soloModeButton->setHighlightColor(RGBA4f(0.8,0.8,0.2));
soloModeButton->setHelpTip("Solo Mode Toggle");
soloModeButton->setToggleMode(true);
soloModeButton->setSelection(-1);
soloModeButton->SetMinSize(wxSize(12,28));
demodGainTray->Add(soloModeButton, 1, wxEXPAND | wxALL, 0);
demodGainTray->AddSpacer(1);
@ -184,7 +196,7 @@ AppFrame::AppFrame() :
demodMuteButton->setHelpTip("Demodulator Mute Toggle");
demodMuteButton->setToggleMode(true);
demodMuteButton->setSelection(-1);
demodMuteButton->SetMinSize(wxSize(12,24));
demodMuteButton->SetMinSize(wxSize(12,28));
demodGainTray->Add(demodMuteButton, 1, wxEXPAND | wxALL, 0);
@ -1129,8 +1141,24 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
demodMuteButton->setSelection(-1);
wxGetApp().getDemodMgr().setLastMuted(demod->isMuted());
}
demodMuteButton->Refresh();
}
int soloMode = soloModeButton->getSelection();
if (soloModeButton->modeChanged()) {
if (soloMode == 1) {
wxGetApp().setSoloMode(true);
} else {
wxGetApp().setSoloMode(false);
}
soloModeButton->clearModeChanged();
} else {
if (wxGetApp().getSoloMode() != (soloMode==1)) {
soloModeButton->setSelection(wxGetApp().getSoloMode()?1:-1);
soloModeButton->Refresh();
}
}
demodWaterfallCanvas->setBandwidth(demodBw);
demodSpectrumCanvas->setBandwidth(demodBw);
}
@ -1599,6 +1627,7 @@ int AppFrame::OnGlobalKeyDown(wxKeyEvent &event) {
case 'F':
case 'L':
case 'U':
case 'S':
return 1;
case '0':
case '1':
@ -1665,6 +1694,7 @@ int AppFrame::OnGlobalKeyUp(wxKeyEvent &event) {
return 1;
case 'A':
demodModeSelector->setSelection("AM");
return 1;
break;
case 'F':
if (demodModeSelector->getSelectionLabel() == "FM") {
@ -1672,12 +1702,19 @@ int AppFrame::OnGlobalKeyUp(wxKeyEvent &event) {
} else {
demodModeSelector->setSelection("FM");
}
return 1;
break;
case 'L':
demodModeSelector->setSelection("LSB");
return 1;
break;
case 'U':
demodModeSelector->setSelection("USB");
return 1;
break;
case 'S':
wxGetApp().setSoloMode(!wxGetApp().getSoloMode());
return 1;
break;
default:
break;

View File

@ -109,7 +109,7 @@ private:
// UITestCanvas *testCanvas;
MeterCanvas *spectrumAvgMeter;
MeterCanvas *waterfallSpeedMeter;
ModeSelectorCanvas *demodMuteButton, *peakHoldButton;
ModeSelectorCanvas *demodMuteButton, *peakHoldButton, *soloModeButton;
GainCanvas *gainCanvas;
wxSizerItem *gainSizerItem, *gainSpacerItem;
wxSplitterWindow *mainVisSplitter, *mainSplitter;

View File

@ -134,6 +134,7 @@ CubicSDR::CubicSDR() : appframe(NULL), m_glContext(NULL), frequency(0), offset(0
sdrThread(NULL), sdrPostThread(NULL), spectrumVisualThread(NULL), demodVisualThread(NULL), pipeSDRIQData(NULL), pipeIQVisualData(NULL), pipeAudioVisualData(NULL), t_SDR(NULL), t_PostSDR(NULL) {
sampleRateInitialized.store(false);
agcMode.store(true);
soloMode.store(false);
fdlgTarget = FrequencyDialog::FDIALOG_TARGET_DEFAULT;
}
@ -772,6 +773,14 @@ std::string CubicSDR::getActiveGainEntry() {
return activeGain;
}
void CubicSDR::setSoloMode(bool solo) {
soloMode.store(solo);
}
bool CubicSDR::getSoloMode() {
return soloMode.load();
}
int CubicSDR::FilterEvent(wxEvent& event) {
if (!appframe) {
return -1;

View File

@ -156,6 +156,9 @@ public:
void setActiveGainEntry(std::string gainName);
std::string getActiveGainEntry();
void setSoloMode(bool solo);
bool getSoloMode();
#ifdef USE_HAMLIB
RigThread *getRigThread();
void initRig(int rigModel, std::string rigPort, int rigSerialRate);
@ -212,6 +215,7 @@ private:
std::atomic_llong lock_freq;
FrequencyDialog::FrequencyDialogTarget fdlgTarget;
std::string activeGain;
std::atomic_bool soloMode;
#ifdef USE_HAMLIB
RigThread *rigThread;
std::thread *t_Rig;

View File

@ -1,6 +1,7 @@
#include "CubicSDRDefs.h"
#include "DemodulatorThread.h"
#include "DemodulatorInstance.h"
#include "CubicSDR.h"
#include <vector>
#include <cmath>
@ -222,7 +223,7 @@ void DemodulatorThread::run() {
if (ati != NULL) {
if (!muted.load()) {
if (!muted.load() && (!wxGetApp().getSoloMode() || (demodInstance == wxGetApp().getDemodMgr().getLastActiveDemodulator()))) {
audioOutputQueue->push(ati);
} else {
ati->setRefCount(0);

View File

@ -94,8 +94,15 @@ void PrimaryGLContext::DrawDemodInfo(DemodulatorInstance *demod, RGBA4f color, l
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
if (demod->isMuted()) {
bool soloMode = wxGetApp().getSoloMode();
bool isSolo = soloMode && demod == wxGetApp().getDemodMgr().getLastActiveDemodulator();
if (isSolo) {
glColor4f(0.8, 0.8, 0, 0.35);
} else if (demod->isMuted()) {
glColor4f(0.8, 0, 0, 0.35);
} else if (soloMode) {
glColor4f(0.2, 0, 0, 0.35);
} else {
glColor4f(0, 0, 0, 0.35);
}
@ -137,6 +144,8 @@ void PrimaryGLContext::DrawDemodInfo(DemodulatorInstance *demod, RGBA4f color, l
if (demod->isMuted()) {
demodLabel = std::string("[M] ") + demodLabel;
} else if (isSolo) {
demodLabel = std::string("[S] ") + demodLabel;
}
if (demod->getDemodulatorType() == "USB") {