mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-09-04 22:27:53 -04:00
Spectrum frequency zoom: update channel markers accordingly
This commit is contained in:
parent
4d99533009
commit
1765298c2c
@ -1344,9 +1344,7 @@ void GLSpectrum::applyChanges()
|
|||||||
|
|
||||||
m_leftMargin += 2 * M;
|
m_leftMargin += 2 * M;
|
||||||
|
|
||||||
m_frequencyScale.setSize(width() - m_leftMargin - m_rightMargin);
|
setFrequencyScale();
|
||||||
m_frequencyScale.setRange(Unit::Frequency, m_centerFrequency - m_sampleRate / 2, m_centerFrequency + m_sampleRate / 2);
|
|
||||||
m_frequencyScale.setMakeOpposite(m_lsbDisplay);
|
|
||||||
|
|
||||||
m_glWaterfallBoxMatrix.setToIdentity();
|
m_glWaterfallBoxMatrix.setToIdentity();
|
||||||
m_glWaterfallBoxMatrix.translate(
|
m_glWaterfallBoxMatrix.translate(
|
||||||
@ -1438,9 +1436,7 @@ void GLSpectrum::applyChanges()
|
|||||||
m_leftMargin = m_timeScale.getScaleWidth();
|
m_leftMargin = m_timeScale.getScaleWidth();
|
||||||
m_leftMargin += 2 * M;
|
m_leftMargin += 2 * M;
|
||||||
|
|
||||||
m_frequencyScale.setSize(width() - m_leftMargin - m_rightMargin);
|
setFrequencyScale();
|
||||||
m_frequencyScale.setRange(Unit::Frequency, m_centerFrequency - m_sampleRate / 2.0, m_centerFrequency + m_sampleRate / 2.0);
|
|
||||||
m_frequencyScale.setMakeOpposite(m_lsbDisplay);
|
|
||||||
|
|
||||||
m_glWaterfallBoxMatrix.setToIdentity();
|
m_glWaterfallBoxMatrix.setToIdentity();
|
||||||
m_glWaterfallBoxMatrix.translate(
|
m_glWaterfallBoxMatrix.translate(
|
||||||
@ -1490,9 +1486,7 @@ void GLSpectrum::applyChanges()
|
|||||||
m_leftMargin = m_powerScale.getScaleWidth();
|
m_leftMargin = m_powerScale.getScaleWidth();
|
||||||
m_leftMargin += 2 * M;
|
m_leftMargin += 2 * M;
|
||||||
|
|
||||||
m_frequencyScale.setSize(width() - m_leftMargin - m_rightMargin);
|
setFrequencyScale();
|
||||||
m_frequencyScale.setRange(Unit::Frequency, m_centerFrequency - m_sampleRate / 2, m_centerFrequency + m_sampleRate / 2);
|
|
||||||
m_frequencyScale.setMakeOpposite(m_lsbDisplay);
|
|
||||||
|
|
||||||
m_glHistogramSpectrumMatrix.setToIdentity();
|
m_glHistogramSpectrumMatrix.setToIdentity();
|
||||||
m_glHistogramSpectrumMatrix.translate(
|
m_glHistogramSpectrumMatrix.translate(
|
||||||
@ -1591,6 +1585,19 @@ void GLSpectrum::applyChanges()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// channel overlays
|
// channel overlays
|
||||||
|
int64_t centerFrequency;
|
||||||
|
int frequencySpan;
|
||||||
|
|
||||||
|
if (m_frequencyZoomFactor == 1.0f)
|
||||||
|
{
|
||||||
|
centerFrequency = m_centerFrequency;
|
||||||
|
frequencySpan = m_sampleRate;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
getFrequencyZoom(centerFrequency, frequencySpan);
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < m_channelMarkerStates.size(); ++i)
|
for (int i = 0; i < m_channelMarkerStates.size(); ++i)
|
||||||
{
|
{
|
||||||
ChannelMarkerState* dv = m_channelMarkerStates[i];
|
ChannelMarkerState* dv = m_channelMarkerStates[i];
|
||||||
@ -1628,7 +1635,7 @@ void GLSpectrum::applyChanges()
|
|||||||
1.0f
|
1.0f
|
||||||
);
|
);
|
||||||
glMatrixDsb.scale(
|
glMatrixDsb.scale(
|
||||||
2.0f * (dsbw / (float)m_sampleRate),
|
2.0f * (dsbw / (float) frequencySpan),
|
||||||
-2.0f
|
-2.0f
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1671,7 +1678,7 @@ void GLSpectrum::applyChanges()
|
|||||||
1.0f
|
1.0f
|
||||||
);
|
);
|
||||||
glMatrix.scale(
|
glMatrix.scale(
|
||||||
2.0f * ((pw-nw) / (float)m_sampleRate),
|
2.0f * ((pw-nw) / (float) frequencySpan),
|
||||||
-2.0f
|
-2.0f
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -2264,6 +2271,25 @@ void GLSpectrum::updateFFTLimits()
|
|||||||
m_spectrumVis->getInputMessageQueue()->push(msg);
|
m_spectrumVis->getInputMessageQueue()->push(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GLSpectrum::setFrequencyScale()
|
||||||
|
{
|
||||||
|
int frequencySpan;
|
||||||
|
int64_t centerFrequency;
|
||||||
|
|
||||||
|
getFrequencyZoom(centerFrequency, frequencySpan);
|
||||||
|
m_frequencyScale.setSize(width() - m_leftMargin - m_rightMargin);
|
||||||
|
m_frequencyScale.setRange(Unit::Frequency, centerFrequency - frequencySpan / 2.0, centerFrequency + frequencySpan / 2.0);
|
||||||
|
m_frequencyScale.setMakeOpposite(m_lsbDisplay);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLSpectrum::getFrequencyZoom(int64_t& centerFrequency, int& frequencySpan)
|
||||||
|
{
|
||||||
|
frequencySpan = (m_frequencyZoomFactor == 1) ?
|
||||||
|
m_sampleRate : m_sampleRate * (1.0 / m_frequencyZoomFactor);
|
||||||
|
centerFrequency = (m_frequencyZoomFactor == 1) ?
|
||||||
|
m_centerFrequency : (m_frequencyZoomPos - 0.5) * m_sampleRate + m_centerFrequency;
|
||||||
|
}
|
||||||
|
|
||||||
// void GLSpectrum::updateFFTLimits()
|
// void GLSpectrum::updateFFTLimits()
|
||||||
// {
|
// {
|
||||||
// m_fftMin = m_frequencyZoomFactor == 1 ? 0 : (m_frequencyZoomPos - (0.5f / m_frequencyZoomFactor)) * m_fftSize;
|
// m_fftMin = m_frequencyZoomFactor == 1 ? 0 : (m_frequencyZoomPos - (0.5f / m_frequencyZoomFactor)) * m_fftSize;
|
||||||
|
@ -347,6 +347,8 @@ private:
|
|||||||
void frequencyZoom(QWheelEvent*);
|
void frequencyZoom(QWheelEvent*);
|
||||||
void resetFrequencyZoom();
|
void resetFrequencyZoom();
|
||||||
void updateFFTLimits();
|
void updateFFTLimits();
|
||||||
|
void setFrequencyScale();
|
||||||
|
void getFrequencyZoom(int64_t& centerFrequency, int& frequencySpan);
|
||||||
|
|
||||||
void enterEvent(QEvent* event);
|
void enterEvent(QEvent* event);
|
||||||
void leaveEvent(QEvent* event);
|
void leaveEvent(QEvent* event);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user