From 7ee44dfd2724fd1932fc672e845cecec69787357 Mon Sep 17 00:00:00 2001 From: f4exb Date: Thu, 16 Jul 2015 22:31:12 +0200 Subject: [PATCH] Corrected channel analyzer decimation and incorrect workarounds --- plugins/channel/chanalyzer/chanalyzer.cpp | 2 +- plugins/channel/chanalyzer/chanalyzergui.cpp | 23 ++++++++++---------- sdrbase/dsp/scopevis.cpp | 5 ++++- sdrbase/gui/glscope.cpp | 4 ++-- sdrbase/gui/glscopegui.cpp | 8 +++---- 5 files changed, 22 insertions(+), 20 deletions(-) diff --git a/plugins/channel/chanalyzer/chanalyzer.cpp b/plugins/channel/chanalyzer/chanalyzer.cpp index cfa43b2ad..936a6004a 100644 --- a/plugins/channel/chanalyzer/chanalyzer.cpp +++ b/plugins/channel/chanalyzer/chanalyzer.cpp @@ -63,7 +63,7 @@ void ChannelAnalyzer::feed(SampleVector::const_iterator begin, SampleVector::con { fftfilt::cmplx *sideband, sum; int n_out; - int decim = 1<<(m_spanLog2 - 1); + int decim = 1<setSidebands(ChannelMarker::usb); } - ui->glSpectrum->setCenterFrequency(m_rate/2); - ui->glSpectrum->setSampleRate(m_rate); + ui->glSpectrum->setCenterFrequency(m_rate/4); + ui->glSpectrum->setSampleRate(m_rate/2); ui->glSpectrum->setSsbSpectrum(true); on_lowCut_valueChanged(m_channelMarker->getLowCutoff()/100); @@ -219,7 +219,7 @@ void ChannelAnalyzerGUI::on_ssb_toggled(bool checked) m_channelMarker->setSidebands(ChannelMarker::dsb); ui->glSpectrum->setCenterFrequency(0); - ui->glSpectrum->setSampleRate(2*m_rate); + ui->glSpectrum->setSampleRate(m_rate); ui->glSpectrum->setSsbSpectrum(false); applySettings(); @@ -342,21 +342,22 @@ bool ChannelAnalyzerGUI::setNewRate(int spanLog2) m_channelMarker->setSidebands(ChannelMarker::usb); } - ui->glSpectrum->setCenterFrequency(m_rate/2); - ui->glSpectrum->setSampleRate(m_rate); + ui->glSpectrum->setCenterFrequency(m_rate/4); + ui->glSpectrum->setSampleRate(m_rate/2); ui->glSpectrum->setSsbSpectrum(true); - ui->glScope->setSampleRate(m_rate); - m_scopeVis->setSampleRate(m_rate); - } else { + } + else + { m_channelMarker->setSidebands(ChannelMarker::dsb); ui->glSpectrum->setCenterFrequency(0); - ui->glSpectrum->setSampleRate(2*m_rate); + ui->glSpectrum->setSampleRate(m_rate); ui->glSpectrum->setSsbSpectrum(false); - ui->glScope->setSampleRate(2*m_rate); - m_scopeVis->setSampleRate(2*m_rate); } + ui->glScope->setSampleRate(m_rate); + m_scopeVis->setSampleRate(m_rate); + return true; } diff --git a/sdrbase/dsp/scopevis.cpp b/sdrbase/dsp/scopevis.cpp index d0aad27fe..98af789c8 100644 --- a/sdrbase/dsp/scopevis.cpp +++ b/sdrbase/dsp/scopevis.cpp @@ -125,8 +125,11 @@ bool ScopeVis::handleMessageKeep(Message* message) { if(DSPSignalNotification::match(message)) { DSPSignalNotification* signal = (DSPSignalNotification*)message; - //fprintf(stderr, "ScopeVis::handleMessage @%x : %d samples/sec, %lld Hz offset\n", this, signal->getSampleRate(), signal->getFrequencyOffset()); m_sampleRate = signal->getSampleRate(); + /*fprintf(stderr, "ScopeVis::handleMessage : %d samples/sec, %lld Hz offset, traceSize: \n", + m_sampleRate, + signal->getFrequencyOffset(), + m_trace.size());*/ return true; } else if(MsgConfigureScopeVis::match(message)) { MsgConfigureScopeVis* conf = (MsgConfigureScopeVis*)message; diff --git a/sdrbase/gui/glscope.cpp b/sdrbase/gui/glscope.cpp index 2fb1ad4ff..b40f4b6cb 100644 --- a/sdrbase/gui/glscope.cpp +++ b/sdrbase/gui/glscope.cpp @@ -338,7 +338,7 @@ void GLScope::paintGL() glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_LINE_SMOOTH); glLineWidth(1.0f); - glColor4f(1, 1, 0, 0.4f); + glColor4f(1, 1, 0.25f, 0.4f); int start = (m_timeOfsProMill/1000.0) * m_displayTrace->size(); int end = std::min(start + m_displayTrace->size()/m_timeBase, m_displayTrace->size()); if(end - start < 2) @@ -510,7 +510,7 @@ void GLScope::paintGL() glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_LINE_SMOOTH); glLineWidth(1.0f); - glColor4f(1, 1, 0, 0.4f); + glColor4f(1, 1, 0.25f, 0.4f); int start = (m_timeOfsProMill/1000.0) * m_displayTrace->size(); int end = std::min(start + m_displayTrace->size()/m_timeBase, m_displayTrace->size()); if(end - start < 2) diff --git a/sdrbase/gui/glscopegui.cpp b/sdrbase/gui/glscopegui.cpp index c0b0ff5c1..e76022591 100644 --- a/sdrbase/gui/glscopegui.cpp +++ b/sdrbase/gui/glscopegui.cpp @@ -243,13 +243,11 @@ void GLScopeGUI::setTimeScaleDisplay() { m_sampleRate = m_glScope->getSampleRate(); qreal t = (m_glScope->getTraceSize() * 1.0 / m_sampleRate) / (qreal)m_timeBase; - /* - std::cerr << "GLScopeGUI::setTimeScaleDisplay: sample rate: " - << m_glScope->getSampleRate() + /*std::cerr << "GLScopeGUI::setTimeScaleDisplay: sample rate: " + << m_sampleRate << " traceSize: " << m_glScope->getTraceSize() << " timeBase: " << m_timeBase - << " glScope @" << m_glScope << std::endl; - */ + << " t: " << t << std::endl;*/ if(t < 0.000001) ui->timeText->setText(tr("%1\nns").arg(t * 1000000000.0)); else if(t < 0.001)