From dff879f233f738f1c4c98a6662836fec67abc507 Mon Sep 17 00:00:00 2001 From: "Charles J. Cliffe" Date: Mon, 5 Oct 2015 19:59:17 -0400 Subject: [PATCH] Move deviceSelector init startup -> appframe - Plus some minor static analysis fixes and missing atomic store() for MSVC --- src/AppFrame.cpp | 7 ++++--- src/CubicSDR.cpp | 5 +---- src/audio/AudioThread.cpp | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/AppFrame.cpp b/src/AppFrame.cpp index d4e11d7..dae5a3d 100644 --- a/src/AppFrame.cpp +++ b/src/AppFrame.cpp @@ -291,8 +291,8 @@ AppFrame::AppFrame() : menuBar->Append(menu, wxT("&Input Bandwidth")); - std::vector *devs = wxGetApp().getDevices(); - std::vector::iterator devs_i; +// std::vector *devs = wxGetApp().getDevices(); +// std::vector::iterator devs_i; // if (devs->size() > 1) { // @@ -346,7 +346,6 @@ AppFrame::AppFrame() : } for (mdevices_i = outputDevices.begin(); mdevices_i != outputDevices.end(); mdevices_i++) { - new wxMenu; int menu_id = wxID_AUDIO_BANDWIDTH_BASE + wxID_AUDIO_DEVICE_MULTIPLIER * mdevices_i->first; wxMenu *subMenu = new wxMenu; menu->AppendSubMenu(subMenu, mdevices_i->second.name, wxT("Description?")); @@ -417,6 +416,8 @@ AppFrame::AppFrame() : wxAcceleratorTable accel(3, entries); SetAcceleratorTable(accel); + wxGetApp().deviceSelector(); + // static const int attribs[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, 0 }; // wxLogStatus("Double-buffered display %s supported", wxGLCanvas::IsDisplaySupported(attribs) ? "is" : "not"); // ShowFullScreen(true); diff --git a/src/CubicSDR.cpp b/src/CubicSDR.cpp index a1822bd..5157719 100644 --- a/src/CubicSDR.cpp +++ b/src/CubicSDR.cpp @@ -102,9 +102,6 @@ bool CubicSDR::OnInit() { sdrEnum = new SDREnumerator(); appframe = new AppFrame(); - deviceSelectorOpen.store(true); - deviceSelectorDialog = new SDRDevicesDialog(appframe); - deviceSelectorDialog->Show(); t_SDREnum = new std::thread(&SDREnumerator::threadMain, sdrEnum); @@ -199,7 +196,7 @@ void CubicSDR::deviceSelector() { deviceSelectorDialog->SetFocus(); return; } - deviceSelectorOpen = true; + deviceSelectorOpen.store(true); deviceSelectorDialog = new SDRDevicesDialog(appframe); deviceSelectorDialog->Show(); } diff --git a/src/audio/AudioThread.cpp b/src/audio/AudioThread.cpp index 789e016..634f788 100644 --- a/src/audio/AudioThread.cpp +++ b/src/audio/AudioThread.cpp @@ -20,7 +20,7 @@ AudioThread::AudioThread() : IOThread(), outputDevice.store(-1); gain.store(1.0); - boundThreads = new std::vector; + boundThreads.store(new std::vector); } AudioThread::~AudioThread() {