diff --git a/src/AppFrame.cpp b/src/AppFrame.cpp index 9e86fba..071d554 100644 --- a/src/AppFrame.cpp +++ b/src/AppFrame.cpp @@ -255,15 +255,9 @@ AppFrame::AppFrame() : menuBar->Append(menu, wxT("&File")); - menu = new wxMenu; - - menu->Append(wxID_SET_FREQ_OFFSET, "Frequency Offset"); - menu->Append(wxID_SET_PPM, "Device PPM"); - - agcMenuItem = menu->AppendCheckItem(wxID_AGC_CONTROL, "Automatic Gain"); - agcMenuItem->Check(wxGetApp().getAGCMode()); - - menuBar->Append(menu, wxT("&Settings")); + settingsMenu = new wxMenu; + + menuBar->Append(settingsMenu, wxT("&Settings")); menu = new wxMenu; @@ -434,7 +428,62 @@ void AppFrame::updateDeviceParams() { return; } - // Build sample rate menu from device info + + // Build settings menu + wxMenu *newSettingsMenu = new wxMenu; + newSettingsMenu->Append(wxID_SET_FREQ_OFFSET, "Frequency Offset"); + if (devInfo->getRxChannel()->hasCORR()) { + newSettingsMenu->Append(wxID_SET_PPM, "Device PPM"); + } + + agcMenuItem = newSettingsMenu->AppendCheckItem(wxID_AGC_CONTROL, "Automatic Gain"); + agcMenuItem->Check(wxGetApp().getAGCMode()); + + SoapySDR::ArgInfoList args = devInfo->getSettingsArgInfo(); + SoapySDR::ArgInfoList::const_iterator args_i; + + int i = 0; + for (args_i = args.begin(); args_i != args.end(); args_i++) { + SoapySDR::ArgInfo arg = (*args_i); + if (arg.type == SoapySDR::ArgInfo::BOOL) { + wxMenuItem *item = newSettingsMenu->AppendCheckItem(wxID_SETTINGS_BASE+i, arg.name, arg.description); + item->Check(arg.value=="true"); + i++; + } else if (arg.type == SoapySDR::ArgInfo::INT) { + wxMenuItem *item = newSettingsMenu->Append(wxID_SETTINGS_BASE+i, arg.name, arg.description); + i++; + } else if (arg.type == SoapySDR::ArgInfo::FLOAT) { + wxMenuItem *item = newSettingsMenu->Append(wxID_SETTINGS_BASE+i, arg.name, arg.description); + i++; + } else if (arg.type == SoapySDR::ArgInfo::STRING) { + if (arg.options.size()) { + wxMenu *subMenu = new wxMenu; + int j = 0; + for (std::vector::iterator str_i = arg.options.begin(); str_i != arg.options.end(); str_i++) { + std::string optName = (*str_i); + std::string displayName = optName; + if (arg.optionNames.size()) { + displayName = arg.optionNames[j]; + } + wxMenuItem *item = subMenu->AppendRadioItem(wxID_SETTINGS_BASE+i, displayName); + if (arg.value == (*str_i)) { + item->Check(); + } + i++; + j++; + } + newSettingsMenu->AppendSubMenu(subMenu, arg.name, arg.description); + } else { + wxMenuItem *item = newSettingsMenu->Append(wxID_SETTINGS_BASE+i, arg.name, arg.description); + i++; + } + } + } + + menuBar->Replace(1, newSettingsMenu, wxT("&Settings")); + settingsMenu = newSettingsMenu; + + // Build sample rate menu sampleRates = devInfo->getRxChannel()->getSampleRates(); sampleRateMenuItems.erase(sampleRateMenuItems.begin(),sampleRateMenuItems.end()); diff --git a/src/AppFrame.h b/src/AppFrame.h index 596735b..5f17df4 100644 --- a/src/AppFrame.h +++ b/src/AppFrame.h @@ -45,6 +45,8 @@ #define wxID_BANDWIDTH_BASE 2150 #define wxID_BANDWIDTH_MANUAL 2200 +#define wxID_SETTINGS_BASE 2300 + #define wxID_DEVICE_ID 3500 #define wxID_AUDIO_BANDWIDTH_BASE 9000 @@ -104,6 +106,7 @@ private: wxMenuBar *menuBar; wxMenu *sampleRateMenu; wxMenuItem *agcMenuItem; + wxMenu *settingsMenu; std::vector sampleRates; std::string currentSessionFile; diff --git a/src/forms/SDRDevices/SDRDevices.cpp b/src/forms/SDRDevices/SDRDevices.cpp index a158201..9595ff6 100644 --- a/src/forms/SDRDevices/SDRDevices.cpp +++ b/src/forms/SDRDevices/SDRDevices.cpp @@ -63,10 +63,17 @@ wxPGProperty *SDRDevicesDialog::addArgInfoProperty(wxPropertyGrid *pg, SoapySDR: intVal = 0; prop = pg->Append( new wxEnumProperty(arg.name, wxPG_LABEL) ); for (stringIter = arg.options.begin(); stringIter != arg.options.end(); stringIter++) { - prop->AddChoice((*stringIter)); + std::string optName = (*stringIter); + std::string displayName = optName; + if (arg.optionNames.size()) { + displayName = arg.optionNames[intVal]; + } + + prop->AddChoice(displayName); if ((*stringIter)==arg.value) { prop->SetChoiceSelection(intVal); } + intVal++; } } else { diff --git a/src/process/ScopeVisualProcessor.cpp b/src/process/ScopeVisualProcessor.cpp index baaf566..dad6a03 100644 --- a/src/process/ScopeVisualProcessor.cpp +++ b/src/process/ScopeVisualProcessor.cpp @@ -81,7 +81,7 @@ void ScopeVisualProcessor::process() { renderData->channels = audioInputData->channels; renderData->inputRate = audioInputData->inputRate; renderData->sampleRate = audioInputData->sampleRate; - + if (renderData->waveform_points.size() != iMax * 2) { renderData->waveform_points.resize(iMax * 2); } @@ -112,7 +112,6 @@ void ScopeVisualProcessor::process() { } renderData->spectrum = false; - distribute(renderData); } @@ -137,7 +136,14 @@ void ScopeVisualProcessor::process() { } } } + + renderData = outputBuffers.getBuffer(); + renderData->channels = audioInputData->channels; + renderData->inputRate = audioInputData->inputRate; + renderData->sampleRate = audioInputData->sampleRate; + + audioInputData->decRefCount(); fftwf_execute(fftw_plan); @@ -175,12 +181,10 @@ void ScopeVisualProcessor::process() { int outSize = fftSize/2; - if (audioInputData->sampleRate != audioInputData->inputRate) { - outSize = (int)floor((float)outSize * ((float)audioInputData->sampleRate/(float)audioInputData->inputRate)); + if (renderData->sampleRate != renderData->inputRate) { + outSize = (int)floor((float)outSize * ((float)renderData->sampleRate/(float)renderData->inputRate)); } - renderData = outputBuffers.getBuffer(); - if (renderData->waveform_points.size() != outSize*2) { renderData->waveform_points.resize(outSize*2); } @@ -194,12 +198,10 @@ void ScopeVisualProcessor::process() { renderData->fft_floor = fft_floor_maa; renderData->fft_ceil = fft_ceil_maa; renderData->fft_size = fftSize/2; - renderData->inputRate = audioInputData->inputRate; - renderData->sampleRate = audioInputData->sampleRate; renderData->spectrum = true; distribute(renderData); + } else { + audioInputData->decRefCount(); } - - audioInputData->decRefCount(); } }