mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-22 16:08:39 -05:00
FFT overlap: time scale correction. Implements #770
This commit is contained in:
parent
b4e4450ce3
commit
7827800d13
@ -250,6 +250,15 @@ void GLSpectrum::setTimingRate(qint32 timingRate)
|
||||
update();
|
||||
}
|
||||
|
||||
void GLSpectrum::setFFTOverlap(int overlap)
|
||||
{
|
||||
m_mutex.lock();
|
||||
m_fftOverlap = overlap;
|
||||
m_changesPending = true;
|
||||
m_mutex.unlock();
|
||||
update();
|
||||
}
|
||||
|
||||
void GLSpectrum::setDisplayWaterfall(bool display)
|
||||
{
|
||||
m_mutex.lock();
|
||||
@ -1292,6 +1301,8 @@ void GLSpectrum::applyChanges()
|
||||
if (m_sampleRate > 0)
|
||||
{
|
||||
float scaleDiv = ((float)m_sampleRate / (float)m_timingRate) * (m_ssbSpectrum ? 2 : 1);
|
||||
float halfFFTSize = m_fftSize / 2;
|
||||
scaleDiv *= halfFFTSize / (halfFFTSize - m_fftOverlap);
|
||||
|
||||
if (!m_invertedWaterfall) {
|
||||
m_timeScale.setRange(m_timingRate > 1 ? Unit::TimeHMS : Unit::Time, (m_waterfallHeight * m_fftSize) / scaleDiv, 0);
|
||||
@ -1393,6 +1404,8 @@ void GLSpectrum::applyChanges()
|
||||
if (m_sampleRate > 0)
|
||||
{
|
||||
float scaleDiv = ((float)m_sampleRate / (float)m_timingRate) * (m_ssbSpectrum ? 2 : 1);
|
||||
float halfFFTSize = m_fftSize / 2;
|
||||
scaleDiv *= halfFFTSize / (halfFFTSize - m_fftOverlap);
|
||||
|
||||
if (!m_invertedWaterfall) {
|
||||
m_timeScale.setRange(m_timingRate > 1 ? Unit::TimeHMS : Unit::Time, (m_waterfallHeight * m_fftSize) / scaleDiv, 0);
|
||||
|
@ -80,6 +80,7 @@ public:
|
||||
void setCenterFrequency(qint64 frequency);
|
||||
void setSampleRate(qint32 sampleRate);
|
||||
void setTimingRate(qint32 timingRate);
|
||||
void setFFTOverlap(int overlap);
|
||||
void setReferenceLevel(Real referenceLevel);
|
||||
void setPowerRange(Real powerRange);
|
||||
void setDecay(int decay);
|
||||
@ -248,6 +249,7 @@ private:
|
||||
int m_decay;
|
||||
quint32 m_sampleRate;
|
||||
quint32 m_timingRate;
|
||||
int m_fftOverlap;
|
||||
|
||||
int m_fftSize;
|
||||
|
||||
|
@ -522,6 +522,10 @@ void GLSpectrumGUI::setMaximumOverlap()
|
||||
ui->fftOverlap->setMaximum((m_settings.m_fftSize/2)-1);
|
||||
int value = ui->fftOverlap->value();
|
||||
ui->fftOverlapText->setText(tr("%1").arg(value));
|
||||
|
||||
if (m_glSpectrum) {
|
||||
m_glSpectrum->setFFTOverlap(value);
|
||||
}
|
||||
}
|
||||
|
||||
bool GLSpectrumGUI::handleMessage(const Message& message)
|
||||
|
Loading…
Reference in New Issue
Block a user