GLSpectrum: fixed SSB handling

pull/1744/head
f4exb 2023-07-09 00:00:51 +02:00
rodzic 8824bd5e44
commit 7ec955fc61
1 zmienionych plików z 7 dodań i 4 usunięć

Wyświetl plik

@ -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);