1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-21 23:55:13 -05:00

Spectrum frequency zoom: Restrict autoscale to visible spectrum area. Added missing images for documentation. Issue #773

This commit is contained in:
f4exb 2021-02-18 06:23:12 +01:00
parent 7ea71996f0
commit a8bba2e95a
5 changed files with 12 additions and 2 deletions

BIN
doc/img/Spectrum_Status.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
doc/img/Spectrum_Status.xcf Normal file

Binary file not shown.

View File

@ -683,6 +683,15 @@ void SpectrumVis::feed(const SampleVector::const_iterator& cbegin, const SampleV
m_mutex.unlock();
}
void SpectrumVis::getZoomedPSDCopy(std::vector<Real>& copy) const
{
int fftMin = (m_frequencyZoomFactor == 1.0f) ?
0 : (m_frequencyZoomPos - (0.5f / m_frequencyZoomFactor)) * m_settings.m_fftSize;
int fftMax = (m_frequencyZoomFactor == 1.0f) ?
m_settings.m_fftSize : (m_frequencyZoomPos + (0.5f / m_frequencyZoomFactor)) * m_settings.m_fftSize;
copy.assign(m_psd.begin() + fftMin, m_psd.begin() + fftMax);
}
void SpectrumVis::start()
{
setRunning(true);

View File

@ -147,7 +147,8 @@ public:
const GLSpectrumSettings& getSettings() const { return m_settings; }
Real getSpecMax() const { return m_specMax / m_powFFTDiv; }
void getPowerSpectrumCopy(std::vector<Real>& copy) { copy.assign(m_powerSpectrum.begin(), m_powerSpectrum.end()); }
void getPSDCopy(std::vector<Real>& copy) { copy.assign(m_psd.begin(), m_psd.begin() + m_settings.m_fftSize); }
void getPSDCopy(std::vector<Real>& copy) const { copy.assign(m_psd.begin(), m_psd.begin() + m_settings.m_fftSize); }
void getZoomedPSDCopy(std::vector<Real>& copy) const;
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly);
virtual void feed(const Complex *begin, unsigned int length); //!< direct FFT feed

View File

@ -267,7 +267,7 @@ void GLSpectrumGUI::on_autoscale_clicked(bool checked)
}
std::vector<Real> psd;
m_spectrumVis->getPSDCopy(psd);
m_spectrumVis->getZoomedPSDCopy(psd);
int avgRange = m_settings.m_fftSize / 32;
if (psd.size() < (unsigned int) avgRange) {