mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-25 17:28:50 -05:00
#1944 - Fix frequency calculation for SSB spectrum
This commit is contained in:
parent
d496744c2a
commit
14430bcb48
@ -2444,13 +2444,13 @@ float GLSpectrumView::calPower(float power) const
|
|||||||
|
|
||||||
int GLSpectrumView::frequencyToBin(int64_t frequency) const
|
int GLSpectrumView::frequencyToBin(int64_t frequency) const
|
||||||
{
|
{
|
||||||
float rbw = m_sampleRate / (float)m_fftSize;
|
float rbw = (m_ssbSpectrum ? (m_sampleRate/2) : m_sampleRate) / (float)m_fftSize;
|
||||||
return (frequency - m_frequencyScale.getRangeMin()) / rbw;
|
return (frequency - m_frequencyScale.getRangeMin()) / rbw;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t GLSpectrumView::binToFrequency(int bin) const
|
int64_t GLSpectrumView::binToFrequency(int bin) const
|
||||||
{
|
{
|
||||||
float rbw = m_sampleRate / (float)m_fftSize;
|
float rbw = (m_ssbSpectrum ? (m_sampleRate/2) : m_sampleRate) / (float)m_fftSize;
|
||||||
return m_frequencyScale.getRangeMin() + bin * rbw;
|
return m_frequencyScale.getRangeMin() + bin * rbw;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3453,6 +3453,9 @@ void GLSpectrumView::applyChanges()
|
|||||||
|
|
||||||
void GLSpectrumView::updateHistogramMarkers()
|
void GLSpectrumView::updateHistogramMarkers()
|
||||||
{
|
{
|
||||||
|
if (m_sampleRate == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
int64_t centerFrequency;
|
int64_t centerFrequency;
|
||||||
int frequencySpan;
|
int frequencySpan;
|
||||||
getFrequencyZoom(centerFrequency, frequencySpan);
|
getFrequencyZoom(centerFrequency, frequencySpan);
|
||||||
|
Loading…
Reference in New Issue
Block a user