Settings now added to settings menu, not yet functional..

- Also possible re-ordering fix for scope visual crash I have
occasionally
This commit is contained in:
Charles J. Cliffe 2015-11-03 19:58:42 -05:00
parent bcc5f8560f
commit c7ecc5f1f6
4 changed files with 82 additions and 21 deletions

View File

@ -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<std::string>::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());

View File

@ -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<long> sampleRates;
std::string currentSessionFile;

View File

@ -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 {

View File

@ -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();
}
}