mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-11-09 15:50:24 -05:00
GLSpectrum: added a freeze button
This commit is contained in:
parent
3e6ea404e1
commit
3c7a39f71e
Binary file not shown.
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 20 KiB |
Binary file not shown.
@ -43,11 +43,13 @@ MESSAGE_CLASS_DEFINITION(SpectrumVis::MsgConfigureSpectrumVis, Message)
|
||||
MESSAGE_CLASS_DEFINITION(SpectrumVis::MsgConfigureScalingFactor, Message)
|
||||
MESSAGE_CLASS_DEFINITION(SpectrumVis::MsgConfigureWSpectrumOpenClose, Message)
|
||||
MESSAGE_CLASS_DEFINITION(SpectrumVis::MsgConfigureWSpectrum, Message)
|
||||
MESSAGE_CLASS_DEFINITION(SpectrumVis::MsgStartStop, Message)
|
||||
|
||||
const Real SpectrumVis::m_mult = (10.0f / log2f(10.0f));
|
||||
|
||||
SpectrumVis::SpectrumVis(Real scalef) :
|
||||
BasebandSampleSink(),
|
||||
m_running(true),
|
||||
m_fft(nullptr),
|
||||
m_fftEngineSequence(0),
|
||||
m_fftBuffer(MAX_FFT_SIZE),
|
||||
@ -285,8 +287,11 @@ void SpectrumVis::feed(const Complex *begin, unsigned int length)
|
||||
|
||||
void SpectrumVis::feed(const SampleVector::const_iterator& cbegin, const SampleVector::const_iterator& end, bool positiveOnly)
|
||||
{
|
||||
// if no visualisation is set, send the samples to /dev/null
|
||||
if (!m_running) {
|
||||
return;
|
||||
}
|
||||
|
||||
// if no visualisation is set, send the samples to /dev/null
|
||||
if (!m_glSpectrum && !m_wsSpectrum.socketOpened()) {
|
||||
return;
|
||||
}
|
||||
@ -587,10 +592,12 @@ void SpectrumVis::feed(const SampleVector::const_iterator& cbegin, const SampleV
|
||||
|
||||
void SpectrumVis::start()
|
||||
{
|
||||
m_running = true;
|
||||
}
|
||||
|
||||
void SpectrumVis::stop()
|
||||
{
|
||||
m_running = false;
|
||||
}
|
||||
|
||||
bool SpectrumVis::handleMessage(const Message& message)
|
||||
@ -629,6 +636,17 @@ bool SpectrumVis::handleMessage(const Message& message)
|
||||
handleConfigureWSSpectrum(conf.getAddress(), conf.getPort());
|
||||
return true;
|
||||
}
|
||||
else if (MsgStartStop::match(message)) {
|
||||
MsgStartStop& cmd = (MsgStartStop&) message;
|
||||
|
||||
if (cmd.getStartStop()) {
|
||||
start();
|
||||
} else {
|
||||
stop();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
|
||||
@ -88,6 +88,25 @@ public:
|
||||
{}
|
||||
};
|
||||
|
||||
class MsgStartStop : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
||||
public:
|
||||
bool getStartStop() const { return m_startStop; }
|
||||
|
||||
static MsgStartStop* create(bool startStop) {
|
||||
return new MsgStartStop(startStop);
|
||||
}
|
||||
|
||||
protected:
|
||||
bool m_startStop;
|
||||
|
||||
MsgStartStop(bool startStop) :
|
||||
Message(),
|
||||
m_startStop(startStop)
|
||||
{ }
|
||||
};
|
||||
|
||||
enum AvgMode
|
||||
{
|
||||
AvgModeNone,
|
||||
@ -157,6 +176,7 @@ private:
|
||||
uint16_t m_port;
|
||||
};
|
||||
|
||||
bool m_running;
|
||||
FFTEngine* m_fft;
|
||||
FFTWindow m_window;
|
||||
unsigned int m_fftEngineSequence;
|
||||
|
||||
@ -1988,6 +1988,8 @@ void GLSpectrum::mousePressEvent(QMouseEvent* event)
|
||||
if ((m_waterfallMarkers.size() > 0) && (pWat.x() >= 0) && (pWat.x() <= 1) && (pWat.y() >= 0) && (pWat.y() <= 1)) {
|
||||
m_waterfallMarkers.pop_back();
|
||||
}
|
||||
|
||||
update();
|
||||
}
|
||||
else if (event->button() == Qt::LeftButton)
|
||||
{
|
||||
@ -2076,6 +2078,8 @@ void GLSpectrum::mousePressEvent(QMouseEvent* event)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
if (m_cursorState == CSSplitter)
|
||||
|
||||
@ -350,6 +350,12 @@ void GLSpectrumGUI::on_clearSpectrum_clicked(bool checked)
|
||||
}
|
||||
}
|
||||
|
||||
void GLSpectrumGUI::on_freeze_toggled(bool checked)
|
||||
{
|
||||
SpectrumVis::MsgStartStop *msg = SpectrumVis::MsgStartStop::create(!checked);
|
||||
m_spectrumVis->getInputMessageQueue()->push(msg);
|
||||
}
|
||||
|
||||
int GLSpectrumGUI::getAveragingMaxScale(GLSpectrumSettings::AveragingMode averagingMode)
|
||||
{
|
||||
if (averagingMode == GLSpectrumSettings::AvgModeMoving) {
|
||||
|
||||
@ -103,6 +103,7 @@ private slots:
|
||||
void on_invertWaterfall_toggled(bool checked);
|
||||
void on_grid_toggled(bool checked);
|
||||
void on_clearSpectrum_clicked(bool checked);
|
||||
void on_freeze_toggled(bool checked);
|
||||
|
||||
void handleInputMessages();
|
||||
void openWebsocketSpectrumSettingsDialog(const QPoint& p);
|
||||
|
||||
@ -312,24 +312,26 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<widget class="ButtonSwitch" name="freeze">
|
||||
<property name="toolTip">
|
||||
<string>Play/Pause spectrum display</string>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/res.qrc">
|
||||
<normaloff>:/pause.png</normaloff>
|
||||
<normalon>:/play.png</normalon>:/pause.png</iconset>
|
||||
</property>
|
||||
</spacer>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QComboBox" name="fftWindow">
|
||||
|
||||
@ -453,7 +453,11 @@ Use this toggle button to switch between spectrum logarithmic and linear scale d
|
||||
|
||||
When in linear mode the range control (4.4) has no effect because the actual range is between 0 and the reference level. The reference level in dB (4.3) still applies but is translated to a linear value e.g -40 dB is 1e-4. In linear mode the scale numbers are formatted using scientific notation so that they always occupy the same space.
|
||||
|
||||
<h4>4.K. Spectrum server control</h4>
|
||||
<h4>4.K. Spectrum live display pause/resume (freeze)</h4>
|
||||
|
||||
Use this control to pause or resume spectrum live display. You can use this control to freeze the spectrum display. This may be useful to make measurements using the markers (see section 7).
|
||||
|
||||
<h4>4.L. Spectrum server control</h4>
|
||||
|
||||
A websockets based server can be used to send spectrum data to clients. An example of such client can be found in the [SDRangelSpectrum](https://github.com/f4exb/sdrangelspectrum) project.
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user