Spectrum averaging control now functional

This commit is contained in:
Charles J. Cliffe 2015-08-12 22:14:14 -04:00
parent 1d5a2f1ac7
commit b345dc7516
4 changed files with 21 additions and 8 deletions

View File

@ -118,8 +118,8 @@ AppFrame::AppFrame() :
wxGetApp().getSpectrumProcesor()->attachOutput(spectrumCanvas->getVisualDataQueue());
spectrumAvgMeter = new MeterCanvas(this, attribList);
spectrumAvgMeter->setMax(3.0);
spectrumAvgMeter->setLevel(1.0);
spectrumAvgMeter->setMax(1.0);
spectrumAvgMeter->setLevel(0.65);
spectrumAvgMeter->setShowUserInput(false);
spectrumSizer->Add(spectrumCanvas, 63, wxEXPAND | wxALL, 0);
@ -715,6 +715,12 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
SpectrumVisualProcessor *proc = wxGetApp().getSpectrumProcesor();
if (spectrumAvgMeter->inputChanged()) {
float val = spectrumAvgMeter->getInputValue();
spectrumAvgMeter->setLevel(val);
proc->setFFTAverageRate(val);
}
proc->setView(spectrumCanvas->getViewState());
proc->setBandwidth(spectrumCanvas->getBandwidth());
proc->setCenterFrequency(spectrumCanvas->getCenterFrequency());

View File

@ -15,6 +15,7 @@ SpectrumVisualProcessor::SpectrumVisualProcessor() : lastInputBandwidth(0), last
fft_ceil_ma = fft_ceil_maa = 100.0;
fft_floor_ma = fft_floor_maa = 0.0;
desiredInputSize = 0;
fft_average_rate = 0.65;
}
SpectrumVisualProcessor::~SpectrumVisualProcessor() {
@ -29,6 +30,9 @@ void SpectrumVisualProcessor::setView(bool bView) {
is_view.store(bView);
}
void SpectrumVisualProcessor::setFFTAverageRate(float fftAverageRate) {
this->fft_average_rate = fftAverageRate;
}
void SpectrumVisualProcessor::setCenterFrequency(long long centerFreq_in) {
centerFreq.store(centerFreq_in);
@ -260,11 +264,11 @@ void SpectrumVisualProcessor::process() {
for (int i = 0, iMax = fftSize; i < iMax; i++) {
if (is_view.load()) {
fft_result_maa[i] += (fft_result_ma[i] - fft_result_maa[i]) * 0.65;
fft_result_ma[i] += (fft_result[i] - fft_result_ma[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]) * fft_average_rate;
} else {
fft_result_maa[i] += (fft_result_ma[i] - fft_result_maa[i]) * 0.65;
fft_result_ma[i] += (fft_result[i] - fft_result_ma[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]) * fft_average_rate;
}
if (fft_result_maa[i] > fft_ceil) {

View File

@ -21,6 +21,8 @@ public:
bool isView();
void setView(bool bView);
void setFFTAverageRate(float fftAverageRate);
void setCenterFrequency(long long centerFreq_in);
long long getCenterFrequency();
@ -50,6 +52,7 @@ private:
float fft_ceil_ma, fft_ceil_maa;
float fft_floor_ma, fft_floor_maa;
float fft_average_rate;
std::vector<float> fft_result;
std::vector<float> fft_result_ma;

View File

@ -86,7 +86,7 @@ void SDRPostThread::run() {
std::vector<liquid_float_complex> fpData;
std::vector<liquid_float_complex> dataOut;
iqDataInQueue->set_max_num_items(30);
iqDataInQueue->set_max_num_items(0);
while (!terminated) {
SDRThreadIQData *data_in;