1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 09:18:54 -05:00

Added shift to channel marker to take RIT into account

This commit is contained in:
f4exb 2024-07-13 13:01:32 +02:00
parent c99f2e1914
commit 51870a2ae1
4 changed files with 127 additions and 81 deletions

View File

@ -271,6 +271,7 @@ void WDSPRxGUI::on_rit_toggled(bool checked)
{ {
m_settings.m_rit = checked; m_settings.m_rit = checked;
m_settings.m_profiles[m_settings.m_profileIndex].m_rit = m_settings.m_rit; m_settings.m_profiles[m_settings.m_profileIndex].m_rit = m_settings.m_rit;
m_channelMarker.setShift(checked ? m_settings.m_ritFrequency: 0);
applySettings(); applySettings();
} }
@ -278,6 +279,7 @@ void WDSPRxGUI::on_ritFrequency_valueChanged(int value)
{ {
m_settings.m_ritFrequency = value; m_settings.m_ritFrequency = value;
ui->ritFrequencyText->setText(tr("%1").arg(value)); ui->ritFrequencyText->setText(tr("%1").arg(value));
m_channelMarker.setShift(m_settings.m_rit ? value: 0);
applySettings(); applySettings();
} }
@ -742,7 +744,11 @@ void WDSPRxGUI::applyBandwidths(unsigned int spanLog2, bool force)
m_channelMarker.setBandwidth(bw * 200); m_channelMarker.setBandwidth(bw * 200);
m_channelMarker.setSidebands(dsb ? ChannelMarker::dsb : bw < 0 ? ChannelMarker::lsb : ChannelMarker::usb); m_channelMarker.setSidebands(dsb ? ChannelMarker::dsb : bw < 0 ? ChannelMarker::lsb : ChannelMarker::usb);
ui->dsb->setIcon(bw < 0 ? m_iconDSBLSB: m_iconDSBUSB); ui->dsb->setIcon(bw < 0 ? m_iconDSBLSB: m_iconDSBUSB);
if (!dsb) { m_channelMarker.setLowCutoff(lw * 100); }
if (!dsb) {
m_channelMarker.setLowCutoff(lw * 100);
}
blockApplySettings(wasBlocked); blockApplySettings(wasBlocked);
} }
@ -753,6 +759,10 @@ void WDSPRxGUI::displaySettings()
m_channelMarker.setBandwidth(m_settings.m_profiles[m_settings.m_profileIndex].m_highCutoff * 2); m_channelMarker.setBandwidth(m_settings.m_profiles[m_settings.m_profileIndex].m_highCutoff * 2);
m_channelMarker.setTitle(m_settings.m_title); m_channelMarker.setTitle(m_settings.m_title);
m_channelMarker.setLowCutoff(m_settings.m_profiles[m_settings.m_profileIndex].m_lowCutoff); m_channelMarker.setLowCutoff(m_settings.m_profiles[m_settings.m_profileIndex].m_lowCutoff);
int shift = m_settings.m_profiles[m_settings.m_profileIndex].m_rit ?
m_settings.m_profiles[m_settings.m_profileIndex].m_ritFrequency :
0;
m_channelMarker.setShift(shift);
if (m_deviceUISet->m_deviceMIMOEngine) if (m_deviceUISet->m_deviceMIMOEngine)
{ {

View File

@ -52,6 +52,7 @@ ChannelMarker::ChannelMarker(QObject* parent) :
m_bandwidth(0), m_bandwidth(0),
m_oppositeBandwidth(0), m_oppositeBandwidth(0),
m_lowCutoff(0), m_lowCutoff(0),
m_shift(0),
m_sidebands(dsb), m_sidebands(dsb),
m_visible(false), m_visible(false),
m_highlighted(false), m_highlighted(false),
@ -107,6 +108,12 @@ void ChannelMarker::setLowCutoff(int lowCutoff)
emit changedByAPI(); emit changedByAPI();
} }
void ChannelMarker::setShift(int shift)
{
m_shift = shift;
emit changedByAPI();
}
void ChannelMarker::setSidebands(sidebands_t sidebands) void ChannelMarker::setSidebands(sidebands_t sidebands)
{ {
m_sidebands = sidebands; m_sidebands = sidebands;

View File

@ -42,11 +42,11 @@ public:
typedef enum frequencyScaleDisplay_e typedef enum frequencyScaleDisplay_e
{ {
FScaleDisplay_freq, FScaleDisplay_freq,
FScaleDisplay_title, FScaleDisplay_title,
FScaleDisplay_addressSend, FScaleDisplay_addressSend,
FScaleDisplay_addressReceive, FScaleDisplay_addressReceive,
FScaleDisplay_none FScaleDisplay_none
} frequencyScaleDisplay_t; } frequencyScaleDisplay_t;
ChannelMarker(QObject* parent = NULL); ChannelMarker(QObject* parent = NULL);
@ -69,6 +69,9 @@ public:
void setLowCutoff(int lowCutoff); void setLowCutoff(int lowCutoff);
int getLowCutoff() const { return m_lowCutoff; } int getLowCutoff() const { return m_lowCutoff; }
void setShift(int shift);
int getShift() const { return m_shift; }
void setSidebands(sidebands_t sidebands); void setSidebands(sidebands_t sidebands);
sidebands_t getSidebands() const { return m_sidebands; } sidebands_t getSidebands() const { return m_sidebands; }
@ -118,6 +121,7 @@ protected:
int m_bandwidth; int m_bandwidth;
int m_oppositeBandwidth; int m_oppositeBandwidth;
int m_lowCutoff; int m_lowCutoff;
int m_shift;
sidebands_t m_sidebands; sidebands_t m_sidebands;
bool m_visible; bool m_visible;
bool m_highlighted; bool m_highlighted;

View File

@ -564,9 +564,17 @@ void GLSpectrumView::setUseCalibration(bool useCalibration)
update(); update();
} }
void GLSpectrumView::setMeasurementParams(SpectrumSettings::Measurement measurement, void GLSpectrumView::setMeasurementParams(
int centerFrequencyOffset, int bandwidth, int chSpacing, int adjChBandwidth, SpectrumSettings::Measurement measurement,
int harmonics, int peaks, bool highlight, int precision) int centerFrequencyOffset,
int bandwidth,
int chSpacing,
int adjChBandwidth,
int harmonics,
int peaks,
bool highlight,
int precision
)
{ {
m_mutex.lock(); m_mutex.lock();
m_measurement = measurement; m_measurement = measurement;
@ -1280,16 +1288,16 @@ void GLSpectrumView::paintGL()
GLfloat h = m_frequencyPixmap.height() / (GLfloat) m_waterfallHeight; GLfloat h = m_frequencyPixmap.height() / (GLfloat) m_waterfallHeight;
GLfloat vtx1[] = { GLfloat vtx1[] = {
-l, -h, -l, - h,
1.0f+r, -h, 1.0f+r, -h,
1.0f+r, 0.0f, 1.0f+r, 0.0f,
-l, 0.0f -l, 0.0f
}; };
GLfloat tex1[] = { GLfloat tex1[] = {
0, 1, 0, 1,
1, 1, 1, 1,
1, 0, 1, 0,
0, 0 0, 0
}; };
m_glShaderFrequencyScale.drawSurface(spectrogramGridMatrix, tex1, vtx1, 4); m_glShaderFrequencyScale.drawSurface(spectrogramGridMatrix, tex1, vtx1, 4);
@ -1300,16 +1308,16 @@ void GLSpectrumView::paintGL()
GLfloat h = (m_bottomMargin/2) / (GLfloat) m_waterfallHeight; // m_bottomMargin is fm.ascent GLfloat h = (m_bottomMargin/2) / (GLfloat) m_waterfallHeight; // m_bottomMargin is fm.ascent
GLfloat vtx1[] = { GLfloat vtx1[] = {
-w, 0.0f-h, -w, 0.0f-h,
0.0f, 0.0f-h, 0.0f, 0.0f-h,
0.0f, 1.0f+h, 0.0f, 1.0f+h,
-w, 1.0f+h -w, 1.0f+h
}; };
GLfloat tex1[] = { GLfloat tex1[] = {
0, 1, 0, 1,
1, 1, 1, 1,
1, 0, 1, 0,
0, 0 0, 0
}; };
m_glShaderSpectrogramTimeScale.drawSurface(spectrogramGridMatrix, tex1, vtx1, 4); m_glShaderSpectrogramTimeScale.drawSurface(spectrogramGridMatrix, tex1, vtx1, 4);
@ -1320,16 +1328,16 @@ void GLSpectrumView::paintGL()
GLfloat h = m_topMargin / (GLfloat) m_spectrogramPowerPixmap.height(); GLfloat h = m_topMargin / (GLfloat) m_spectrogramPowerPixmap.height();
GLfloat vtx1[] = { GLfloat vtx1[] = {
-w, 1.0f, 0.0f, -w, 1.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f,
0.0f, 1.0f, 1.0f+h, 0.0f, 1.0f, 1.0f+h,
-w, 1.0f, 1.0f+h, -w, 1.0f, 1.0f+h,
}; };
GLfloat tex1[] = { GLfloat tex1[] = {
0, 1, 0, 1,
1, 1, 1, 1,
1, 0, 1, 0,
0, 0 0, 0
}; };
m_glShaderSpectrogramPowerScale.drawSurface(spectrogramGridMatrix, tex1, vtx1, 4, 3); m_glShaderSpectrogramPowerScale.drawSurface(spectrogramGridMatrix, tex1, vtx1, 4, 3);
@ -2201,13 +2209,22 @@ void GLSpectrumView::measurePeak()
findPeak(power, frequency); findPeak(power, frequency);
drawTextsRight( drawTextsRight(
{"Peak: ", ""},
{ {
displayPower(power, m_linear ? 'e' : 'f', m_linear ? 3 : 1), "Peak: ",
displayFull(frequency) ""
}, },
{m_peakPowerMaxStr, m_peakFrequencyMaxStr}, {
{m_peakPowerUnits, "Hz"} displayPower(power, m_linear ? 'e' : 'f', m_linear ? 3 : 1),
displayFull(frequency)
},
{
m_peakPowerMaxStr,
m_peakFrequencyMaxStr
},
{
m_peakPowerUnits,
"Hz"
}
); );
if (m_measurements) { if (m_measurements) {
m_measurements->setPeak(0, frequency, power); m_measurements->setPeak(0, frequency, power);
@ -2231,8 +2248,8 @@ void GLSpectrumView::measurePeaks()
right--; right--;
float power = m_linear ? float power = m_linear ?
spectrum[peakBin] * (m_useCalibration ? m_calibrationGain : 1.0f) : spectrum[peakBin] * (m_useCalibration ? m_calibrationGain : 1.0f) :
spectrum[peakBin] + (m_useCalibration ? m_calibrationShiftdB : 0.0f); spectrum[peakBin] + (m_useCalibration ? m_calibrationShiftdB : 0.0f);
int64_t frequency = binToFrequency(peakBin); int64_t frequency = binToFrequency(peakBin);
// Add to table // Add to table
@ -2767,7 +2784,7 @@ void GLSpectrumView::applyChanges()
m_glWaterfallBoxMatrix.setToIdentity(); m_glWaterfallBoxMatrix.setToIdentity();
m_glWaterfallBoxMatrix.translate( m_glWaterfallBoxMatrix.translate(
-1.0f + ((float)(2*m_leftMargin) / (float) width()), -1.0f + ((float)(2*m_leftMargin) / (float) width()),
1.0f - ((float)(2*waterfallTop) / (float) height()) 1.0f - ((float)(2*waterfallTop) / (float) height())
); );
m_glWaterfallBoxMatrix.scale( m_glWaterfallBoxMatrix.scale(
((float) 2 * (width() - m_leftMargin - m_rightMargin)) / (float) width(), ((float) 2 * (width() - m_leftMargin - m_rightMargin)) / (float) width(),
@ -2777,7 +2794,7 @@ void GLSpectrumView::applyChanges()
m_glHistogramBoxMatrix.setToIdentity(); m_glHistogramBoxMatrix.setToIdentity();
m_glHistogramBoxMatrix.translate( m_glHistogramBoxMatrix.translate(
-1.0f + ((float)(2*m_leftMargin) / (float) width()), -1.0f + ((float)(2*m_leftMargin) / (float) width()),
1.0f - ((float)(2*histogramTop) / (float) height()) 1.0f - ((float)(2*histogramTop) / (float) height())
); );
m_glHistogramBoxMatrix.scale( m_glHistogramBoxMatrix.scale(
((float) 2 * (width() - m_leftMargin - m_rightMargin)) / (float) width(), ((float) 2 * (width() - m_leftMargin - m_rightMargin)) / (float) width(),
@ -2787,7 +2804,7 @@ void GLSpectrumView::applyChanges()
m_glHistogramSpectrumMatrix.setToIdentity(); m_glHistogramSpectrumMatrix.setToIdentity();
m_glHistogramSpectrumMatrix.translate( m_glHistogramSpectrumMatrix.translate(
-1.0f + ((float)(2*m_leftMargin) / (float) width()), -1.0f + ((float)(2*m_leftMargin) / (float) width()),
1.0f - ((float)(2*histogramTop) / (float) height()) 1.0f - ((float)(2*histogramTop) / (float) height())
); );
m_glHistogramSpectrumMatrix.scale( m_glHistogramSpectrumMatrix.scale(
((float) 2 * (width() - m_leftMargin - m_rightMargin)) / ((float) width() * (float)(m_nbBins)), ((float) 2 * (width() - m_leftMargin - m_rightMargin)) / ((float) width() * (float)(m_nbBins)),
@ -2804,7 +2821,7 @@ void GLSpectrumView::applyChanges()
m_glFrequencyScaleBoxMatrix.setToIdentity(); m_glFrequencyScaleBoxMatrix.setToIdentity();
m_glFrequencyScaleBoxMatrix.translate ( m_glFrequencyScaleBoxMatrix.translate (
-1.0f, -1.0f,
1.0f - ((float) 2*frequencyScaleTop / (float) height()) 1.0f - ((float) 2*frequencyScaleTop / (float) height())
); );
m_glFrequencyScaleBoxMatrix.scale ( m_glFrequencyScaleBoxMatrix.scale (
2.0f, 2.0f,
@ -2864,7 +2881,7 @@ void GLSpectrumView::applyChanges()
m_glWaterfallBoxMatrix.setToIdentity(); m_glWaterfallBoxMatrix.setToIdentity();
m_glWaterfallBoxMatrix.translate( m_glWaterfallBoxMatrix.translate(
-1.0f + ((float)(2*m_leftMargin) / (float) width()), -1.0f + ((float)(2*m_leftMargin) / (float) width()),
1.0f - ((float)(2*m_topMargin) / (float) height()) 1.0f - ((float)(2*m_topMargin) / (float) height())
); );
m_glWaterfallBoxMatrix.scale( m_glWaterfallBoxMatrix.scale(
((float) 2 * (width() - m_leftMargin - m_rightMargin)) / (float) width(), ((float) 2 * (width() - m_leftMargin - m_rightMargin)) / (float) width(),
@ -2881,7 +2898,7 @@ void GLSpectrumView::applyChanges()
m_glFrequencyScaleBoxMatrix.setToIdentity(); m_glFrequencyScaleBoxMatrix.setToIdentity();
m_glFrequencyScaleBoxMatrix.translate ( m_glFrequencyScaleBoxMatrix.translate (
-1.0f, -1.0f,
1.0f - ((float) 2*frequencyScaleTop / (float) height()) 1.0f - ((float) 2*frequencyScaleTop / (float) height())
); );
m_glFrequencyScaleBoxMatrix.scale ( m_glFrequencyScaleBoxMatrix.scale (
2.0f, 2.0f,
@ -2915,7 +2932,7 @@ void GLSpectrumView::applyChanges()
m_glHistogramSpectrumMatrix.setToIdentity(); m_glHistogramSpectrumMatrix.setToIdentity();
m_glHistogramSpectrumMatrix.translate( m_glHistogramSpectrumMatrix.translate(
-1.0f + ((float)(2*m_leftMargin) / (float) width()), -1.0f + ((float)(2*m_leftMargin) / (float) width()),
1.0f - ((float)(2*histogramTop) / (float) height()) 1.0f - ((float)(2*histogramTop) / (float) height())
); );
m_glHistogramSpectrumMatrix.scale( m_glHistogramSpectrumMatrix.scale(
((float) 2 * (width() - m_leftMargin - m_rightMargin)) / ((float) width() * (float)(m_nbBins)), ((float) 2 * (width() - m_leftMargin - m_rightMargin)) / ((float) width() * (float)(m_nbBins)),
@ -2925,7 +2942,7 @@ void GLSpectrumView::applyChanges()
m_glHistogramBoxMatrix.setToIdentity(); m_glHistogramBoxMatrix.setToIdentity();
m_glHistogramBoxMatrix.translate( m_glHistogramBoxMatrix.translate(
-1.0f + ((float)(2*m_leftMargin) / (float) width()), -1.0f + ((float)(2*m_leftMargin) / (float) width()),
1.0f - ((float)(2*histogramTop) / (float) height()) 1.0f - ((float)(2*histogramTop) / (float) height())
); );
m_glHistogramBoxMatrix.scale( m_glHistogramBoxMatrix.scale(
((float) 2 * (width() - m_leftMargin - m_rightMargin)) / (float) width(), ((float) 2 * (width() - m_leftMargin - m_rightMargin)) / (float) width(),
@ -2942,7 +2959,7 @@ void GLSpectrumView::applyChanges()
m_glFrequencyScaleBoxMatrix.setToIdentity(); m_glFrequencyScaleBoxMatrix.setToIdentity();
m_glFrequencyScaleBoxMatrix.translate ( m_glFrequencyScaleBoxMatrix.translate (
-1.0f, -1.0f,
1.0f - ((float) 2*frequencyScaleTop / (float) height()) 1.0f - ((float) 2*frequencyScaleTop / (float) height())
); );
m_glFrequencyScaleBoxMatrix.scale ( m_glFrequencyScaleBoxMatrix.scale (
2.0f, 2.0f,
@ -3032,23 +3049,31 @@ void GLSpectrumView::applyChanges()
xc = m_centerFrequency + dv->m_channelMarker->getCenterFrequency(); // marker center frequency xc = m_centerFrequency + dv->m_channelMarker->getCenterFrequency(); // marker center frequency
dsbw = dv->m_channelMarker->getBandwidth(); dsbw = dv->m_channelMarker->getBandwidth();
if (sidebands == ChannelMarker::usb) { if (sidebands == ChannelMarker::usb)
nw = dv->m_channelMarker->getLowCutoff(); // negative bandwidth {
nw = dv->m_channelMarker->getLowCutoff() + dv->m_channelMarker->getShift(); // negative bandwidth
int bw = dv->m_channelMarker->getBandwidth() / 2; int bw = dv->m_channelMarker->getBandwidth() / 2;
pw = (qreal) bw; // positive bandwidth pw = (qreal) bw + dv->m_channelMarker->getShift(); // positive bandwidth
} else if (sidebands == ChannelMarker::lsb) { }
pw = dv->m_channelMarker->getLowCutoff(); else if (sidebands == ChannelMarker::lsb)
{
pw = dv->m_channelMarker->getLowCutoff() + dv->m_channelMarker->getShift();
int bw = dv->m_channelMarker->getBandwidth() / 2; int bw = dv->m_channelMarker->getBandwidth() / 2;
nw = (qreal) bw; nw = (qreal) bw + dv->m_channelMarker->getShift();
} else if (sidebands == ChannelMarker::vusb) { }
nw = -dv->m_channelMarker->getOppositeBandwidth(); // negative bandwidth else if (sidebands == ChannelMarker::vusb)
pw = dv->m_channelMarker->getBandwidth(); // positive bandwidth {
} else if (sidebands == ChannelMarker::vlsb) { nw = -dv->m_channelMarker->getOppositeBandwidth() + dv->m_channelMarker->getShift(); // negative bandwidth
pw = dv->m_channelMarker->getOppositeBandwidth(); // positive bandwidth pw = dv->m_channelMarker->getBandwidth() + dv->m_channelMarker->getShift(); // positive bandwidth
nw = -dv->m_channelMarker->getBandwidth(); // negative bandwidth }
} else { else if (sidebands == ChannelMarker::vlsb) {
pw = dsbw / 2; pw = dv->m_channelMarker->getOppositeBandwidth() + dv->m_channelMarker->getShift(); // positive bandwidth
nw = -pw; nw = -dv->m_channelMarker->getBandwidth() + dv->m_channelMarker->getShift(); // negative bandwidth
}
else
{
pw = (dsbw / 2) + dv->m_channelMarker->getShift();
nw = -(dsbw / 2) + dv->m_channelMarker->getShift();
} }
// draw the DSB rectangle // draw the DSB rectangle
@ -3057,7 +3082,7 @@ void GLSpectrumView::applyChanges()
glMatrixDsb.setToIdentity(); glMatrixDsb.setToIdentity();
glMatrixDsb.translate( glMatrixDsb.translate(
-1.0f + 2.0f * ((m_leftMargin + m_frequencyScale.getPosFromValue(xc - (dsbw/2))) / (float) width()), -1.0f + 2.0f * ((m_leftMargin + m_frequencyScale.getPosFromValue(xc - (dsbw/2))) / (float) width()),
1.0f 1.0f
); );
glMatrixDsb.scale( glMatrixDsb.scale(
2.0f * (dsbw / (float) frequencySpan), 2.0f * (dsbw / (float) frequencySpan),
@ -3066,8 +3091,8 @@ void GLSpectrumView::applyChanges()
dv->m_glMatrixDsbWaterfall = glMatrixDsb; dv->m_glMatrixDsbWaterfall = glMatrixDsb;
dv->m_glMatrixDsbWaterfall.translate( dv->m_glMatrixDsbWaterfall.translate(
0.0f, 0.0f,
(float) waterfallTop / (float) height() (float) waterfallTop / (float) height()
); );
dv->m_glMatrixDsbWaterfall.scale( dv->m_glMatrixDsbWaterfall.scale(
(float) (width() - m_leftMargin - m_rightMargin) / (float) width(), (float) (width() - m_leftMargin - m_rightMargin) / (float) width(),
@ -3076,8 +3101,8 @@ void GLSpectrumView::applyChanges()
dv->m_glMatrixDsbHistogram = glMatrixDsb; dv->m_glMatrixDsbHistogram = glMatrixDsb;
dv->m_glMatrixDsbHistogram.translate( dv->m_glMatrixDsbHistogram.translate(
0.0f, 0.0f,
(float) histogramTop / (float) height() (float) histogramTop / (float) height()
); );
dv->m_glMatrixDsbHistogram.scale( dv->m_glMatrixDsbHistogram.scale(
(float) (width() - m_leftMargin - m_rightMargin) / (float) width(), (float) (width() - m_leftMargin - m_rightMargin) / (float) width(),
@ -3086,8 +3111,8 @@ void GLSpectrumView::applyChanges()
dv->m_glMatrixDsbFreqScale = glMatrixDsb; dv->m_glMatrixDsbFreqScale = glMatrixDsb;
dv->m_glMatrixDsbFreqScale.translate( dv->m_glMatrixDsbFreqScale.translate(
0.0f, 0.0f,
(float) frequencyScaleTop / (float) height() (float) frequencyScaleTop / (float) height()
); );
dv->m_glMatrixDsbFreqScale.scale( dv->m_glMatrixDsbFreqScale.scale(
(float) (width() - m_leftMargin - m_rightMargin) / (float) width(), (float) (width() - m_leftMargin - m_rightMargin) / (float) width(),
@ -3100,7 +3125,7 @@ void GLSpectrumView::applyChanges()
glMatrix.setToIdentity(); glMatrix.setToIdentity();
glMatrix.translate( glMatrix.translate(
-1.0f + 2.0f * ((m_leftMargin + m_frequencyScale.getPosFromValue(xc + nw)) / (float) width()), -1.0f + 2.0f * ((m_leftMargin + m_frequencyScale.getPosFromValue(xc + nw)) / (float) width()),
1.0f 1.0f
); );
glMatrix.scale( glMatrix.scale(
2.0f * ((pw-nw) / (float) frequencySpan), 2.0f * ((pw-nw) / (float) frequencySpan),
@ -3109,8 +3134,8 @@ void GLSpectrumView::applyChanges()
dv->m_glMatrixWaterfall = glMatrix; dv->m_glMatrixWaterfall = glMatrix;
dv->m_glMatrixWaterfall.translate( dv->m_glMatrixWaterfall.translate(
0.0f, 0.0f,
(float) waterfallTop / (float) height() (float) waterfallTop / (float) height()
); );
dv->m_glMatrixWaterfall.scale( dv->m_glMatrixWaterfall.scale(
(float) (width() - m_leftMargin - m_rightMargin) / (float) width(), (float) (width() - m_leftMargin - m_rightMargin) / (float) width(),
@ -3119,8 +3144,8 @@ void GLSpectrumView::applyChanges()
dv->m_glMatrixHistogram = glMatrix; dv->m_glMatrixHistogram = glMatrix;
dv->m_glMatrixHistogram.translate( dv->m_glMatrixHistogram.translate(
0.0f, 0.0f,
(float) histogramTop / (float) height() (float) histogramTop / (float) height()
); );
dv->m_glMatrixHistogram.scale( dv->m_glMatrixHistogram.scale(
(float) (width() - m_leftMargin - m_rightMargin) / (float) width(), (float) (width() - m_leftMargin - m_rightMargin) / (float) width(),
@ -3129,8 +3154,8 @@ void GLSpectrumView::applyChanges()
dv->m_glMatrixFreqScale = glMatrix; dv->m_glMatrixFreqScale = glMatrix;
dv->m_glMatrixFreqScale.translate( dv->m_glMatrixFreqScale.translate(
0.0f, 0.0f,
(float) frequencyScaleTop / (float) height() (float) frequencyScaleTop / (float) height()
); );
dv->m_glMatrixFreqScale.scale( dv->m_glMatrixFreqScale.scale(
(float) (width() - m_leftMargin - m_rightMargin) / (float) width(), (float) (width() - m_leftMargin - m_rightMargin) / (float) width(),
@ -3527,7 +3552,7 @@ void GLSpectrumView::updateHistogramPeaks()
if ((m_histogramMarkers.at(i).m_markerType == SpectrumHistogramMarker::SpectrumMarkerTypePower) || if ((m_histogramMarkers.at(i).m_markerType == SpectrumHistogramMarker::SpectrumMarkerTypePower) ||
((m_histogramMarkers.at(i).m_markerType == SpectrumHistogramMarker::SpectrumMarkerTypePowerMax) && ((m_histogramMarkers.at(i).m_markerType == SpectrumHistogramMarker::SpectrumMarkerTypePowerMax) &&
(m_histogramMarkers.at(i).m_holdReset || (power > m_histogramMarkers.at(i).m_powerMax)))) (m_histogramMarkers.at(i).m_holdReset || (power > m_histogramMarkers.at(i).m_powerMax))))
{ {
float binSize = m_frequencyScale.getRange() / m_nbBins; float binSize = m_frequencyScale.getRange() / m_nbBins;
m_histogramMarkers[i].m_fftBin = fftBin; m_histogramMarkers[i].m_fftBin = fftBin;
@ -3664,7 +3689,7 @@ void GLSpectrumView::updateCalibrationPoints()
else if (m_calibrationPoints.size() == 1) else if (m_calibrationPoints.size() == 1)
{ {
m_calibrationGain = m_calibrationPoints.first().m_powerCalibratedReference / m_calibrationGain = m_calibrationPoints.first().m_powerCalibratedReference /
m_calibrationPoints.first().m_powerRelativeReference; m_calibrationPoints.first().m_powerRelativeReference;
m_calibrationShiftdB = CalcDb::dbPower(m_calibrationGain); m_calibrationShiftdB = CalcDb::dbPower(m_calibrationGain);
} }
else else
@ -4310,7 +4335,7 @@ void GLSpectrumView::wheelEvent(QWheelEvent *event)
// Other mice/trackpads use smaller values // Other mice/trackpads use smaller values
int delta = event->angleDelta().y(); int delta = event->angleDelta().y();
if (delta != 0) { if (delta != 0) {
m_glShaderSpectrogram.verticalAngle(-5.0*delta/120.0); m_glShaderSpectrogram.verticalAngle(-5.0*delta/120.0);
} }
repaint(); // Force repaint in case acquisition is stopped repaint(); // Force repaint in case acquisition is stopped
} }