mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2025-09-05 14:47:52 -04:00
merge soapysdr-support fixes
This commit is contained in:
commit
57f492dee6
@ -236,7 +236,7 @@ AppFrame::AppFrame() :
|
|||||||
// SetIcon(wxICON(sample));
|
// SetIcon(wxICON(sample));
|
||||||
|
|
||||||
// Make a menubar
|
// Make a menubar
|
||||||
wxMenuBar *menuBar = new wxMenuBar;
|
menuBar = new wxMenuBar;
|
||||||
wxMenu *menu = new wxMenu;
|
wxMenu *menu = new wxMenu;
|
||||||
|
|
||||||
menu->Append(wxID_SDR_DEVICES, "SDR Devices");
|
menu->Append(wxID_SDR_DEVICES, "SDR Devices");
|
||||||
@ -307,9 +307,6 @@ AppFrame::AppFrame() :
|
|||||||
|
|
||||||
menuBar->Append(menu, wxT("&Color Scheme"));
|
menuBar->Append(menu, wxT("&Color Scheme"));
|
||||||
|
|
||||||
sampleRateMenu = new wxMenu;
|
|
||||||
menuBar->Append(sampleRateMenu, wxT("&Input Bandwidth"));
|
|
||||||
|
|
||||||
menu = new wxMenu;
|
menu = new wxMenu;
|
||||||
|
|
||||||
#define NUM_RATES_DEFAULT 4
|
#define NUM_RATES_DEFAULT 4
|
||||||
@ -358,6 +355,10 @@ AppFrame::AppFrame() :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sampleRateMenu = new wxMenu;
|
||||||
|
|
||||||
|
menuBar->Append(sampleRateMenu, wxT("&Input Bandwidth"));
|
||||||
|
|
||||||
menuBar->Append(menu, wxT("Audio &Bandwidth"));
|
menuBar->Append(menu, wxT("Audio &Bandwidth"));
|
||||||
|
|
||||||
SetMenuBar(menuBar);
|
SetMenuBar(menuBar);
|
||||||
@ -407,7 +408,8 @@ AppFrame::AppFrame() :
|
|||||||
|
|
||||||
wxAcceleratorTable accel(3, entries);
|
wxAcceleratorTable accel(3, entries);
|
||||||
SetAcceleratorTable(accel);
|
SetAcceleratorTable(accel);
|
||||||
|
deviceChanged.store(false);
|
||||||
|
devInfo = NULL;
|
||||||
wxGetApp().deviceSelector();
|
wxGetApp().deviceSelector();
|
||||||
|
|
||||||
// static const int attribs[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, 0 };
|
// static const int attribs[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, 0 };
|
||||||
@ -421,24 +423,26 @@ AppFrame::~AppFrame() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AppFrame::initDeviceParams(SDRDeviceInfo *devInfo) {
|
void AppFrame::initDeviceParams(SDRDeviceInfo *devInfo) {
|
||||||
std::string deviceId = devInfo->getName();
|
this->devInfo = devInfo;
|
||||||
|
deviceChanged.store(true);
|
||||||
|
}
|
||||||
|
|
||||||
DeviceConfig *devConfig = wxGetApp().getConfig()->getDevice(deviceId);
|
void AppFrame::updateDeviceParams() {
|
||||||
|
|
||||||
|
if (!deviceChanged.load()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Build sample rate menu from device info
|
// Build sample rate menu from device info
|
||||||
sampleRates = devInfo->getRxChannel()->getSampleRates();
|
sampleRates = devInfo->getRxChannel()->getSampleRates();
|
||||||
|
|
||||||
for (std::map<int, wxMenuItem *>::iterator i = sampleRateMenuItems.begin(); i != sampleRateMenuItems.end(); i++) {
|
|
||||||
sampleRateMenu->Remove(i->first);
|
|
||||||
}
|
|
||||||
|
|
||||||
sampleRateMenuItems.erase(sampleRateMenuItems.begin(),sampleRateMenuItems.end());
|
sampleRateMenuItems.erase(sampleRateMenuItems.begin(),sampleRateMenuItems.end());
|
||||||
|
|
||||||
|
wxMenu *newSampleRateMenu = new wxMenu;
|
||||||
int ofs = 0;
|
int ofs = 0;
|
||||||
long sampleRate = wxGetApp().getSampleRate();
|
long sampleRate = wxGetApp().getSampleRate();
|
||||||
bool checked = false;
|
bool checked = false;
|
||||||
for (vector<long>::iterator i = sampleRates.begin(); i != sampleRates.end(); i++) {
|
for (vector<long>::iterator i = sampleRates.begin(); i != sampleRates.end(); i++) {
|
||||||
sampleRateMenuItems[wxID_BANDWIDTH_BASE+ofs] = sampleRateMenu->AppendRadioItem(wxID_BANDWIDTH_BASE+ofs, frequencyToStr(*i));
|
sampleRateMenuItems[wxID_BANDWIDTH_BASE+ofs] = newSampleRateMenu->AppendRadioItem(wxID_BANDWIDTH_BASE+ofs, frequencyToStr(*i));
|
||||||
if (sampleRate == (*i)) {
|
if (sampleRate == (*i)) {
|
||||||
sampleRateMenuItems[wxID_BANDWIDTH_BASE+ofs]->Check(true);
|
sampleRateMenuItems[wxID_BANDWIDTH_BASE+ofs]->Check(true);
|
||||||
checked = true;
|
checked = true;
|
||||||
@ -446,12 +450,14 @@ void AppFrame::initDeviceParams(SDRDeviceInfo *devInfo) {
|
|||||||
ofs++;
|
ofs++;
|
||||||
}
|
}
|
||||||
|
|
||||||
sampleRateMenuItems[wxID_BANDWIDTH_MANUAL] = sampleRateMenu->AppendRadioItem(wxID_BANDWIDTH_MANUAL, "Manual Entry");
|
sampleRateMenuItems[wxID_BANDWIDTH_MANUAL] = newSampleRateMenu->AppendRadioItem(wxID_BANDWIDTH_MANUAL, wxT("Manual Entry"));
|
||||||
|
|
||||||
if (!checked) {
|
if (!checked) {
|
||||||
sampleRateMenuItems[wxID_BANDWIDTH_MANUAL]->Check(true);
|
sampleRateMenuItems[wxID_BANDWIDTH_MANUAL]->Check(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
menuBar->Replace(4, newSampleRateMenu, wxT("&Input Bandwidth"));
|
||||||
|
sampleRateMenu = newSampleRateMenu;
|
||||||
|
|
||||||
if (!wxGetApp().getAGCMode()) {
|
if (!wxGetApp().getAGCMode()) {
|
||||||
gainSpacerItem->Show(true);
|
gainSpacerItem->Show(true);
|
||||||
gainSizerItem->Show(true);
|
gainSizerItem->Show(true);
|
||||||
@ -467,6 +473,8 @@ void AppFrame::initDeviceParams(SDRDeviceInfo *devInfo) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
agcMenuItem->Check(wxGetApp().getAGCMode());
|
agcMenuItem->Check(wxGetApp().getAGCMode());
|
||||||
|
|
||||||
|
deviceChanged.store(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -703,6 +711,10 @@ void AppFrame::OnThread(wxCommandEvent& event) {
|
|||||||
|
|
||||||
void AppFrame::OnIdle(wxIdleEvent& event) {
|
void AppFrame::OnIdle(wxIdleEvent& event) {
|
||||||
|
|
||||||
|
if (deviceChanged.load()) {
|
||||||
|
updateDeviceParams();
|
||||||
|
}
|
||||||
|
|
||||||
DemodulatorInstance *demod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
DemodulatorInstance *demod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
||||||
|
|
||||||
if (demod) {
|
if (demod) {
|
||||||
|
@ -59,6 +59,7 @@ public:
|
|||||||
void OnThread(wxCommandEvent& event);
|
void OnThread(wxCommandEvent& event);
|
||||||
void OnEventInput(wxThreadEvent& event);
|
void OnEventInput(wxThreadEvent& event);
|
||||||
void initDeviceParams(SDRDeviceInfo *devInfo);
|
void initDeviceParams(SDRDeviceInfo *devInfo);
|
||||||
|
void updateDeviceParams();
|
||||||
|
|
||||||
void saveSession(std::string fileName);
|
void saveSession(std::string fileName);
|
||||||
bool loadSession(std::string fileName);
|
bool loadSession(std::string fileName);
|
||||||
@ -100,7 +101,7 @@ private:
|
|||||||
std::map<int, wxMenuItem *> sampleRateMenuItems;
|
std::map<int, wxMenuItem *> sampleRateMenuItems;
|
||||||
std::map<int, wxMenuItem *> audioSampleRateMenuItems;
|
std::map<int, wxMenuItem *> audioSampleRateMenuItems;
|
||||||
std::map<int, wxMenuItem *> directSamplingMenuItems;
|
std::map<int, wxMenuItem *> directSamplingMenuItems;
|
||||||
// wxMenuItem *iqSwapMenuItem;
|
wxMenuBar *menuBar;
|
||||||
wxMenu *sampleRateMenu;
|
wxMenu *sampleRateMenu;
|
||||||
wxMenuItem *agcMenuItem;
|
wxMenuItem *agcMenuItem;
|
||||||
std::vector<long> sampleRates;
|
std::vector<long> sampleRates;
|
||||||
@ -110,6 +111,8 @@ private:
|
|||||||
FFTVisualDataThread *waterfallDataThread;
|
FFTVisualDataThread *waterfallDataThread;
|
||||||
|
|
||||||
std::thread *t_FFTData;
|
std::thread *t_FFTData;
|
||||||
|
SDRDeviceInfo *devInfo;
|
||||||
|
std::atomic_bool deviceChanged;
|
||||||
|
|
||||||
wxDECLARE_EVENT_TABLE();
|
wxDECLARE_EVENT_TABLE();
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user