1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-09-28 15:56:33 -04:00

UDPSink plugin: interim state (2)

This commit is contained in:
f4exb 2017-08-14 16:09:56 +02:00
parent 3e5c6f62b1
commit dde64201e8
5 changed files with 152 additions and 5 deletions

View File

@ -20,6 +20,7 @@
#include "udpsink.h"
MESSAGE_CLASS_DEFINITION(UDPSink::MsgUDPSinkConfigure, Message)
MESSAGE_CLASS_DEFINITION(UDPSink::MsgUDPSinkSpectrum, Message)
UDPSink::UDPSink(MessageQueue* uiMessageQueue, UDPSinkGUI* udpSinkGUI, BasebandSampleSink* spectrum) :
m_uiMessageQueue(uiMessageQueue),
@ -165,6 +166,13 @@ void UDPSink::configure(MessageQueue* messageQueue,
messageQueue->push(cmd);
}
void UDPSink::setSpectrum(MessageQueue* messageQueue, bool enabled)
{
Message* cmd = MsgUDPSinkSpectrum::create(enabled);
messageQueue->push(cmd);
}
void UDPSink::apply(bool force)
{
if ((m_config.m_inputFrequencyOffset != m_running.m_inputFrequencyOffset) ||

View File

@ -59,6 +59,7 @@ public:
QString& udpAddress,
int udpPort,
bool channelMute);
void setSpectrum(MessageQueue* messageQueue, bool enabled);
private:
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 {
int m_basebandSampleRate;
Real m_outputSampleRate;

View File

@ -18,9 +18,10 @@
#include "dsp/upchannelizer.h"
#include "dsp/threadedbasebandsamplesource.h"
#include "dsp/spectrumvis.h"
#include "plugin/pluginapi.h"
#include "util/simpleserializer.h"
#include "dsp/dspengine.h"
#include "util/simpleserializer.h"
#include "gui/basicchannelsettingswidget.h"
#include "plugin/pluginapi.h"
#include "mainwindow.h"
#include "udpsinkgui.h"
@ -201,6 +202,7 @@ UDPSinkGUI::UDPSinkGUI(PluginAPI* pluginAPI, DeviceSinkAPI *deviceAPI, QWidget*
m_pluginAPI(pluginAPI),
m_deviceAPI(deviceAPI),
m_channelMarker(this),
m_basicSettingsShown(false),
m_doApplySettings(true)
{
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);
}

View File

@ -56,6 +56,19 @@ public:
private slots:
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:
Ui::UDPSinkGUI* ui;
@ -75,6 +88,7 @@ private:
int m_volume;
QString m_udpAddress;
int m_udpPort;
bool m_basicSettingsShown;
bool m_doApplySettings;
explicit UDPSinkGUI(PluginAPI* pluginAPI, DeviceSinkAPI *deviceAPI, QWidget* parent = NULL);
@ -82,6 +96,9 @@ private:
void blockApplySettings(bool block);
void applySettings();
void leaveEvent(QEvent*);
void enterEvent(QEvent*);
};
#endif /* PLUGINS_CHANNELTX_UDPSINK_UDPSINKGUI_H_ */

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>316</width>
<width>340</width>
<height>355</height>
</rect>
</property>
@ -36,13 +36,13 @@
<rect>
<x>2</x>
<y>2</y>
<width>312</width>
<width>330</width>
<height>142</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>312</width>
<width>330</width>
<height>0</height>
</size>
</property>
@ -342,6 +342,9 @@
<property name="toolTip">
<string>FM deviation in Hz (for S16LE NFM format)</string>
</property>
<property name="inputMask">
<string>00000</string>
</property>
<property name="text">
<string>2500</string>
</property>
@ -361,6 +364,9 @@
<property name="toolTip">
<string>Signal bandwidth</string>
</property>
<property name="inputMask">
<string>0009999</string>
</property>
<property name="text">
<string>32000</string>
</property>
@ -408,6 +414,9 @@
<property name="toolTip">
<string>Samples rate</string>
</property>
<property name="inputMask">
<string>0009999</string>
</property>
<property name="text">
<string>48000</string>
</property>