mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-02-03 09:44:01 -05:00
Spectrum: added log/linear control
This commit is contained in:
parent
51e5987158
commit
d5f153ff75
@ -359,7 +359,14 @@ BFMDemodGUI::BFMDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
|
|||||||
ui->glSpectrum->setDisplayWaterfall(false);
|
ui->glSpectrum->setDisplayWaterfall(false);
|
||||||
ui->glSpectrum->setDisplayMaxHold(false);
|
ui->glSpectrum->setDisplayMaxHold(false);
|
||||||
ui->glSpectrum->setSsbSpectrum(true);
|
ui->glSpectrum->setSsbSpectrum(true);
|
||||||
m_spectrumVis->configure(m_spectrumVis->getInputMessageQueue(), 64, 10, 0, 0, FFTWindow::BlackmanHarris);
|
m_spectrumVis->configure(
|
||||||
|
m_spectrumVis->getInputMessageQueue(),
|
||||||
|
64, // FFT size
|
||||||
|
10, // overlapping %
|
||||||
|
0, // number of averaging samples
|
||||||
|
0, // no averaging
|
||||||
|
FFTWindow::BlackmanHarris,
|
||||||
|
false); // logarithmic scale
|
||||||
connect(&MainWindow::getInstance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
|
connect(&MainWindow::getInstance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
|
||||||
|
|
||||||
m_channelMarker.blockSignals(true);
|
m_channelMarker.blockSignals(true);
|
||||||
|
@ -187,7 +187,13 @@ UDPSrcGUI::UDPSrcGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam
|
|||||||
ui->glSpectrum->setSampleRate(ui->sampleRate->text().toInt());
|
ui->glSpectrum->setSampleRate(ui->sampleRate->text().toInt());
|
||||||
ui->glSpectrum->setDisplayWaterfall(true);
|
ui->glSpectrum->setDisplayWaterfall(true);
|
||||||
ui->glSpectrum->setDisplayMaxHold(true);
|
ui->glSpectrum->setDisplayMaxHold(true);
|
||||||
m_spectrumVis->configure(m_spectrumVis->getInputMessageQueue(), 64, 10, 0, 0, FFTWindow::BlackmanHarris);
|
m_spectrumVis->configure(m_spectrumVis->getInputMessageQueue(),
|
||||||
|
64, // FFT size
|
||||||
|
10, // overlapping %
|
||||||
|
0, // number of averaging samples
|
||||||
|
0, // no averaging
|
||||||
|
FFTWindow::BlackmanHarris,
|
||||||
|
false); // logarithmic scale
|
||||||
|
|
||||||
ui->glSpectrum->connectTimer(MainWindow::getInstance()->getMasterTimer());
|
ui->glSpectrum->connectTimer(MainWindow::getInstance()->getMasterTimer());
|
||||||
connect(&MainWindow::getInstance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
|
connect(&MainWindow::getInstance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
|
||||||
|
@ -142,7 +142,13 @@ UDPSinkGUI::UDPSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandS
|
|||||||
ui->glSpectrum->setSampleRate(ui->sampleRate->text().toInt());
|
ui->glSpectrum->setSampleRate(ui->sampleRate->text().toInt());
|
||||||
ui->glSpectrum->setDisplayWaterfall(true);
|
ui->glSpectrum->setDisplayWaterfall(true);
|
||||||
ui->glSpectrum->setDisplayMaxHold(true);
|
ui->glSpectrum->setDisplayMaxHold(true);
|
||||||
m_spectrumVis->configure(m_spectrumVis->getInputMessageQueue(), 64, 10, 0, 0, FFTWindow::BlackmanHarris);
|
m_spectrumVis->configure(m_spectrumVis->getInputMessageQueue(),
|
||||||
|
64, // FFT size
|
||||||
|
10, // overlapping %
|
||||||
|
0, // number of averaging samples
|
||||||
|
0, // no averaging
|
||||||
|
FFTWindow::BlackmanHarris,
|
||||||
|
false); // logarithmic scale
|
||||||
|
|
||||||
ui->glSpectrum->connectTimer(MainWindow::getInstance()->getMasterTimer());
|
ui->glSpectrum->connectTimer(MainWindow::getInstance()->getMasterTimer());
|
||||||
connect(&MainWindow::getInstance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
|
connect(&MainWindow::getInstance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
|
||||||
|
@ -44,9 +44,10 @@ void SpectrumVis::configure(MessageQueue* msgQueue,
|
|||||||
int overlapPercent,
|
int overlapPercent,
|
||||||
unsigned int averagingNb,
|
unsigned int averagingNb,
|
||||||
int averagingMode,
|
int averagingMode,
|
||||||
FFTWindow::Function window)
|
FFTWindow::Function window,
|
||||||
|
bool linear)
|
||||||
{
|
{
|
||||||
MsgConfigureSpectrumVis* cmd = new MsgConfigureSpectrumVis(fftSize, overlapPercent, averagingNb, averagingMode, window);
|
MsgConfigureSpectrumVis* cmd = new MsgConfigureSpectrumVis(fftSize, overlapPercent, averagingNb, averagingMode, window, linear);
|
||||||
msgQueue->push(cmd);
|
msgQueue->push(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,12 +27,19 @@ public:
|
|||||||
MESSAGE_CLASS_DECLARATION
|
MESSAGE_CLASS_DECLARATION
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MsgConfigureSpectrumVis(int fftSize, int overlapPercent, unsigned int averageNb, int averagingMode, FFTWindow::Function window) :
|
MsgConfigureSpectrumVis(
|
||||||
|
int fftSize,
|
||||||
|
int overlapPercent,
|
||||||
|
unsigned int averageNb,
|
||||||
|
int averagingMode,
|
||||||
|
FFTWindow::Function window,
|
||||||
|
bool linear) :
|
||||||
Message(),
|
Message(),
|
||||||
m_fftSize(fftSize),
|
m_fftSize(fftSize),
|
||||||
m_overlapPercent(overlapPercent),
|
m_overlapPercent(overlapPercent),
|
||||||
m_averageNb(averageNb),
|
m_averageNb(averageNb),
|
||||||
m_window(window)
|
m_window(window),
|
||||||
|
m_linear(linear)
|
||||||
{
|
{
|
||||||
m_averagingMode = averagingMode < 0 ? AvgModeNone : averagingMode > 2 ? AvgModeFixed : (SpectrumVis::AveragingMode) averagingMode;
|
m_averagingMode = averagingMode < 0 ? AvgModeNone : averagingMode > 2 ? AvgModeFixed : (SpectrumVis::AveragingMode) averagingMode;
|
||||||
}
|
}
|
||||||
@ -42,6 +49,7 @@ public:
|
|||||||
unsigned int getAverageNb() const { return m_averageNb; }
|
unsigned int getAverageNb() const { return m_averageNb; }
|
||||||
SpectrumVis::AveragingMode getAveragingMode() const { return m_averagingMode; }
|
SpectrumVis::AveragingMode getAveragingMode() const { return m_averagingMode; }
|
||||||
FFTWindow::Function getWindow() const { return m_window; }
|
FFTWindow::Function getWindow() const { return m_window; }
|
||||||
|
bool getLinear() const { return m_linear; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_fftSize;
|
int m_fftSize;
|
||||||
@ -49,6 +57,7 @@ public:
|
|||||||
unsigned int m_averageNb;
|
unsigned int m_averageNb;
|
||||||
SpectrumVis::AveragingMode m_averagingMode;
|
SpectrumVis::AveragingMode m_averagingMode;
|
||||||
FFTWindow::Function m_window;
|
FFTWindow::Function m_window;
|
||||||
|
bool m_linear;
|
||||||
};
|
};
|
||||||
|
|
||||||
SpectrumVis(Real scalef, GLSpectrum* glSpectrum = 0);
|
SpectrumVis(Real scalef, GLSpectrum* glSpectrum = 0);
|
||||||
@ -59,7 +68,8 @@ public:
|
|||||||
int overlapPercent,
|
int overlapPercent,
|
||||||
unsigned int averagingNb,
|
unsigned int averagingNb,
|
||||||
int averagingMode,
|
int averagingMode,
|
||||||
FFTWindow::Function window);
|
FFTWindow::Function window,
|
||||||
|
bool m_linear);
|
||||||
|
|
||||||
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly);
|
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly);
|
||||||
void feedTriggered(const SampleVector::const_iterator& triggerPoint, const SampleVector::const_iterator& end, bool positiveOnly);
|
void feedTriggered(const SampleVector::const_iterator& triggerPoint, const SampleVector::const_iterator& end, bool positiveOnly);
|
||||||
|
@ -200,7 +200,8 @@ void GLSpectrumGUI::applySettings()
|
|||||||
m_fftOverlap,
|
m_fftOverlap,
|
||||||
m_averagingNb,
|
m_averagingNb,
|
||||||
m_averagingMode,
|
m_averagingMode,
|
||||||
(FFTWindow::Function)m_fftWindow);
|
(FFTWindow::Function)m_fftWindow,
|
||||||
|
m_linear);
|
||||||
}
|
}
|
||||||
|
|
||||||
setAveragingToolitp();
|
setAveragingToolitp();
|
||||||
@ -215,7 +216,8 @@ void GLSpectrumGUI::on_fftWindow_currentIndexChanged(int index)
|
|||||||
m_fftOverlap,
|
m_fftOverlap,
|
||||||
m_averagingNb,
|
m_averagingNb,
|
||||||
m_averagingMode,
|
m_averagingMode,
|
||||||
(FFTWindow::Function)m_fftWindow);
|
(FFTWindow::Function)m_fftWindow,
|
||||||
|
m_linear);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,7 +230,8 @@ void GLSpectrumGUI::on_fftSize_currentIndexChanged(int index)
|
|||||||
m_fftOverlap,
|
m_fftOverlap,
|
||||||
m_averagingNb,
|
m_averagingNb,
|
||||||
m_averagingMode,
|
m_averagingMode,
|
||||||
(FFTWindow::Function)m_fftWindow);
|
(FFTWindow::Function)m_fftWindow,
|
||||||
|
m_linear);
|
||||||
}
|
}
|
||||||
setAveragingToolitp();
|
setAveragingToolitp();
|
||||||
}
|
}
|
||||||
@ -243,7 +246,8 @@ void GLSpectrumGUI::on_averagingMode_currentIndexChanged(int index)
|
|||||||
m_fftOverlap,
|
m_fftOverlap,
|
||||||
m_averagingNb,
|
m_averagingNb,
|
||||||
m_averagingMode,
|
m_averagingMode,
|
||||||
(FFTWindow::Function)m_fftWindow);
|
(FFTWindow::Function)m_fftWindow,
|
||||||
|
m_linear);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_glSpectrum != 0)
|
if (m_glSpectrum != 0)
|
||||||
@ -267,7 +271,8 @@ void GLSpectrumGUI::on_averaging_currentIndexChanged(int index)
|
|||||||
m_fftOverlap,
|
m_fftOverlap,
|
||||||
m_averagingNb,
|
m_averagingNb,
|
||||||
m_averagingMode,
|
m_averagingMode,
|
||||||
(FFTWindow::Function)m_fftWindow);
|
(FFTWindow::Function)m_fftWindow,
|
||||||
|
m_linear);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_glSpectrum != 0)
|
if (m_glSpectrum != 0)
|
||||||
@ -280,6 +285,21 @@ void GLSpectrumGUI::on_averaging_currentIndexChanged(int index)
|
|||||||
setAveragingToolitp();
|
setAveragingToolitp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GLSpectrumGUI::on_linscale_toggled(bool checked)
|
||||||
|
{
|
||||||
|
m_linear = checked;
|
||||||
|
|
||||||
|
if(m_spectrumVis != 0) {
|
||||||
|
m_spectrumVis->configure(m_messageQueueToVis,
|
||||||
|
m_fftSize,
|
||||||
|
m_fftOverlap,
|
||||||
|
m_averagingNb,
|
||||||
|
m_averagingMode,
|
||||||
|
(FFTWindow::Function)m_fftWindow,
|
||||||
|
m_linear);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GLSpectrumGUI::on_refLevel_currentIndexChanged(int index)
|
void GLSpectrumGUI::on_refLevel_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
m_refLevel = 0 - index * 5;
|
m_refLevel = 0 - index * 5;
|
||||||
|
@ -63,6 +63,7 @@ private:
|
|||||||
int m_averagingIndex;
|
int m_averagingIndex;
|
||||||
int m_averagingMaxScale; //!< Max power of 10 multiplier to 2,5,10 base ex: 2 -> 2,5,10,20,50,100,200,500,1000
|
int m_averagingMaxScale; //!< Max power of 10 multiplier to 2,5,10 base ex: 2 -> 2,5,10,20,50,100,200,500,1000
|
||||||
unsigned int m_averagingNb;
|
unsigned int m_averagingNb;
|
||||||
|
bool m_linear; //!< linear else logarithmic scale
|
||||||
|
|
||||||
void applySettings();
|
void applySettings();
|
||||||
int getAveragingIndex(int averaging) const;
|
int getAveragingIndex(int averaging) const;
|
||||||
@ -85,6 +86,7 @@ private slots:
|
|||||||
void on_traceIntensity_valueChanged(int index);
|
void on_traceIntensity_valueChanged(int index);
|
||||||
void on_averagingMode_currentIndexChanged(int index);
|
void on_averagingMode_currentIndexChanged(int index);
|
||||||
void on_averaging_currentIndexChanged(int index);
|
void on_averaging_currentIndexChanged(int index);
|
||||||
|
void on_linscale_toggled(bool checked);
|
||||||
|
|
||||||
void on_waterfall_toggled(bool checked);
|
void on_waterfall_toggled(bool checked);
|
||||||
void on_histogram_toggled(bool checked);
|
void on_histogram_toggled(bool checked);
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>331</width>
|
<width>342</width>
|
||||||
<height>59</height>
|
<height>59</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -633,6 +633,24 @@
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="linscale">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Logarithmic / Linear scale selection</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../resources/res.qrc">
|
||||||
|
<normaloff>:/logarithmic.png</normaloff>
|
||||||
|
<normalon>:/linear.png</normalon>:/logarithmic.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
BIN
sdrgui/resources/linear.png
Normal file
BIN
sdrgui/resources/linear.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 458 B |
BIN
sdrgui/resources/linear.xcf
Normal file
BIN
sdrgui/resources/linear.xcf
Normal file
Binary file not shown.
BIN
sdrgui/resources/logarithmic.png
Normal file
BIN
sdrgui/resources/logarithmic.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 542 B |
BIN
sdrgui/resources/logarithmic.xcf
Normal file
BIN
sdrgui/resources/logarithmic.xcf
Normal file
Binary file not shown.
@ -1,5 +1,7 @@
|
|||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="/">
|
<qresource prefix="/">
|
||||||
|
<file>linear.png</file>
|
||||||
|
<file>logarithmic.png</file>
|
||||||
<file>pin_last.png</file>
|
<file>pin_last.png</file>
|
||||||
<file>sweep.png</file>
|
<file>sweep.png</file>
|
||||||
<file>minusrx.png</file>
|
<file>minusrx.png</file>
|
||||||
|
Loading…
Reference in New Issue
Block a user