1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-01 13:47:01 -04:00

Specify Scope and Spectrum Vis floating point sample scale

This commit is contained in:
f4exb
2018-01-22 14:07:24 +01:00
parent 61a16eade9
commit a47587e16f
17 changed files with 45 additions and 29 deletions
+4 -3
View File
@@ -14,13 +14,14 @@ inline double log2f(double n)
MESSAGE_CLASS_DEFINITION(SpectrumVis::MsgConfigureSpectrumVis, Message)
SpectrumVis::SpectrumVis(GLSpectrum* glSpectrum) :
SpectrumVis::SpectrumVis(Real scalef, GLSpectrum* glSpectrum) :
BasebandSampleSink(),
m_fft(FFTEngine::create()),
m_fftBuffer(MAX_FFT_SIZE),
m_logPowerSpectrum(MAX_FFT_SIZE),
m_fftBufferFill(0),
m_needMoreSamples(false),
m_scalef(scalef),
m_glSpectrum(glSpectrum),
m_mutex(QMutex::Recursive)
{
@@ -85,7 +86,7 @@ void SpectrumVis::feed(const SampleVector::const_iterator& cbegin, const SampleV
for (std::size_t i = 0; i < samplesNeeded; ++i, ++begin)
{
*it++ = Complex(begin->real() / SDR_RX_SCALEF, begin->imag() / SDR_RX_SCALEF);
*it++ = Complex(begin->real() / m_scalef, begin->imag() / m_scalef);
}
// apply fft window (and copy from m_fftBuffer to m_fftIn)
@@ -144,7 +145,7 @@ void SpectrumVis::feed(const SampleVector::const_iterator& cbegin, const SampleV
// not enough samples for FFT - just fill in new data and return
for(std::vector<Complex>::iterator it = m_fftBuffer.begin() + m_fftBufferFill; begin < end; ++begin)
{
*it++ = Complex(begin->real() / SDR_RX_SCALEF, begin->imag() / SDR_RX_SCALEF);
*it++ = Complex(begin->real() / m_scalef, begin->imag() / m_scalef);
}
m_fftBufferFill += todo;