Commit 683a207e authored by Andreas Bombe's avatar Andreas Bombe

New upstream version 0.2.4+dfsg

parent 5c6e0ed7
......@@ -6,7 +6,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
SET(CUBICSDR_VERSION_MAJOR "0")
SET(CUBICSDR_VERSION_MINOR "2")
SET(CUBICSDR_VERSION_PATCH "3")
SET(CUBICSDR_VERSION_PATCH "4")
SET(CUBICSDR_VERSION_SUFFIX "")
SET(CUBICSDR_VERSION "${CUBICSDR_VERSION_MAJOR}.${CUBICSDR_VERSION_MINOR}.${CUBICSDR_VERSION_PATCH}${CUBICSDR_VERSION_SUFFIX}")
......
......@@ -22,7 +22,7 @@ Utilizes:
Optional Libs:
--------
- FFTW3 (can be compiled into liquid-dsp if desired) (http://www.fftw.org/ -- https://github.com/FFTW/fftw3)
- hamlib (https://sourceforge.net/p/hamlib/wiki/Hamlib/ -- https://sourceforge.net/p/hamlib/code/ci/master/tree/)
- hamlib (https://github.com/Hamlib/Hamlib)
Features and Status:
--------------------
......
......@@ -88,10 +88,10 @@ AppFrame::AppFrame() :
wxBoxSizer *demodScopeTray = new wxBoxSizer(wxVERTICAL);
wxBoxSizer *demodTunerTray = new wxBoxSizer(wxHORIZONTAL);
std::vector<int> attribList = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, 0 };
//wxGLAttributes attribList;
//attribList.PlatformDefaults().RGBA().DoubleBuffer().EndList();
//attribList.PlatformDefaults().MinRGBA(8, 8, 8, 8).DoubleBuffer().Depth(16).EndList();
// OpenGL settings:
//deprecated format: std::vector<int> attribList = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, 0 };
wxGLAttributes attribList;
attribList.PlatformDefaults().RGBA().MinRGBA(8, 8, 8, 8).DoubleBuffer().EndList();
mainSplitter = new wxSplitterWindow( this, wxID_MAIN_SPLITTER, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH | wxSP_LIVE_UPDATE );
mainSplitter->SetSashGravity(10.0f / 37.0f);
......@@ -2971,26 +2971,28 @@ void AppFrame::toggleAllActiveDemodRecording() {
return;
}
auto activeDemods = wxGetApp().getDemodMgr().getDemodulators();
// All demods, irrespective of their active state:
// recording will start eventually when a demod come in range.
auto allDemods = wxGetApp().getDemodMgr().getDemodulators();
//by default, do a false => true for all:
bool stateToSet = true;
for (auto i : activeDemods) {
if (i->isActive() && i->isRecording()) {
for (auto i : allDemods) {
if (i->isRecording()) {
stateToSet = false;
break;
}
}
for (auto i : activeDemods) {
if (i->isActive() && i->isRecording() != stateToSet) {
i->setRecording(stateToSet);
}
for (auto i : allDemods) {
i->setRecording(stateToSet);
}
//this effectively refresh the BookmarkView buttons, including Recording buttons.
wxGetApp().getBookmarkMgr().updateActiveList();
}
void AppFrame::setWaterfallLinesPerSecond(int lps) {
waterfallSpeedMeter->setUserInputValue(sqrt(lps));
}
......
......@@ -15,12 +15,11 @@ BookmarkEntry::~BookmarkEntry() {
BookmarkMgr::BookmarkMgr() {
rangesSorted = false;
}
//represents an empty BookMarkList that is returned by reference by some functions.
const BookmarkList BookmarkMgr::emptyResults;
//
void BookmarkMgr::saveToFile(std::string bookmarkFn, bool backup, bool useFullpath) {
std::lock_guard < std::recursive_mutex > lock(busy_lock);
DataTree s("cubicsdr_bookmarks");
DataNode *header = s.rootNode()->newChild("header");
header->newChild("version")->element()->set(wxString(CUBICSDR_VERSION).ToStdWstring());
......@@ -100,6 +99,8 @@ void BookmarkMgr::saveToFile(std::string bookmarkFn, bool backup, bool useFullpa
}
bool BookmarkMgr::loadFromFile(std::string bookmarkFn, bool backup, bool useFullpath) {
std::lock_guard < std::recursive_mutex > lock(busy_lock);
wxFileName loadFile;
wxFileName failFile;
......@@ -129,7 +130,7 @@ bool BookmarkMgr::loadFromFile(std::string bookmarkFn, bool backup, bool useFull
// New instance of bookmark savefiles
if (backup && !loadFile.FileExists() && !lastLoaded.FileExists() && !backupFile.FileExists()) {
wxGetApp().getAppFrame()->getBookmarkView()->loadDefaultRanges();
loadDefaultRanges();
return true;
}
......@@ -145,8 +146,8 @@ bool BookmarkMgr::loadFromFile(std::string bookmarkFn, bool backup, bool useFull
// Clear any active data
bmData.clear();
clearRecents();
clearRanges();
recents.clear();
ranges.clear();
bmDataSorted.clear();
if (s.rootNode()->hasAnother("branches")) {
......@@ -238,15 +239,31 @@ bool BookmarkMgr::loadFromFile(std::string bookmarkFn, bool backup, bool useFull
return loadStatusOk;
}
void BookmarkMgr::loadDefaultRanges() {
addRange(std::make_shared<BookmarkRangeEntry>(L"160 Meters", 1900000, 1800000, 2000000));
addRange(std::make_shared<BookmarkRangeEntry>(L"80 Meters", 3750000, 3500000, 4000000));
addRange(std::make_shared<BookmarkRangeEntry>(L"60 Meters", 5368500, 5332000, 5405000));
addRange(std::make_shared<BookmarkRangeEntry>(L"40 Meters", 7150000, 7000000, 7300000));
addRange(std::make_shared<BookmarkRangeEntry>(L"30 Meters", 10125000, 10100000, 10150000));
addRange(std::make_shared<BookmarkRangeEntry>(L"20 Meters", 14175000, 14000000, 14350000));
addRange(std::make_shared<BookmarkRangeEntry>(L"17 Meters", 18068180, 17044180, 19092180));
addRange(std::make_shared<BookmarkRangeEntry>(L"15 Meters", 21225000, 21000000, 21450000));
addRange(std::make_shared<BookmarkRangeEntry>(L"12 Meters", 24940000, 24890000, 24990000));
addRange(std::make_shared<BookmarkRangeEntry>(L"10 Meters", 28850000, 28000000, 29700000));
}
void BookmarkMgr::resetBookmarks() {
std::lock_guard < std::recursive_mutex > lock(busy_lock);
// Clear any active data
bmData.clear();
clearRecents();
clearRanges();
recents.clear();
ranges.clear();
bmDataSorted.clear();
wxGetApp().getAppFrame()->getBookmarkView()->loadDefaultRanges();
loadDefaultRanges();
}
......@@ -280,9 +297,8 @@ void BookmarkMgr::addBookmark(std::string group, BookmarkEntryPtr be) {
void BookmarkMgr::removeBookmark(std::string group, BookmarkEntryPtr be) {
std::lock_guard < std::recursive_mutex > lockData(busy_lock);
std::lock_guard < std::mutex > lockEnt(be->busy_lock);
std::lock_guard < std::recursive_mutex > lock(busy_lock);
if (bmData.find(group) == bmData.end()) {
return;
}
......@@ -296,8 +312,7 @@ void BookmarkMgr::removeBookmark(std::string group, BookmarkEntryPtr be) {
}
void BookmarkMgr::removeBookmark(BookmarkEntryPtr be) {
std::lock_guard < std::recursive_mutex > lockData(busy_lock);
std::lock_guard < std::mutex > lockEnt(be->busy_lock);
std::lock_guard < std::recursive_mutex > lock(busy_lock);
for (auto &bmd_i : bmData) {
BookmarkList::iterator i = std::find(bmd_i.second.begin(), bmd_i.second.end(), be);
......@@ -308,8 +323,7 @@ void BookmarkMgr::removeBookmark(BookmarkEntryPtr be) {
}
void BookmarkMgr::moveBookmark(BookmarkEntryPtr be, std::string group) {
std::lock_guard < std::recursive_mutex > lockData(busy_lock);
std::lock_guard < std::mutex > lockEnt(be->busy_lock);
std::lock_guard < std::recursive_mutex > lock(busy_lock);
for (auto &bmd_i : bmData) {
BookmarkList::iterator i = std::find(bmd_i.second.begin(), bmd_i.second.end(), be);
......@@ -367,11 +381,11 @@ void BookmarkMgr::renameGroup(std::string group, std::string ngroup) {
}
}
const BookmarkList& BookmarkMgr::getBookmarks(std::string group) {
BookmarkList BookmarkMgr::getBookmarks(std::string group) {
std::lock_guard < std::recursive_mutex > lock(busy_lock);
if (bmData.find(group) == bmData.end()) {
return emptyResults;
return BookmarkList();
}
if (!bmDataSorted[group]) {
......@@ -384,7 +398,7 @@ const BookmarkList& BookmarkMgr::getBookmarks(std::string group) {
void BookmarkMgr::getGroups(BookmarkNames &arr) {
std::lock_guard < std::recursive_mutex > lockData(busy_lock);
std::lock_guard < std::recursive_mutex > lock(busy_lock);
for (BookmarkMap::iterator i = bmData.begin(); i!= bmData.end(); ++i) {
arr.push_back(i->first);
......@@ -392,7 +406,7 @@ void BookmarkMgr::getGroups(BookmarkNames &arr) {
}
void BookmarkMgr::getGroups(wxArrayString &arr) {
std::lock_guard < std::recursive_mutex > lockData(busy_lock);
std::lock_guard < std::recursive_mutex > lock(busy_lock);
for (BookmarkMap::iterator i = bmData.begin(); i!= bmData.end(); ++i) {
arr.push_back(i->first);
......@@ -401,11 +415,16 @@ void BookmarkMgr::getGroups(wxArrayString &arr) {
void BookmarkMgr::setExpandState(std::string groupName, bool state) {
std::lock_guard < std::recursive_mutex > lock(busy_lock);
expandState[groupName] = state;
}
bool BookmarkMgr::getExpandState(std::string groupName) {
std::lock_guard < std::recursive_mutex > lock(busy_lock);
if (expandState.find(groupName) == expandState.end()) {
return true;
}
......@@ -415,8 +434,6 @@ bool BookmarkMgr::getExpandState(std::string groupName) {
void BookmarkMgr::updateActiveList() {
std::lock_guard < std::recursive_mutex > lockData(busy_lock);
if (wxGetApp().isShuttingDown()) {
return;
}
......@@ -430,8 +447,6 @@ void BookmarkMgr::updateActiveList() {
void BookmarkMgr::updateBookmarks() {
std::lock_guard < std::recursive_mutex > lockData(busy_lock);
BookmarkView *bmv = wxGetApp().getAppFrame()->getBookmarkView();
if (bmv) {
......@@ -441,8 +456,6 @@ void BookmarkMgr::updateBookmarks() {
void BookmarkMgr::updateBookmarks(std::string group) {
std::lock_guard < std::recursive_mutex > lockData(busy_lock);
BookmarkView *bmv = wxGetApp().getAppFrame()->getBookmarkView();
if (bmv) {
......@@ -480,9 +493,10 @@ void BookmarkMgr::removeRecent(BookmarkEntryPtr be) {
}
const BookmarkList& BookmarkMgr::getRecents() {
std::lock_guard < std::recursive_mutex > lockData(busy_lock);
return recents;
BookmarkList BookmarkMgr::getRecents() {
std::lock_guard < std::recursive_mutex > lock(busy_lock);
//return a copy
return recents;
}
......@@ -508,8 +522,6 @@ void BookmarkMgr::addRange(BookmarkRangeEntryPtr re) {
rangesSorted = false;
}
void BookmarkMgr::removeRange(BookmarkRangeEntryPtr re) {
std::lock_guard < std::recursive_mutex > lock(busy_lock);
......@@ -522,7 +534,7 @@ void BookmarkMgr::removeRange(BookmarkRangeEntryPtr re) {
}
const BookmarkRangeList& BookmarkMgr::getRanges() {
BookmarkRangeList BookmarkMgr::getRanges() {
std::lock_guard < std::recursive_mutex > lock(busy_lock);
if (!rangesSorted) {
......@@ -610,8 +622,6 @@ std::wstring BookmarkMgr::getActiveDisplayName(DemodulatorInstancePtr demod) {
void BookmarkMgr::removeActive(DemodulatorInstancePtr demod) {
std::lock_guard < std::recursive_mutex > lock(busy_lock);
if (demod == nullptr) {
return;
}
......
......@@ -16,8 +16,7 @@ class DataNode;
class BookmarkEntry {
public:
std::mutex busy_lock;
std::string type;
//maps on the Demod user label.
std::wstring label;
......@@ -38,9 +37,7 @@ public:
}
BookmarkRangeEntry(std::wstring label, long long freq, long long startFreq, long long endFreq) : label(label), freq(freq), startFreq(startFreq), endFreq(endFreq) {
}
std::mutex busy_lock;
std::wstring label;
long long freq;
......@@ -97,7 +94,9 @@ public:
void addGroup(std::string group);
void removeGroup(std::string group);
void renameGroup(std::string group, std::string ngroup);
const BookmarkList& getBookmarks(std::string group);
//return an independent copy on purpose
BookmarkList getBookmarks(std::string group);
void getGroups(BookmarkNames &arr);
void getGroups(wxArrayString &arr);
......@@ -111,22 +110,29 @@ public:
void addRecent(DemodulatorInstancePtr demod);
void addRecent(BookmarkEntryPtr be);
void removeRecent(BookmarkEntryPtr be);
const BookmarkList& getRecents();
//return an independent copy on purpose
BookmarkList getRecents();
void clearRecents();
void removeActive(DemodulatorInstancePtr demod);
void addRange(BookmarkRangeEntryPtr re);
void removeRange(BookmarkRangeEntryPtr re);
const BookmarkRangeList& getRanges();
void clearRanges();
//return an independent copy on purpose
BookmarkRangeList getRanges();
void clearRanges();
static std::wstring getBookmarkEntryDisplayName(BookmarkEntryPtr bmEnt);
static std::wstring getActiveDisplayName(DemodulatorInstancePtr demod);
protected:
void trimRecents();
void loadDefaultRanges();
BookmarkEntryPtr demodToBookmarkEntry(DemodulatorInstancePtr demod);
BookmarkEntryPtr nodeToBookmark(DataNode *node);
......@@ -136,10 +142,8 @@ protected:
BookmarkList recents;
BookmarkRangeList ranges;
bool rangesSorted;
std::recursive_mutex busy_lock;
BookmarkExpandState expandState;
//represents an empty BookMarkList that is returned by reference by some functions.
static const BookmarkList emptyResults;
};
......@@ -206,6 +206,14 @@ CubicSDR::CubicSDR() : frequency(0), offset(0), ppm(0), snap(1), sampleRate(DEFA
shuttingDown.store(false);
fdlgTarget = FrequencyDialog::FDIALOG_TARGET_DEFAULT;
stoppedDev = nullptr;
//set OpenGL configuration:
m_glContextAttributes = new wxGLContextAttrs();
wxGLContextAttrs glSettings;
glSettings.PlatformDefaults().EndList();
*m_glContextAttributes = glSettings;
}
bool CubicSDR::OnInit() {
......@@ -484,11 +492,10 @@ int CubicSDR::OnExit() {
delete m_glContext;
m_glContext = nullptr;
std::cout << "Application termination complete." << std::endl << std::flush;
#ifdef __APPLE__
//
AudioThread::deviceCleanup();
#endif
std::cout << "Application termination complete." << std::endl << std::flush;
return wxApp::OnExit();
}
......@@ -496,13 +503,18 @@ int CubicSDR::OnExit() {
PrimaryGLContext& CubicSDR::GetContext(wxGLCanvas *canvas) {
PrimaryGLContext *glContext;
if (!m_glContext) {
m_glContext = new PrimaryGLContext(canvas, NULL);
m_glContext = new PrimaryGLContext(canvas, NULL, GetContextAttributes());
}
glContext = m_glContext;
return *glContext;
}
wxGLContextAttrs* CubicSDR::GetContextAttributes() {
return m_glContextAttributes;
}
void CubicSDR::OnInitCmdLine(wxCmdLineParser& parser) {
parser.SetDesc (commandLineInfo);
parser.SetSwitchChars (wxT("-"));
......
......@@ -71,6 +71,7 @@ public:
CubicSDR();
PrimaryGLContext &GetContext(wxGLCanvas *canvas);
wxGLContextAttrs* GetContextAttributes();
virtual bool OnInit();
virtual int OnExit();
......@@ -94,9 +95,7 @@ public:
void setAntennaName(const std::string& name);
const std::string& getAntennaName();
void setDBOffset(int ofs);
int getDBOffset();
void setSampleRate(long long rate_in);
long long getSampleRate();
......@@ -114,7 +113,7 @@ public:
DemodulatorThreadOutputQueuePtr getAudioVisualQueue();
DemodulatorThreadInputQueuePtr getIQVisualQueue();
DemodulatorThreadInputQueuePtr getWaterfallVisualQueue();
DemodulatorThreadInputQueuePtr getActiveDemodVisualQueue();
DemodulatorMgr &getDemodMgr();
BookmarkMgr &getBookmarkMgr();
......@@ -186,6 +185,8 @@ private:
AppFrame *appframe = nullptr;
AppConfig config;
PrimaryGLContext *m_glContext = nullptr;
wxGLContextAttrs *m_glContextAttributes = nullptr;
std::vector<SDRDeviceInfo *> *devs = nullptr;
DemodulatorMgr demodMgr;
......
......@@ -106,7 +106,7 @@ bool AudioFileWAV::closeFile()
// Fix the data chunk header to contain the data size
outputFileStream.seekp(dataChunkPos + 4);
write_word(outputFileStream, file_length - dataChunkPos + 8);
write_word(outputFileStream, file_length - (dataChunkPos + 8), 4);
// Fix the file header to contain the proper RIFF chunk size, which is (file size - 8) bytes
outputFileStream.seekp(0 + 4);
......
This diff is collapsed.
......@@ -21,20 +21,20 @@ public:
int channels;
float peak;
int type;
bool is_squelch_active;
bool is_squelch_active;
std::vector<float> data;
AudioThreadInput() :
frequency(0), inputRate(0), sampleRate(0), channels(0), peak(0), type(0), is_squelch_active(false) {
frequency(0), inputRate(0), sampleRate(0), channels(0), peak(0), type(0), is_squelch_active(false) {
}
AudioThreadInput(AudioThreadInput *copyFrom) {
copy(copyFrom);
}
void copy(AudioThreadInput *copyFrom) {
frequency = copyFrom->frequency;
inputRate = copyFrom->inputRate;
......@@ -46,9 +46,9 @@ public:
data.assign(copyFrom->data.begin(), copyFrom->data.end());
}
virtual ~AudioThreadInput() {
}
};
......@@ -65,7 +65,7 @@ public:
};
AudioThreadCommand() :
cmd(AUDIO_THREAD_CMD_NULL), int_value(0) {
cmd(AUDIO_THREAD_CMD_NULL), int_value(0) {
}
AudioThreadCommandEnum cmd;
......@@ -81,15 +81,15 @@ typedef std::shared_ptr<AudioThreadCommandQueue> AudioThreadCommandQueuePtr;
class AudioThread : public IOThread {
public:
AudioThread();
virtual ~AudioThread();
static void enumerateDevices(std::vector<RtAudio::DeviceInfo> &devs);
void setInitOutputDevice(int deviceId, int sampleRate=-1);
void setInitOutputDevice(int deviceId, int sampleRate = -1);
int getOutputDevice();
int getSampleRate();
virtual void run();
......@@ -99,7 +99,7 @@ public:
void setActive(bool state);
void setGain(float gain_in);
static std::map<int, int> deviceSampleRate;
AudioThreadCommandQueue *getCommandQueue();
......@@ -110,6 +110,9 @@ public:
static void deviceCleanup();
static void setDeviceSampleRate(int deviceId, int sampleRate);
//
void attachControllerThread(std::thread* controllerThread);
//fields below, only to be used by other AudioThreads !
size_t underflowCount;
//protected by m_mutex
......@@ -123,7 +126,7 @@ private:
std::atomic_bool active;
std::atomic_int outputDevice;
RtAudio dac;
unsigned int nBufferFrames;
RtAudio::StreamOptions opts;
......@@ -131,6 +134,9 @@ private:
AudioThreadCommandQueue cmdQueue;
int sampleRate;
//if != nullptr, it mean AudioThread is a controller thread.
std::thread* controllerThread;
//The own m_mutex protecting this AudioThread, in particular boundThreads
std::recursive_mutex m_mutex;
......@@ -140,10 +146,8 @@ private:
void bindThread(AudioThread *other);
void removeThread(AudioThread *other);
static std::map<int, AudioThread *> deviceController;
static std::map<int, std::thread *> deviceThread;
//The mutex protecting static deviceController, deviceThread and deviceSampleRate access.
static std::recursive_mutex m_device_mutex;
};
static std::map<int, AudioThread* > deviceController;
//The mutex protecting static deviceController, deviceThread and deviceSampleRate access.
static std::recursive_mutex m_device_mutex;
};
......@@ -553,10 +553,10 @@ bool DemodulatorInstance::isRecording()
void DemodulatorInstance::setRecording(bool recording_in)
{
if (!recording.load() && recording_in) {
if (recording_in) {
startRecording();
}
else if (recording.load() && !recording_in) {
else {
stopRecording();
}
}
......
This diff is collapsed.
......@@ -80,7 +80,6 @@ public:
bool getExpandState(std::string branchName);
void setExpandState(std::string branchName, bool state);
void loadDefaultRanges();
static BookmarkRangeEntryPtr makeActiveRangeEntry();
protected:
......@@ -162,7 +161,9 @@ protected:
void onRenameRange( wxCommandEvent& event );
void onActivateRange( wxCommandEvent& event );
void onUpdateRange( wxCommandEvent& event );
bool skipEvents();
TreeViewItem *itemToTVI(wxTreeItemId item);
void SetTreeItemData(const wxTreeItemId& item, wxTreeItemData *data);
......@@ -200,4 +201,5 @@ protected:
std::vector<std::wstring> searchKeywords;
void setStatusText(std::string statusText);
};
This diff is collapsed.
......@@ -385,6 +385,32 @@ AboutDialogBase::AboutDialogBase( wxWindow* parent, wxWindowID id, const wxStrin
m_dMarvinCalvert->Wrap( -1 );
m_dSizer->Add( m_dMarvinCalvert, 0, wxALL, 5 );
m_dErfurterFeurblume = new wxStaticText( m_dScroll, wxID_ANY, wxT("Erfurter Feurblume"), wxDefaultPosition, wxDefaultSize, 0 );
m_dErfurterFeurblume->Wrap( -1 );
m_dSizer->Add( m_dErfurterFeurblume, 0, wxALL, 5 );
m_dMakarenkoAleksey = new wxStaticText( m_dScroll, wxID_ANY, wxT("Makarenko Aleksey"), wxDefaultPosition, wxDefaultSize, 0 );
m_dMakarenkoAleksey->Wrap( -1 );
m_dSizer->Add( m_dMakarenkoAleksey, 0, wxALL, 5 );
m_dAnthonyLambiris = new wxStaticText( m_dScroll, wxID_ANY, wxT("Anthony Lambiris"), wxDefaultPosition, wxDefaultSize, 0 );
m_dAnthonyLambiris->Wrap( -1 );
m_dSizer->Add( m_dAnthonyLambiris, 0, wxALL, 5 );
m_dJoeBurtinsky = new wxStaticText( m_dScroll, wxID_ANY, wxT("Joe Burtinsky"), wxDefaultPosition, wxDefaultSize, 0 );
m_dJoeBurtinsky->Wrap( -1 );
m_dSizer->Add( m_dJoeBurtinsky, 0, wxALL, 5 );
m_dDalePuckett
= new wxStaticText( m_dScroll, wxID_ANY, wxT("Dale Puckett"), wxDefaultPosition, wxDefaultSize, 0 );
m_dDalePuckett
->Wrap( -1 );
m_dSizer->Add( m_dDalePuckett
, 0, wxALL, 5 );
m_dBSizer->Add( m_dSizer, 1, wxALL|wxEXPAND, 5 );
......
......@@ -119,6 +119,13 @@ class AboutDialogBase : public wxDialog
wxStaticText* m_dJordanParker;
wxStaticText* m_dRobertChave;
wxStaticText* m_dMarvinCalvert;
wxStaticText* m_dErfurterFeurblume;
wxStaticText* m_dMakarenkoAleksey;
wxStaticText* m_dAnthonyLambiris;
wxStaticText* m_dJoeBurtinsky;
wxStaticText* m_dDalePuckett
;
wxScrolledWindow* m_stScroll;
wxStaticText* m_stHeader;
wxStaticLine* m_stDivider1;
......
......@@ -361,7 +361,7 @@ void SDRDevicesDialog::OnUseSelected( wxMouseEvent& event) {
wxPGProperty *prop = runtimeProps[arg.key];
if (arg.type == SoapySDR::ArgInfo::STRING && arg.options.size()) {
settingArgs[arg.key] = arg.options[prop->GetChoiceSelection()];
settingArgs[arg.key] = getSelectedChoiceOption(prop, arg);
} else if (arg.type == SoapySDR::ArgInfo::BOOL) {
settingArgs[arg.key] = (prop->GetValueAsString()=="True")?"true":"false";
} else {
......@@ -378,7 +378,7 @@ void SDRDevicesDialog::OnUseSelected( wxMouseEvent& event) {
wxPGProperty *prop = streamProps[arg.key];
if (arg.type == SoapySDR::ArgInfo::STRING && arg.options.size()) {
streamArgs[arg.key] = arg.options[prop->GetChoiceSelection()];
streamArgs[arg.key] = getSelectedChoiceOption(prop, arg);
} else if (arg.type == SoapySDR::ArgInfo::BOOL) {
streamArgs[arg.key] = (prop->GetValueAsString()=="True")?"true":"false";
} else {
......@@ -491,6 +491,27 @@ void SDRDevicesDialog::OnRefreshDevices( wxMouseEvent& /* event */) {
doRefreshDevices();
}
std::string SDRDevicesDialog::getSelectedChoiceOption(wxPGProperty* prop, const SoapySDR::ArgInfo& arg) {
std::string optionName = "";
int choiceIndex = prop->GetChoiceSelection();
if (arg.options.size() > 0) {
if (choiceIndex >= 0 && choiceIndex < arg.options.size()) {
//normal selection
optionName = arg.options[choiceIndex];
} else {
//choose the first one of the list:
optionName = arg.options[0];
prop->SetChoiceSelection(0);
}
}
return optionName;
}
void SDRDevicesDialog::OnPropGridChanged( wxPropertyGridEvent& event ) {
if (event.GetProperty() == devSettings["name"]) {
......@@ -508,12 +529,12 @@ void SDRDevicesDialog::OnPropGridChanged( wxPropertyGridEvent& event ) {
} else if (dev && event.GetProperty() == devSettings["offset"]) {
DeviceConfig *devConfig = wxGetApp().getConfig()->getDevice(dev->getDeviceId());
long offset = event.GetPropertyValue().GetInteger();
long offset_In_KHz = event.GetPropertyValue().GetInteger();
devConfig->setOffset(offset);
devConfig->setOffset((long long) offset_In_KHz * 1000);