AppFrame clean-up, first pass

This commit is contained in:
Charles J. Cliffe 2019-01-22 00:01:31 -05:00
parent c57a123130
commit 1f70f9189e
6 changed files with 504 additions and 370 deletions

File diff suppressed because it is too large Load Diff

View File

@ -220,11 +220,6 @@ private:
//Use a raw pointer here to prevent a dangling reference
DemodulatorInstance* activeDemodulator;
std::vector<RtAudio::DeviceInfo> devices;
std::map<int,RtAudio::DeviceInfo> inputDevices;
std::map<int,RtAudio::DeviceInfo> outputDevices;
std::map<int, wxMenuItem *> outputDeviceMenuItems;
std::map<int, wxMenuItem *> sampleRateMenuItems;
std::map<int, wxMenuItem *> antennaMenuItems;
@ -239,7 +234,6 @@ private:
//
std::map<int, wxMenuItem *> recordingMenuItems;
std::map<int, wxMenuItem *> directSamplingMenuItems;
wxMenuBar *menuBar;
wxMenu *sampleRateMenu = nullptr;
@ -304,4 +298,29 @@ private:
#endif
wxDECLARE_EVENT_TABLE();
ModeSelectorCanvas *makeModemSelectorPanel(wxWindow *parent, const wxGLAttributes &attribList);
WaterfallCanvas *makeWaterfallCanvas(wxWindow *parent, const wxGLAttributes &attribList);
SpectrumCanvas *makeDemodSpectrumCanvas(wxWindow *parent, const wxGLAttributes &attribList);
MeterCanvas *makeSignalMeter(wxWindow *parent, const wxGLAttributes &attribList);
ModeSelectorCanvas *makeDeltaLockButton(wxWindow *parent, const wxGLAttributes &attribList);
TuningCanvas *makeModemTuner(wxWindow *parent, const wxGLAttributes &attribList);
MeterCanvas *makeModemGainMeter(wxWindow *parent, const wxGLAttributes &attribList);
ModeSelectorCanvas *makeSoloModeButton(wxWindow *parent, const wxGLAttributes &attribList);
ModeSelectorCanvas *makeModemMuteButton(wxWindow *parent, const wxGLAttributes &attribList);
ModeSelectorCanvas *makePeakHoldButton(wxWindow *parent, const wxGLAttributes &attribList);
SpectrumCanvas *makeSpectrumCanvas(wxWindow *parent, const wxGLAttributes &attribList);
MeterCanvas *makeSpectrumAvgMeter(wxWindow *parent, const wxGLAttributes &attribList);
WaterfallCanvas *makeWaterfall(wxWindow *parent, const wxGLAttributes &attribList);
MeterCanvas *makeWaterfallSpeedMeter(wxWindow *parent, const wxGLAttributes &attribList);
ScopeCanvas *makeScopeCanvas(wxPanel *parent, const wxGLAttributes &attribList);
ModeSelectorCanvas *makeModemAdvSelectorPanel(wxPanel *parent, const wxGLAttributes &attribList);
ModemProperties *makeModemProperties(wxPanel *parent);
wxMenu *makeAudioSampleRateMenu();
wxMenu *makeDisplayMenu();
#ifdef USE_HAMLIB
wxMenu *makeRigMenu();
#endif
};

View File

@ -216,6 +216,27 @@ CubicSDR::CubicSDR() : frequency(0), offset(0), ppm(0), snap(1), sampleRate(DEFA
*m_glContextAttributes = glSettings;
}
void CubicSDR::initAudioDevices() const {
std::vector<RtAudio::DeviceInfo> devices;
std::map<int, RtAudio::DeviceInfo> inputDevices, outputDevices;
AudioThread::enumerateDevices(devices);
int i = 0;
for (auto devices_i = devices.begin(); devices_i != devices.end(); devices_i++) {
if (devices_i->inputChannels) {
inputDevices[i] = *devices_i;
}
if (devices_i->outputChannels) {
outputDevices[i] = *devices_i;
}
i++;
}
wxGetApp().getDemodMgr().setOutputDevices(outputDevices);
}
bool CubicSDR::OnInit() {
//use the current locale most appropriate to this system,
@ -298,6 +319,8 @@ bool CubicSDR::OnInit() {
devicesFailed.store(false);
deviceSelectorOpen.store(false);
initAudioDevices();
// Visual Data
spectrumVisualThread = new SpectrumVisualDataThread();

View File

@ -248,6 +248,8 @@ private:
RigThread* rigThread = nullptr;
std::thread *t_Rig = nullptr;
#endif
void initAudioDevices() const;
};
static const wxCmdLineEntryDesc commandLineInfo [] =

View File

@ -403,6 +403,10 @@ void DemodulatorMgr::setOutputDevices(std::map<int,RtAudio::DeviceInfo> devs) {
outputDevices = devs;
}
std::map<int, RtAudio::DeviceInfo> DemodulatorMgr::getOutputDevices() {
return outputDevices;
}
void DemodulatorMgr::saveInstance(DataNode *node, DemodulatorInstancePtr inst) {
*node->newChild("bandwidth") = inst->getBandwidth();

View File

@ -73,6 +73,7 @@ public:
void updateLastState();
void setOutputDevices(std::map<int,RtAudio::DeviceInfo> devs);
std::map<int, RtAudio::DeviceInfo> getOutputDevices();
void saveInstance(DataNode *node, DemodulatorInstancePtr inst);
DemodulatorInstancePtr loadInstance(DataNode *node);