mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-23 04:08:36 -05:00
Save waterfall / spectrum settings, update session reset
This commit is contained in:
parent
709ab4b7d6
commit
1e493b2e20
@ -123,6 +123,8 @@ AppConfig::AppConfig() : configName("") {
|
||||
themeId.store(0);
|
||||
snap.store(1);
|
||||
centerFreq.store(100000000);
|
||||
waterfallLinesPerSec.store(DEFAULT_WATERFALL_LPS);
|
||||
spectrumAvgSpeed.store(0.65f);
|
||||
}
|
||||
|
||||
|
||||
@ -204,6 +206,23 @@ long long AppConfig::getCenterFreq() {
|
||||
return centerFreq.load();
|
||||
}
|
||||
|
||||
|
||||
void AppConfig::setWaterfallLinesPerSec(int lps) {
|
||||
waterfallLinesPerSec.store(lps);
|
||||
}
|
||||
|
||||
int AppConfig::getWaterfallLinesPerSec() {
|
||||
return waterfallLinesPerSec.load();
|
||||
}
|
||||
|
||||
void AppConfig::setSpectrumAvgSpeed(float avgSpeed) {
|
||||
spectrumAvgSpeed.store(avgSpeed);
|
||||
}
|
||||
|
||||
float AppConfig::getSpectrumAvgSpeed() {
|
||||
return spectrumAvgSpeed.load();
|
||||
}
|
||||
|
||||
void AppConfig::setConfigName(std::string configName) {
|
||||
this->configName = configName;
|
||||
}
|
||||
@ -243,6 +262,8 @@ bool AppConfig::save() {
|
||||
*window_node->newChild("theme") = themeId.load();
|
||||
*window_node->newChild("snap") = snap.load();
|
||||
*window_node->newChild("center_freq") = centerFreq.load();
|
||||
*window_node->newChild("waterfall_lps") = waterfallLinesPerSec.load();
|
||||
*window_node->newChild("spectrum_avg") = spectrumAvgSpeed.load();
|
||||
}
|
||||
|
||||
DataNode *devices_node = cfg.rootNode()->newChild("devices");
|
||||
@ -339,7 +360,19 @@ bool AppConfig::load() {
|
||||
win_node->getNext("center_freq")->element()->get(freqVal);
|
||||
centerFreq.store(freqVal);
|
||||
}
|
||||
}
|
||||
|
||||
if (win_node->hasAnother("waterfall_lps")) {
|
||||
int lpsVal;
|
||||
win_node->getNext("waterfall_lps")->element()->get(lpsVal);
|
||||
waterfallLinesPerSec.store(lpsVal);
|
||||
}
|
||||
|
||||
if (win_node->hasAnother("spectrum_avg")) {
|
||||
float avgVal;
|
||||
win_node->getNext("spectrum_avg")->element()->get(avgVal);
|
||||
spectrumAvgSpeed.store(avgVal);
|
||||
}
|
||||
}
|
||||
|
||||
if (cfg.rootNode()->hasAnother("devices")) {
|
||||
DataNode *devices_node = cfg.rootNode()->getNext("devices");
|
||||
|
@ -61,7 +61,13 @@ public:
|
||||
|
||||
void setCenterFreq(long long freqVal);
|
||||
long long getCenterFreq();
|
||||
|
||||
|
||||
void setWaterfallLinesPerSec(int lps);
|
||||
int getWaterfallLinesPerSec();
|
||||
|
||||
void setSpectrumAvgSpeed(float avgSpeed);
|
||||
float getSpectrumAvgSpeed();
|
||||
|
||||
void setConfigName(std::string configName);
|
||||
std::string getConfigFileName(bool ignoreName=false);
|
||||
bool save();
|
||||
@ -76,4 +82,6 @@ private:
|
||||
std::atomic_int themeId;
|
||||
std::atomic_llong snap;
|
||||
std::atomic_llong centerFreq;
|
||||
std::atomic_int waterfallLinesPerSec;
|
||||
std::atomic<float> spectrumAvgSpeed;
|
||||
};
|
||||
|
@ -367,6 +367,16 @@ AppFrame::AppFrame() :
|
||||
|
||||
long long freqSnap = wxGetApp().getConfig()->getSnap();
|
||||
wxGetApp().setFrequencySnap(freqSnap);
|
||||
|
||||
float spectrumAvg = wxGetApp().getConfig()->getSpectrumAvgSpeed();
|
||||
|
||||
spectrumAvgMeter->setLevel(spectrumAvg);
|
||||
wxGetApp().getSpectrumProcesor()->setFFTAverageRate(spectrumAvg);
|
||||
|
||||
int wflps =wxGetApp().getConfig()->getWaterfallLinesPerSec();
|
||||
|
||||
waterfallSpeedMeter->setLevel(sqrt(wflps));
|
||||
fftDistrib.setLinesPerSecond(wflps);
|
||||
|
||||
ThemeMgr::mgr.setTheme(wxGetApp().getConfig()->getTheme());
|
||||
|
||||
@ -466,7 +476,22 @@ void AppFrame::OnMenu(wxCommandEvent& event) {
|
||||
} else if (event.GetId() == wxID_RESET) {
|
||||
wxGetApp().getDemodMgr().terminateAll();
|
||||
wxGetApp().setFrequency(100000000);
|
||||
wxGetApp().setOffset(0);
|
||||
wxGetApp().getDemodMgr().setLastDemodulatorType(DEMOD_TYPE_FM);
|
||||
demodModeSelector->setSelection(1);
|
||||
wxGetApp().getDemodMgr().setLastStereo(false);
|
||||
wxGetApp().getDemodMgr().setLastBandwidth(DEFAULT_DEMOD_BW);
|
||||
wxGetApp().getDemodMgr().setLastGain(1.0);
|
||||
wxGetApp().getDemodMgr().setLastSquelchLevel(0);
|
||||
waterfallCanvas->setBandwidth(wxGetApp().getSampleRate());
|
||||
waterfallCanvas->setCenterFrequency(wxGetApp().getFrequency());
|
||||
spectrumCanvas->setBandwidth(wxGetApp().getSampleRate());
|
||||
spectrumCanvas->setCenterFrequency(wxGetApp().getFrequency());
|
||||
fftDistrib.setLinesPerSecond(DEFAULT_WATERFALL_LPS);
|
||||
waterfallSpeedMeter->setLevel(sqrt(DEFAULT_WATERFALL_LPS));
|
||||
wxGetApp().getSpectrumProcesor()->setFFTAverageRate(0.65);
|
||||
spectrumAvgMeter->setLevel(0.65);
|
||||
demodModeSelector->Refresh();
|
||||
demodTuner->Refresh();
|
||||
SetTitle(CUBICSDR_TITLE);
|
||||
currentSessionFile = "";
|
||||
} else if (event.GetId() == wxID_EXIT) {
|
||||
@ -587,6 +612,8 @@ void AppFrame::OnClose(wxCloseEvent& event) {
|
||||
wxGetApp().getConfig()->setTheme(ThemeMgr::mgr.getTheme());
|
||||
wxGetApp().getConfig()->setSnap(wxGetApp().getFrequencySnap());
|
||||
wxGetApp().getConfig()->setCenterFreq(wxGetApp().getFrequency());
|
||||
wxGetApp().getConfig()->setSpectrumAvgSpeed(wxGetApp().getSpectrumProcesor()->getFFTAverageRate());
|
||||
wxGetApp().getConfig()->setWaterfallLinesPerSec(fftDistrib.getLinesPerSecond());
|
||||
wxGetApp().getConfig()->save();
|
||||
event.Skip();
|
||||
}
|
||||
|
@ -34,6 +34,10 @@ void SpectrumVisualProcessor::setFFTAverageRate(float fftAverageRate) {
|
||||
this->fft_average_rate = fftAverageRate;
|
||||
}
|
||||
|
||||
float SpectrumVisualProcessor::getFFTAverageRate() {
|
||||
return this->fft_average_rate;
|
||||
}
|
||||
|
||||
void SpectrumVisualProcessor::setCenterFrequency(long long centerFreq_in) {
|
||||
centerFreq.store(centerFreq_in);
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ public:
|
||||
void setView(bool bView);
|
||||
|
||||
void setFFTAverageRate(float fftAverageRate);
|
||||
float getFFTAverageRate();
|
||||
|
||||
void setCenterFrequency(long long centerFreq_in);
|
||||
long long getCenterFrequency();
|
||||
@ -82,6 +83,9 @@ public:
|
||||
this->linesPerSecond = lines;
|
||||
}
|
||||
|
||||
int getLinesPerSecond() {
|
||||
return this->linesPerSecond;
|
||||
}
|
||||
protected:
|
||||
void process() {
|
||||
while (!input->empty()) {
|
||||
|
Loading…
Reference in New Issue
Block a user