diff --git a/sdrgui/gui/glspectrumview.cpp b/sdrgui/gui/glspectrumview.cpp index a3b5ce433..c6cfb3e9e 100644 --- a/sdrgui/gui/glspectrumview.cpp +++ b/sdrgui/gui/glspectrumview.cpp @@ -2706,7 +2706,7 @@ void GLSpectrumView::applyChanges() if (m_sampleRate > 0) { - float timeScaleDiv = ((float)m_sampleRate / (float)m_timingRate) * (m_ssbSpectrum ? 2 : 1); + float timeScaleDiv = ((float)m_sampleRate / (float)m_timingRate); float halfFFTSize = m_fftSize / 2; if (halfFFTSize > m_fftOverlap) { @@ -2800,7 +2800,7 @@ void GLSpectrumView::applyChanges() if (m_sampleRate > 0) { - float timeScaleDiv = ((float)m_sampleRate / (float)m_timingRate) * (m_ssbSpectrum ? 2 : 1); + float timeScaleDiv = ((float)m_sampleRate / (float)m_timingRate); float halfFFTSize = m_fftSize / 2; if (halfFFTSize > m_fftOverlap) { @@ -4329,7 +4329,10 @@ void GLSpectrumView::zoom(const QPointF& p, int y) float zoomFreq = m_frequencyScale.getRangeMin() + pwx*m_frequencyScale.getRange(); // Calculate current centre frequency - float currentCF = (m_frequencyZoomFactor == 1) ? m_centerFrequency : ((m_frequencyZoomPos - 0.5) * m_sampleRate + m_centerFrequency); + int adjSampleRate = m_ssbSpectrum ? m_sampleRate/2 : m_sampleRate; + qint64 adjCenterFrequency = m_centerFrequency + (m_ssbSpectrum ? m_sampleRate/4 : 0); + float currentCF = (m_frequencyZoomFactor == 1) ? + adjCenterFrequency : (m_frequencyZoomPos - 0.5) * adjSampleRate + adjCenterFrequency; // Calculate difference from frequency under cursor to centre frequency float freqDiff = (currentCF - zoomFreq); @@ -4360,7 +4363,7 @@ void GLSpectrumView::zoom(const QPointF& p, int y) float zoomedCF = zoomFreq + zoomedFreqDiff; // Calculate zoom position which will set the desired center frequency - float zoomPos = (zoomedCF - m_centerFrequency) / m_sampleRate + 0.5; + float zoomPos = (zoomedCF - adjCenterFrequency) / adjSampleRate + 0.5; zoomPos = std::max(0.0f, zoomPos); zoomPos = std::min(1.0f, zoomPos);