mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-27 06:08:37 -05:00
Spectrum averaging control now functional
This commit is contained in:
parent
1d5a2f1ac7
commit
b345dc7516
@ -118,8 +118,8 @@ AppFrame::AppFrame() :
|
|||||||
wxGetApp().getSpectrumProcesor()->attachOutput(spectrumCanvas->getVisualDataQueue());
|
wxGetApp().getSpectrumProcesor()->attachOutput(spectrumCanvas->getVisualDataQueue());
|
||||||
|
|
||||||
spectrumAvgMeter = new MeterCanvas(this, attribList);
|
spectrumAvgMeter = new MeterCanvas(this, attribList);
|
||||||
spectrumAvgMeter->setMax(3.0);
|
spectrumAvgMeter->setMax(1.0);
|
||||||
spectrumAvgMeter->setLevel(1.0);
|
spectrumAvgMeter->setLevel(0.65);
|
||||||
spectrumAvgMeter->setShowUserInput(false);
|
spectrumAvgMeter->setShowUserInput(false);
|
||||||
|
|
||||||
spectrumSizer->Add(spectrumCanvas, 63, wxEXPAND | wxALL, 0);
|
spectrumSizer->Add(spectrumCanvas, 63, wxEXPAND | wxALL, 0);
|
||||||
@ -715,6 +715,12 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
|
|||||||
|
|
||||||
SpectrumVisualProcessor *proc = wxGetApp().getSpectrumProcesor();
|
SpectrumVisualProcessor *proc = wxGetApp().getSpectrumProcesor();
|
||||||
|
|
||||||
|
if (spectrumAvgMeter->inputChanged()) {
|
||||||
|
float val = spectrumAvgMeter->getInputValue();
|
||||||
|
spectrumAvgMeter->setLevel(val);
|
||||||
|
proc->setFFTAverageRate(val);
|
||||||
|
}
|
||||||
|
|
||||||
proc->setView(spectrumCanvas->getViewState());
|
proc->setView(spectrumCanvas->getViewState());
|
||||||
proc->setBandwidth(spectrumCanvas->getBandwidth());
|
proc->setBandwidth(spectrumCanvas->getBandwidth());
|
||||||
proc->setCenterFrequency(spectrumCanvas->getCenterFrequency());
|
proc->setCenterFrequency(spectrumCanvas->getCenterFrequency());
|
||||||
|
@ -15,6 +15,7 @@ SpectrumVisualProcessor::SpectrumVisualProcessor() : lastInputBandwidth(0), last
|
|||||||
fft_ceil_ma = fft_ceil_maa = 100.0;
|
fft_ceil_ma = fft_ceil_maa = 100.0;
|
||||||
fft_floor_ma = fft_floor_maa = 0.0;
|
fft_floor_ma = fft_floor_maa = 0.0;
|
||||||
desiredInputSize = 0;
|
desiredInputSize = 0;
|
||||||
|
fft_average_rate = 0.65;
|
||||||
}
|
}
|
||||||
|
|
||||||
SpectrumVisualProcessor::~SpectrumVisualProcessor() {
|
SpectrumVisualProcessor::~SpectrumVisualProcessor() {
|
||||||
@ -29,6 +30,9 @@ void SpectrumVisualProcessor::setView(bool bView) {
|
|||||||
is_view.store(bView);
|
is_view.store(bView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SpectrumVisualProcessor::setFFTAverageRate(float fftAverageRate) {
|
||||||
|
this->fft_average_rate = fftAverageRate;
|
||||||
|
}
|
||||||
|
|
||||||
void SpectrumVisualProcessor::setCenterFrequency(long long centerFreq_in) {
|
void SpectrumVisualProcessor::setCenterFrequency(long long centerFreq_in) {
|
||||||
centerFreq.store(centerFreq_in);
|
centerFreq.store(centerFreq_in);
|
||||||
@ -260,11 +264,11 @@ void SpectrumVisualProcessor::process() {
|
|||||||
|
|
||||||
for (int i = 0, iMax = fftSize; i < iMax; i++) {
|
for (int i = 0, iMax = fftSize; i < iMax; i++) {
|
||||||
if (is_view.load()) {
|
if (is_view.load()) {
|
||||||
fft_result_maa[i] += (fft_result_ma[i] - fft_result_maa[i]) * 0.65;
|
fft_result_maa[i] += (fft_result_ma[i] - fft_result_maa[i]) * fft_average_rate;
|
||||||
fft_result_ma[i] += (fft_result[i] - fft_result_ma[i]) * 0.65;
|
fft_result_ma[i] += (fft_result[i] - fft_result_ma[i]) * fft_average_rate;
|
||||||
} else {
|
} else {
|
||||||
fft_result_maa[i] += (fft_result_ma[i] - fft_result_maa[i]) * 0.65;
|
fft_result_maa[i] += (fft_result_ma[i] - fft_result_maa[i]) * fft_average_rate;
|
||||||
fft_result_ma[i] += (fft_result[i] - fft_result_ma[i]) * 0.65;
|
fft_result_ma[i] += (fft_result[i] - fft_result_ma[i]) * fft_average_rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fft_result_maa[i] > fft_ceil) {
|
if (fft_result_maa[i] > fft_ceil) {
|
||||||
|
@ -21,6 +21,8 @@ public:
|
|||||||
bool isView();
|
bool isView();
|
||||||
void setView(bool bView);
|
void setView(bool bView);
|
||||||
|
|
||||||
|
void setFFTAverageRate(float fftAverageRate);
|
||||||
|
|
||||||
void setCenterFrequency(long long centerFreq_in);
|
void setCenterFrequency(long long centerFreq_in);
|
||||||
long long getCenterFrequency();
|
long long getCenterFrequency();
|
||||||
|
|
||||||
@ -50,6 +52,7 @@ private:
|
|||||||
|
|
||||||
float fft_ceil_ma, fft_ceil_maa;
|
float fft_ceil_ma, fft_ceil_maa;
|
||||||
float fft_floor_ma, fft_floor_maa;
|
float fft_floor_ma, fft_floor_maa;
|
||||||
|
float fft_average_rate;
|
||||||
|
|
||||||
std::vector<float> fft_result;
|
std::vector<float> fft_result;
|
||||||
std::vector<float> fft_result_ma;
|
std::vector<float> fft_result_ma;
|
||||||
|
@ -86,7 +86,7 @@ void SDRPostThread::run() {
|
|||||||
std::vector<liquid_float_complex> fpData;
|
std::vector<liquid_float_complex> fpData;
|
||||||
std::vector<liquid_float_complex> dataOut;
|
std::vector<liquid_float_complex> dataOut;
|
||||||
|
|
||||||
iqDataInQueue->set_max_num_items(30);
|
iqDataInQueue->set_max_num_items(0);
|
||||||
|
|
||||||
while (!terminated) {
|
while (!terminated) {
|
||||||
SDRThreadIQData *data_in;
|
SDRThreadIQData *data_in;
|
||||||
|
Loading…
Reference in New Issue
Block a user