mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-06-30 07:55:24 -04:00
UDPSink plugin: interim state (2)
This commit is contained in:
parent
3e5c6f62b1
commit
dde64201e8
@ -20,6 +20,7 @@
|
|||||||
#include "udpsink.h"
|
#include "udpsink.h"
|
||||||
|
|
||||||
MESSAGE_CLASS_DEFINITION(UDPSink::MsgUDPSinkConfigure, Message)
|
MESSAGE_CLASS_DEFINITION(UDPSink::MsgUDPSinkConfigure, Message)
|
||||||
|
MESSAGE_CLASS_DEFINITION(UDPSink::MsgUDPSinkSpectrum, Message)
|
||||||
|
|
||||||
UDPSink::UDPSink(MessageQueue* uiMessageQueue, UDPSinkGUI* udpSinkGUI, BasebandSampleSink* spectrum) :
|
UDPSink::UDPSink(MessageQueue* uiMessageQueue, UDPSinkGUI* udpSinkGUI, BasebandSampleSink* spectrum) :
|
||||||
m_uiMessageQueue(uiMessageQueue),
|
m_uiMessageQueue(uiMessageQueue),
|
||||||
@ -165,6 +166,13 @@ void UDPSink::configure(MessageQueue* messageQueue,
|
|||||||
messageQueue->push(cmd);
|
messageQueue->push(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UDPSink::setSpectrum(MessageQueue* messageQueue, bool enabled)
|
||||||
|
{
|
||||||
|
Message* cmd = MsgUDPSinkSpectrum::create(enabled);
|
||||||
|
messageQueue->push(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void UDPSink::apply(bool force)
|
void UDPSink::apply(bool force)
|
||||||
{
|
{
|
||||||
if ((m_config.m_inputFrequencyOffset != m_running.m_inputFrequencyOffset) ||
|
if ((m_config.m_inputFrequencyOffset != m_running.m_inputFrequencyOffset) ||
|
||||||
|
@ -59,6 +59,7 @@ public:
|
|||||||
QString& udpAddress,
|
QString& udpAddress,
|
||||||
int udpPort,
|
int udpPort,
|
||||||
bool channelMute);
|
bool channelMute);
|
||||||
|
void setSpectrum(MessageQueue* messageQueue, bool enabled);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class MsgUDPSinkConfigure : public Message {
|
class MsgUDPSinkConfigure : public Message {
|
||||||
@ -118,6 +119,26 @@ private:
|
|||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class MsgUDPSinkSpectrum : public Message {
|
||||||
|
MESSAGE_CLASS_DECLARATION
|
||||||
|
|
||||||
|
public:
|
||||||
|
bool getEnabled() const { return m_enabled; }
|
||||||
|
|
||||||
|
static MsgUDPSinkSpectrum* create(bool enabled)
|
||||||
|
{
|
||||||
|
return new MsgUDPSinkSpectrum(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_enabled;
|
||||||
|
|
||||||
|
MsgUDPSinkSpectrum(bool enabled) :
|
||||||
|
Message(),
|
||||||
|
m_enabled(enabled)
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
|
||||||
struct Config {
|
struct Config {
|
||||||
int m_basebandSampleRate;
|
int m_basebandSampleRate;
|
||||||
Real m_outputSampleRate;
|
Real m_outputSampleRate;
|
||||||
|
@ -18,9 +18,10 @@
|
|||||||
#include "dsp/upchannelizer.h"
|
#include "dsp/upchannelizer.h"
|
||||||
#include "dsp/threadedbasebandsamplesource.h"
|
#include "dsp/threadedbasebandsamplesource.h"
|
||||||
#include "dsp/spectrumvis.h"
|
#include "dsp/spectrumvis.h"
|
||||||
#include "plugin/pluginapi.h"
|
|
||||||
#include "util/simpleserializer.h"
|
|
||||||
#include "dsp/dspengine.h"
|
#include "dsp/dspengine.h"
|
||||||
|
#include "util/simpleserializer.h"
|
||||||
|
#include "gui/basicchannelsettingswidget.h"
|
||||||
|
#include "plugin/pluginapi.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
#include "udpsinkgui.h"
|
#include "udpsinkgui.h"
|
||||||
@ -201,6 +202,7 @@ UDPSinkGUI::UDPSinkGUI(PluginAPI* pluginAPI, DeviceSinkAPI *deviceAPI, QWidget*
|
|||||||
m_pluginAPI(pluginAPI),
|
m_pluginAPI(pluginAPI),
|
||||||
m_deviceAPI(deviceAPI),
|
m_deviceAPI(deviceAPI),
|
||||||
m_channelMarker(this),
|
m_channelMarker(this),
|
||||||
|
m_basicSettingsShown(false),
|
||||||
m_doApplySettings(true)
|
m_doApplySettings(true)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
@ -374,3 +376,93 @@ void UDPSinkGUI::applySettings()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UDPSinkGUI::on_deltaFrequency_changed(qint64 value)
|
||||||
|
{
|
||||||
|
m_channelMarker.setCenterFrequency(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDPSinkGUI::on_sampleFormat_currentIndexChanged(int index)
|
||||||
|
{
|
||||||
|
if ((index == 1) || (index == 2)) {
|
||||||
|
ui->fmDeviation->setEnabled(true);
|
||||||
|
} else {
|
||||||
|
ui->fmDeviation->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->applyBtn->setEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDPSinkGUI::on_sampleRate_textEdited(const QString& arg1 __attribute__((unused)))
|
||||||
|
{
|
||||||
|
ui->applyBtn->setEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDPSinkGUI::on_rfBandwidth_textEdited(const QString& arg1 __attribute__((unused)))
|
||||||
|
{
|
||||||
|
ui->applyBtn->setEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDPSinkGUI::on_fmDeviation_textEdited(const QString& arg1 __attribute__((unused)))
|
||||||
|
{
|
||||||
|
ui->applyBtn->setEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDPSinkGUI::on_udpAddress_textEdited(const QString& arg1 __attribute__((unused)))
|
||||||
|
{
|
||||||
|
ui->applyBtn->setEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDPSinkGUI::on_udpPort_textEdited(const QString& arg1 __attribute__((unused)))
|
||||||
|
{
|
||||||
|
ui->applyBtn->setEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDPSinkGUI::on_volume_valueChanged(int value)
|
||||||
|
{
|
||||||
|
ui->volume->setValue(value);
|
||||||
|
ui->volumeText->setText(QString("%1").arg(value));
|
||||||
|
applySettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDPSinkGUI::on_channelMute_toggled(bool checked __attribute__((unused)))
|
||||||
|
{
|
||||||
|
applySettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDPSinkGUI::on_applyBtn_clicked()
|
||||||
|
{
|
||||||
|
applySettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDPSinkGUI::onWidgetRolled(QWidget* widget, bool rollDown)
|
||||||
|
{
|
||||||
|
if ((widget == ui->spectrumBox) && (m_udpSink != 0))
|
||||||
|
{
|
||||||
|
m_udpSink->setSpectrum(m_udpSink->getInputMessageQueue(), rollDown);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDPSinkGUI::onMenuDoubleClicked()
|
||||||
|
{
|
||||||
|
if (!m_basicSettingsShown)
|
||||||
|
{
|
||||||
|
m_basicSettingsShown = true;
|
||||||
|
BasicChannelSettingsWidget* bcsw = new BasicChannelSettingsWidget(&m_channelMarker, this);
|
||||||
|
bcsw->show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDPSinkGUI::leaveEvent(QEvent*)
|
||||||
|
{
|
||||||
|
blockApplySettings(true);
|
||||||
|
m_channelMarker.setHighlighted(false);
|
||||||
|
blockApplySettings(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UDPSinkGUI::enterEvent(QEvent*)
|
||||||
|
{
|
||||||
|
blockApplySettings(true);
|
||||||
|
m_channelMarker.setHighlighted(true);
|
||||||
|
blockApplySettings(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -56,6 +56,19 @@ public:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleSourceMessages();
|
void handleSourceMessages();
|
||||||
|
void channelMarkerChanged();
|
||||||
|
void on_deltaFrequency_changed(qint64 value);
|
||||||
|
void on_sampleFormat_currentIndexChanged(int index);
|
||||||
|
void on_sampleRate_textEdited(const QString& arg1);
|
||||||
|
void on_rfBandwidth_textEdited(const QString& arg1);
|
||||||
|
void on_udpAddress_textEdited(const QString& arg1);
|
||||||
|
void on_udpPort_textEdited(const QString& arg1);
|
||||||
|
void on_fmDeviation_textEdited(const QString& arg1);
|
||||||
|
void on_applyBtn_clicked();
|
||||||
|
void onWidgetRolled(QWidget* widget, bool rollDown);
|
||||||
|
void onMenuDoubleClicked();
|
||||||
|
void on_volume_valueChanged(int value);
|
||||||
|
void on_channelMute_toggled(bool checked);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::UDPSinkGUI* ui;
|
Ui::UDPSinkGUI* ui;
|
||||||
@ -75,6 +88,7 @@ private:
|
|||||||
int m_volume;
|
int m_volume;
|
||||||
QString m_udpAddress;
|
QString m_udpAddress;
|
||||||
int m_udpPort;
|
int m_udpPort;
|
||||||
|
bool m_basicSettingsShown;
|
||||||
bool m_doApplySettings;
|
bool m_doApplySettings;
|
||||||
|
|
||||||
explicit UDPSinkGUI(PluginAPI* pluginAPI, DeviceSinkAPI *deviceAPI, QWidget* parent = NULL);
|
explicit UDPSinkGUI(PluginAPI* pluginAPI, DeviceSinkAPI *deviceAPI, QWidget* parent = NULL);
|
||||||
@ -82,6 +96,9 @@ private:
|
|||||||
|
|
||||||
void blockApplySettings(bool block);
|
void blockApplySettings(bool block);
|
||||||
void applySettings();
|
void applySettings();
|
||||||
|
|
||||||
|
void leaveEvent(QEvent*);
|
||||||
|
void enterEvent(QEvent*);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* PLUGINS_CHANNELTX_UDPSINK_UDPSINKGUI_H_ */
|
#endif /* PLUGINS_CHANNELTX_UDPSINK_UDPSINKGUI_H_ */
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>316</width>
|
<width>340</width>
|
||||||
<height>355</height>
|
<height>355</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -36,13 +36,13 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>2</x>
|
<x>2</x>
|
||||||
<y>2</y>
|
<y>2</y>
|
||||||
<width>312</width>
|
<width>330</width>
|
||||||
<height>142</height>
|
<height>142</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>312</width>
|
<width>330</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -342,6 +342,9 @@
|
|||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>FM deviation in Hz (for S16LE NFM format)</string>
|
<string>FM deviation in Hz (for S16LE NFM format)</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="inputMask">
|
||||||
|
<string>00000</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>2500</string>
|
<string>2500</string>
|
||||||
</property>
|
</property>
|
||||||
@ -361,6 +364,9 @@
|
|||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Signal bandwidth</string>
|
<string>Signal bandwidth</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="inputMask">
|
||||||
|
<string>0009999</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>32000</string>
|
<string>32000</string>
|
||||||
</property>
|
</property>
|
||||||
@ -408,6 +414,9 @@
|
|||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Samples rate</string>
|
<string>Samples rate</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="inputMask">
|
||||||
|
<string>0009999</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>48000</string>
|
<string>48000</string>
|
||||||
</property>
|
</property>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user