mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-15 12:51:49 -05:00
GLSpectrum: fixed SSB handling
This commit is contained in:
parent
8824bd5e44
commit
7ec955fc61
@ -2706,7 +2706,7 @@ void GLSpectrumView::applyChanges()
|
|||||||
|
|
||||||
if (m_sampleRate > 0)
|
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;
|
float halfFFTSize = m_fftSize / 2;
|
||||||
|
|
||||||
if (halfFFTSize > m_fftOverlap) {
|
if (halfFFTSize > m_fftOverlap) {
|
||||||
@ -2800,7 +2800,7 @@ void GLSpectrumView::applyChanges()
|
|||||||
|
|
||||||
if (m_sampleRate > 0)
|
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;
|
float halfFFTSize = m_fftSize / 2;
|
||||||
|
|
||||||
if (halfFFTSize > m_fftOverlap) {
|
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();
|
float zoomFreq = m_frequencyScale.getRangeMin() + pwx*m_frequencyScale.getRange();
|
||||||
|
|
||||||
// Calculate current centre frequency
|
// 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
|
// Calculate difference from frequency under cursor to centre frequency
|
||||||
float freqDiff = (currentCF - zoomFreq);
|
float freqDiff = (currentCF - zoomFreq);
|
||||||
@ -4360,7 +4363,7 @@ void GLSpectrumView::zoom(const QPointF& p, int y)
|
|||||||
float zoomedCF = zoomFreq + zoomedFreqDiff;
|
float zoomedCF = zoomFreq + zoomedFreqDiff;
|
||||||
|
|
||||||
// Calculate zoom position which will set the desired center frequency
|
// 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::max(0.0f, zoomPos);
|
||||||
zoomPos = std::min(1.0f, zoomPos);
|
zoomPos = std::min(1.0f, zoomPos);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user