Browse Source

Spectrum: added log/linear control

chirpmodem-v8.0.0
f4exb 9 years ago
parent
commit
d5f153ff75
  1. 9
      plugins/channelrx/demodbfm/bfmdemodgui.cpp
  2. 8
      plugins/channelrx/udpsrc/udpsrcgui.cpp
  3. 8
      plugins/channeltx/udpsink/udpsinkgui.cpp
  4. 5
      sdrgui/dsp/spectrumvis.cpp
  5. 16
      sdrgui/dsp/spectrumvis.h
  6. 30
      sdrgui/gui/glspectrumgui.cpp
  7. 2
      sdrgui/gui/glspectrumgui.h
  8. 20
      sdrgui/gui/glspectrumgui.ui
  9. BIN
      sdrgui/resources/linear.png
  10. BIN
      sdrgui/resources/linear.xcf
  11. BIN
      sdrgui/resources/logarithmic.png
  12. BIN
      sdrgui/resources/logarithmic.xcf
  13. 2
      sdrgui/resources/res.qrc

9
plugins/channelrx/demodbfm/bfmdemodgui.cpp

@ -359,7 +359,14 @@ BFMDemodGUI::BFMDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban @@ -359,7 +359,14 @@ BFMDemodGUI::BFMDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
ui->glSpectrum->setDisplayWaterfall(false);
ui->glSpectrum->setDisplayMaxHold(false);
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()));
m_channelMarker.blockSignals(true);

8
plugins/channelrx/udpsrc/udpsrcgui.cpp

@ -187,7 +187,13 @@ UDPSrcGUI::UDPSrcGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam @@ -187,7 +187,13 @@ UDPSrcGUI::UDPSrcGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam
ui->glSpectrum->setSampleRate(ui->sampleRate->text().toInt());
ui->glSpectrum->setDisplayWaterfall(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());
connect(&MainWindow::getInstance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));

8
plugins/channeltx/udpsink/udpsinkgui.cpp

@ -142,7 +142,13 @@ UDPSinkGUI::UDPSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandS @@ -142,7 +142,13 @@ UDPSinkGUI::UDPSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandS
ui->glSpectrum->setSampleRate(ui->sampleRate->text().toInt());
ui->glSpectrum->setDisplayWaterfall(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());
connect(&MainWindow::getInstance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));

5
sdrgui/dsp/spectrumvis.cpp

@ -44,9 +44,10 @@ void SpectrumVis::configure(MessageQueue* msgQueue, @@ -44,9 +44,10 @@ void SpectrumVis::configure(MessageQueue* msgQueue,
int overlapPercent,
unsigned int averagingNb,
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);
}

16
sdrgui/dsp/spectrumvis.h

@ -27,12 +27,19 @@ public: @@ -27,12 +27,19 @@ public:
MESSAGE_CLASS_DECLARATION
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(),
m_fftSize(fftSize),
m_overlapPercent(overlapPercent),
m_averageNb(averageNb),
m_window(window)
m_window(window),
m_linear(linear)
{
m_averagingMode = averagingMode < 0 ? AvgModeNone : averagingMode > 2 ? AvgModeFixed : (SpectrumVis::AveragingMode) averagingMode;
}
@ -42,6 +49,7 @@ public: @@ -42,6 +49,7 @@ public:
unsigned int getAverageNb() const { return m_averageNb; }
SpectrumVis::AveragingMode getAveragingMode() const { return m_averagingMode; }
FFTWindow::Function getWindow() const { return m_window; }
bool getLinear() const { return m_linear; }
private:
int m_fftSize;
@ -49,6 +57,7 @@ public: @@ -49,6 +57,7 @@ public:
unsigned int m_averageNb;
SpectrumVis::AveragingMode m_averagingMode;
FFTWindow::Function m_window;
bool m_linear;
};
SpectrumVis(Real scalef, GLSpectrum* glSpectrum = 0);
@ -59,7 +68,8 @@ public: @@ -59,7 +68,8 @@ public:
int overlapPercent,
unsigned int averagingNb,
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);
void feedTriggered(const SampleVector::const_iterator& triggerPoint, const SampleVector::const_iterator& end, bool positiveOnly);

30
sdrgui/gui/glspectrumgui.cpp

@ -200,7 +200,8 @@ void GLSpectrumGUI::applySettings() @@ -200,7 +200,8 @@ void GLSpectrumGUI::applySettings()
m_fftOverlap,
m_averagingNb,
m_averagingMode,
(FFTWindow::Function)m_fftWindow);
(FFTWindow::Function)m_fftWindow,
m_linear);
}
setAveragingToolitp();
@ -215,7 +216,8 @@ void GLSpectrumGUI::on_fftWindow_currentIndexChanged(int index) @@ -215,7 +216,8 @@ void GLSpectrumGUI::on_fftWindow_currentIndexChanged(int index)
m_fftOverlap,
m_averagingNb,
m_averagingMode,
(FFTWindow::Function)m_fftWindow);
(FFTWindow::Function)m_fftWindow,
m_linear);
}
}
@ -228,7 +230,8 @@ void GLSpectrumGUI::on_fftSize_currentIndexChanged(int index) @@ -228,7 +230,8 @@ void GLSpectrumGUI::on_fftSize_currentIndexChanged(int index)
m_fftOverlap,
m_averagingNb,
m_averagingMode,
(FFTWindow::Function)m_fftWindow);
(FFTWindow::Function)m_fftWindow,
m_linear);
}
setAveragingToolitp();
}
@ -243,7 +246,8 @@ void GLSpectrumGUI::on_averagingMode_currentIndexChanged(int index) @@ -243,7 +246,8 @@ void GLSpectrumGUI::on_averagingMode_currentIndexChanged(int index)
m_fftOverlap,
m_averagingNb,
m_averagingMode,
(FFTWindow::Function)m_fftWindow);
(FFTWindow::Function)m_fftWindow,
m_linear);
}
if (m_glSpectrum != 0)
@ -267,7 +271,8 @@ void GLSpectrumGUI::on_averaging_currentIndexChanged(int index) @@ -267,7 +271,8 @@ void GLSpectrumGUI::on_averaging_currentIndexChanged(int index)
m_fftOverlap,
m_averagingNb,
m_averagingMode,
(FFTWindow::Function)m_fftWindow);
(FFTWindow::Function)m_fftWindow,
m_linear);
}
if (m_glSpectrum != 0)
@ -280,6 +285,21 @@ void GLSpectrumGUI::on_averaging_currentIndexChanged(int index) @@ -280,6 +285,21 @@ void GLSpectrumGUI::on_averaging_currentIndexChanged(int index)
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)
{
m_refLevel = 0 - index * 5;

2
sdrgui/gui/glspectrumgui.h

@ -63,6 +63,7 @@ private: @@ -63,6 +63,7 @@ private:
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
unsigned int m_averagingNb;
bool m_linear; //!< linear else logarithmic scale
void applySettings();
int getAveragingIndex(int averaging) const;
@ -85,6 +86,7 @@ private slots: @@ -85,6 +86,7 @@ private slots:
void on_traceIntensity_valueChanged(int index);
void on_averagingMode_currentIndexChanged(int index);
void on_averaging_currentIndexChanged(int index);
void on_linscale_toggled(bool checked);
void on_waterfall_toggled(bool checked);
void on_histogram_toggled(bool checked);

20
sdrgui/gui/glspectrumgui.ui

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>331</width>
<width>342</width>
<height>59</height>
</rect>
</property>
@ -633,6 +633,24 @@ @@ -633,6 +633,24 @@
</item>
</widget>
</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>
<spacer name="horizontalSpacer">
<property name="orientation">

BIN
sdrgui/resources/linear.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 458 B

BIN
sdrgui/resources/linear.xcf

Binary file not shown.

BIN
sdrgui/resources/logarithmic.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 542 B

BIN
sdrgui/resources/logarithmic.xcf

Binary file not shown.

2
sdrgui/resources/res.qrc

@ -1,5 +1,7 @@ @@ -1,5 +1,7 @@
<RCC>
<qresource prefix="/">
<file>linear.png</file>
<file>logarithmic.png</file>
<file>pin_last.png</file>
<file>sweep.png</file>
<file>minusrx.png</file>

Loading…
Cancel
Save