mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2025-09-16 21:47:51 -04:00
Session save handler
This commit is contained in:
parent
95fcb30733
commit
8ec6b75e54
@ -17,6 +17,7 @@
|
|||||||
#include "DemodulatorMgr.h"
|
#include "DemodulatorMgr.h"
|
||||||
#include "AudioThread.h"
|
#include "AudioThread.h"
|
||||||
#include "CubicSDR.h"
|
#include "CubicSDR.h"
|
||||||
|
#include "DataTree.h"
|
||||||
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
@ -32,7 +33,7 @@ EVT_IDLE(AppFrame::OnIdle)
|
|||||||
wxEND_EVENT_TABLE()
|
wxEND_EVENT_TABLE()
|
||||||
|
|
||||||
AppFrame::AppFrame() :
|
AppFrame::AppFrame() :
|
||||||
wxFrame(NULL, wxID_ANY, wxT("CubicSDR v0.1a by Charles J. Cliffe (@ccliffe)")), activeDemodulator(NULL) {
|
wxFrame(NULL, wxID_ANY, wxT("CubicSDR " CUBICSDR_VERSION " by Charles J. Cliffe (@ccliffe)")), activeDemodulator(NULL) {
|
||||||
|
|
||||||
wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL);
|
||||||
wxBoxSizer *demodOpts = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer *demodOpts = new wxBoxSizer(wxVERTICAL);
|
||||||
@ -282,3 +283,33 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
|
|||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AppFrame::saveSession(std::string fileName) {
|
||||||
|
DataTree s("cubicsdr_session");
|
||||||
|
DataNode &header = s.rootNode().newChild("header");
|
||||||
|
header.newChild("version") = std::string(CUBICSDR_VERSION);
|
||||||
|
header.newChild("center_freq") = wxGetApp().getFrequency();
|
||||||
|
header.newChild("offset") = wxGetApp().getOffset();
|
||||||
|
|
||||||
|
DataNode &demods = s.rootNode().newChild("demodulators");
|
||||||
|
|
||||||
|
std::vector<DemodulatorInstance *> &instances = wxGetApp().getDemodMgr().getDemodulators();
|
||||||
|
std::vector<DemodulatorInstance *>::iterator instance_i;
|
||||||
|
for (instance_i = instances.begin(); instance_i != instances.end(); instance_i++) {
|
||||||
|
DataNode &demod = demods.newChild("demodulator");
|
||||||
|
demod.newChild("bandwidth") = (long)(*instance_i)->getBandwidth();
|
||||||
|
demod.newChild("frequency") = (long long)(*instance_i)->getFrequency();
|
||||||
|
demod.newChild("type") = (int)(*instance_i)->getDemodulatorType();
|
||||||
|
if ((*instance_i)->isSquelchEnabled()) {
|
||||||
|
demod.newChild("squelch") = (*instance_i)->getSquelchLevel();
|
||||||
|
demod.newChild("squelch_enabled") = (char)1;
|
||||||
|
}
|
||||||
|
demod.newChild("stereo") = (char)(*instance_i)->isStereo();
|
||||||
|
demod.newChild("output_device") = outputDevices[(*instance_i)->getOutputDevice()].name;
|
||||||
|
}
|
||||||
|
|
||||||
|
s.SaveToFileXML(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AppFrame::loadSession(std::string fileName) {
|
||||||
|
}
|
||||||
|
@ -23,6 +23,9 @@ public:
|
|||||||
void OnThread(wxCommandEvent& event);
|
void OnThread(wxCommandEvent& event);
|
||||||
void OnEventInput(wxThreadEvent& event);
|
void OnEventInput(wxThreadEvent& event);
|
||||||
|
|
||||||
|
void saveSession(std::string fileName);
|
||||||
|
bool loadSession(std::string fileName);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnMenu(wxCommandEvent& event);
|
void OnMenu(wxCommandEvent& event);
|
||||||
void OnClose(wxCommandEvent& event);
|
void OnClose(wxCommandEvent& event);
|
||||||
@ -46,5 +49,7 @@ private:
|
|||||||
std::map<int,RtAudio::DeviceInfo> outputDevices;
|
std::map<int,RtAudio::DeviceInfo> outputDevices;
|
||||||
std::map<int,wxMenuItem *> outputDeviceMenuItems;
|
std::map<int,wxMenuItem *> outputDeviceMenuItems;
|
||||||
|
|
||||||
|
std::string currentSessionFile;
|
||||||
|
|
||||||
wxDECLARE_EVENT_TABLE();
|
wxDECLARE_EVENT_TABLE();
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#define CUBICSDR_VERSION "v0.01a"
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#define BUF_SIZE (16384*2)
|
#define BUF_SIZE (16384*2)
|
||||||
#define SRATE 2000000
|
#define SRATE 2000000
|
||||||
|
Loading…
x
Reference in New Issue
Block a user