mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-03-22 04:08:29 -04:00
GLSpectrum: added a freeze button
This commit is contained in:
parent
49c6027b8e
commit
86176555c2
Binary file not shown.
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 20 KiB |
Binary file not shown.
@ -39,11 +39,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),
|
||||
@ -319,8 +321,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;
|
||||
}
|
||||
@ -621,10 +626,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)
|
||||
@ -663,6 +670,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;
|
||||
|
@ -63,6 +63,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,
|
||||
@ -150,6 +169,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)
|
||||
|
@ -340,6 +340,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) {
|
||||
|
@ -101,6 +101,7 @@ private slots:
|
||||
void on_invert_toggled(bool checked);
|
||||
void on_grid_toggled(bool checked);
|
||||
void on_clearSpectrum_clicked(bool checked);
|
||||
void on_freeze_toggled(bool checked);
|
||||
|
||||
void handleInputMessages();
|
||||
};
|
||||
|
@ -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,6 +453,72 @@ 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 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>
|
||||
|
||||
⚠ Note: this is a v5 feature only.
|
||||
|
||||
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.
|
||||
|
||||
- Left button: toggles server on/off
|
||||
- Right button: opens a secondary dialog that lets you choose the server listening (local) address and port.
|
||||
|
||||
The server only sends data. Control including FFT details is done via the REST API. FFT frames are formatted as follows (in bytes):
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Offset</th>
|
||||
<th>Length</th>
|
||||
<th>Value</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>0</td>
|
||||
<td>8</td>
|
||||
<td>Center frequency in Hz as 64 bit integer</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>8</td>
|
||||
<td>8</td>
|
||||
<td>Effective FFT time in milliseconds as 64 bit integer</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>16</td>
|
||||
<td>8</td>
|
||||
<td>Unix timestamp in milliseconds as 64 bit integer</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>24</td>
|
||||
<td>4</td>
|
||||
<td>FFT size as 32 bit integer</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>28</td>
|
||||
<td>4</td>
|
||||
<td>FFT bandwidth in Hz as 32 bit integer</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>32</td>
|
||||
<td>4</td>
|
||||
<td>
|
||||
Indicators as 32 bit integer LSB to MSB:
|
||||
<ul>
|
||||
<li>bit 0: Linear (1) / log (0) spectrum indicator</li>
|
||||
<li>bit 1: SSB (1) / DSB (0) spectrum indicator</li>
|
||||
<li>bit 2: USB (1) / LSB (0) spectrum indicator</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>36</td>
|
||||
<td>N*4</td>
|
||||
<td>Vector of N = FFT size 32 bit floating point spectrum power values either log (dB) or linear</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<h3>5. Presets and commands</h3>
|
||||
|
||||
The presets and commands tree view are by default stacked in tabs. The following sections describe the presets section 5A) and commands (section 5B) views successively
|
||||
|
Loading…
Reference in New Issue
Block a user