mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2025-07-31 04:42:25 -04:00
Add start/stop device to menu
This commit is contained in:
parent
3df7461a15
commit
05a3e74645
@ -321,6 +321,8 @@ AppFrame::AppFrame() :
|
|||||||
|
|
||||||
menu->Append(wxID_SDR_DEVICES, "SDR Devices");
|
menu->Append(wxID_SDR_DEVICES, "SDR Devices");
|
||||||
menu->AppendSeparator();
|
menu->AppendSeparator();
|
||||||
|
menu->Append(wxID_SDR_START_STOP, "Stop / Start Device");
|
||||||
|
menu->AppendSeparator();
|
||||||
menu->Append(wxID_OPEN, "&Open Session");
|
menu->Append(wxID_OPEN, "&Open Session");
|
||||||
menu->Append(wxID_SAVE, "&Save Session");
|
menu->Append(wxID_SAVE, "&Save Session");
|
||||||
menu->Append(wxID_SAVEAS, "Save Session &As..");
|
menu->Append(wxID_SAVEAS, "Save Session &As..");
|
||||||
@ -755,9 +757,22 @@ void AppFrame::OnMenu(wxCommandEvent& event) {
|
|||||||
activeDemodulator->setOutputDevice(event.GetId() - wxID_RT_AUDIO_DEVICE);
|
activeDemodulator->setOutputDevice(event.GetId() - wxID_RT_AUDIO_DEVICE);
|
||||||
activeDemodulator = NULL;
|
activeDemodulator = NULL;
|
||||||
}
|
}
|
||||||
} else if (event.GetId() == wxApp::s_macAboutMenuItemId) {
|
}
|
||||||
|
#ifdef __APPLE__
|
||||||
|
else if (event.GetId() == wxApp::s_macAboutMenuItemId) {
|
||||||
wxMessageDialog *aboutDlg = new wxMessageDialog(NULL, wxT("CubicSDR v" CUBICSDR_VERSION "\nby Charles J. Cliffe (@ccliffe)\nwww.cubicsdr.com"), wxT("CubicSDR v" CUBICSDR_VERSION), wxOK);
|
wxMessageDialog *aboutDlg = new wxMessageDialog(NULL, wxT("CubicSDR v" CUBICSDR_VERSION "\nby Charles J. Cliffe (@ccliffe)\nwww.cubicsdr.com"), wxT("CubicSDR v" CUBICSDR_VERSION), wxOK);
|
||||||
aboutDlg->ShowModal();
|
aboutDlg->ShowModal();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
else if (event.GetId() == wxID_SDR_START_STOP) {
|
||||||
|
if (!wxGetApp().getSDRThread()->isTerminated()) {
|
||||||
|
wxGetApp().stopDevice(true);
|
||||||
|
} else {
|
||||||
|
SDRDeviceInfo *dev = wxGetApp().getDevice();
|
||||||
|
if (dev != nullptr) {
|
||||||
|
wxGetApp().setDevice(dev);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (event.GetId() == wxID_SET_TIPS ) {
|
} else if (event.GetId() == wxID_SET_TIPS ) {
|
||||||
if (wxGetApp().getConfig()->getShowTips()) {
|
if (wxGetApp().getConfig()->getShowTips()) {
|
||||||
wxGetApp().getConfig()->setShowTips(false);
|
wxGetApp().getConfig()->setShowTips(false);
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#define wxID_SET_IQSWAP 2005
|
#define wxID_SET_IQSWAP 2005
|
||||||
#define wxID_SDR_DEVICES 2008
|
#define wxID_SDR_DEVICES 2008
|
||||||
#define wxID_AGC_CONTROL 2009
|
#define wxID_AGC_CONTROL 2009
|
||||||
|
#define wxID_SDR_START_STOP 2010
|
||||||
|
|
||||||
#define wxID_MAIN_SPLITTER 2050
|
#define wxID_MAIN_SPLITTER 2050
|
||||||
#define wxID_VIS_SPLITTER 2051
|
#define wxID_VIS_SPLITTER 2051
|
||||||
|
@ -136,6 +136,7 @@ CubicSDR::CubicSDR() : appframe(NULL), m_glContext(NULL), frequency(0), offset(0
|
|||||||
agcMode.store(true);
|
agcMode.store(true);
|
||||||
soloMode.store(false);
|
soloMode.store(false);
|
||||||
fdlgTarget = FrequencyDialog::FDIALOG_TARGET_DEFAULT;
|
fdlgTarget = FrequencyDialog::FDIALOG_TARGET_DEFAULT;
|
||||||
|
stoppedDev = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CubicSDR::OnInit() {
|
bool CubicSDR::OnInit() {
|
||||||
@ -498,7 +499,12 @@ void CubicSDR::setSampleRate(long long rate_in) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CubicSDR::stopDevice() {
|
void CubicSDR::stopDevice(bool store) {
|
||||||
|
if (store) {
|
||||||
|
stoppedDev = sdrThread->getDevice();
|
||||||
|
} else {
|
||||||
|
stoppedDev = nullptr;
|
||||||
|
}
|
||||||
sdrThread->setDevice(nullptr);
|
sdrThread->setDevice(nullptr);
|
||||||
|
|
||||||
if (!sdrThread->isTerminated()) {
|
if (!sdrThread->isTerminated()) {
|
||||||
@ -565,9 +571,15 @@ void CubicSDR::setDevice(SDRDeviceInfo *dev) {
|
|||||||
|
|
||||||
t_SDR = new std::thread(&SDRThread::threadMain, sdrThread);
|
t_SDR = new std::thread(&SDRThread::threadMain, sdrThread);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stoppedDev = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDRDeviceInfo *CubicSDR::getDevice() {
|
SDRDeviceInfo *CubicSDR::getDevice() {
|
||||||
|
if (!sdrThread->getDevice() && stoppedDev) {
|
||||||
|
return stoppedDev;
|
||||||
|
}
|
||||||
|
|
||||||
return sdrThread->getDevice();
|
return sdrThread->getDevice();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ public:
|
|||||||
|
|
||||||
std::vector<SDRDeviceInfo *> *getDevices();
|
std::vector<SDRDeviceInfo *> *getDevices();
|
||||||
void setDevice(SDRDeviceInfo *dev);
|
void setDevice(SDRDeviceInfo *dev);
|
||||||
void stopDevice();
|
void stopDevice(bool store);
|
||||||
SDRDeviceInfo * getDevice();
|
SDRDeviceInfo * getDevice();
|
||||||
|
|
||||||
ScopeVisualProcessor *getScopeProcessor();
|
ScopeVisualProcessor *getScopeProcessor();
|
||||||
@ -216,6 +216,7 @@ private:
|
|||||||
FrequencyDialog::FrequencyDialogTarget fdlgTarget;
|
FrequencyDialog::FrequencyDialogTarget fdlgTarget;
|
||||||
std::string activeGain;
|
std::string activeGain;
|
||||||
std::atomic_bool soloMode;
|
std::atomic_bool soloMode;
|
||||||
|
SDRDeviceInfo *stoppedDev;
|
||||||
#ifdef USE_HAMLIB
|
#ifdef USE_HAMLIB
|
||||||
RigThread *rigThread;
|
RigThread *rigThread;
|
||||||
std::thread *t_Rig;
|
std::thread *t_Rig;
|
||||||
|
@ -443,7 +443,7 @@ void SDRDevicesDialog::doRefreshDevices() {
|
|||||||
editId = nullptr;
|
editId = nullptr;
|
||||||
removeId = nullptr;
|
removeId = nullptr;
|
||||||
dev = nullptr;
|
dev = nullptr;
|
||||||
wxGetApp().stopDevice();
|
wxGetApp().stopDevice(false);
|
||||||
devTree->DeleteAllItems();
|
devTree->DeleteAllItems();
|
||||||
devTree->Disable();
|
devTree->Disable();
|
||||||
m_propertyGrid->Clear();
|
m_propertyGrid->Clear();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user