From 242617ba7be3898ffb73a9e99c73b919600a81af Mon Sep 17 00:00:00 2001 From: f4exb Date: Fri, 25 Aug 2017 09:48:07 +0200 Subject: [PATCH] UDP sink plugin: added mono/stereo input button --- plugins/channeltx/udpsink/udpsink.cpp | 6 +- plugins/channeltx/udpsink/udpsink.h | 9 + plugins/channeltx/udpsink/udpsinkgui.cpp | 6 + plugins/channeltx/udpsink/udpsinkgui.h | 1 + plugins/channeltx/udpsink/udpsinkgui.ui | 962 ++++++++++++----------- 5 files changed, 511 insertions(+), 473 deletions(-) diff --git a/plugins/channeltx/udpsink/udpsink.cpp b/plugins/channeltx/udpsink/udpsink.cpp index f0eec8ba4..86779347f 100644 --- a/plugins/channeltx/udpsink/udpsink.cpp +++ b/plugins/channeltx/udpsink/udpsink.cpp @@ -375,6 +375,7 @@ bool UDPSink::handleMessage(const Message& cmd) m_config.m_squelchGate = cfg.getSquelchGate(); m_config.m_squelchEnabled = cfg.getSquelchEnabled(); m_config.m_autoRWBalance = cfg.getAutoRWBalance(); + m_config.m_stereoInput = cfg.getStereoInput(); apply(cfg.getForce()); @@ -391,7 +392,8 @@ bool UDPSink::handleMessage(const Message& cmd) << " m_squelchGate: " << m_config.m_squelchGate << " m_squelch: " << m_config.m_squelch << " m_squelchEnabled: " << m_config.m_squelchEnabled - << " m_autoRWBalance: " << m_config.m_autoRWBalance; + << " m_autoRWBalance: " << m_config.m_autoRWBalance + << " m_stereoInput: " << m_config.m_stereoInput; return true; } @@ -492,6 +494,7 @@ void UDPSink::configure(MessageQueue* messageQueue, Real squelchGate, bool squelchEnabled, bool autoRWBalance, + bool stereoInput, bool force) { Message* cmd = MsgUDPSinkConfigure::create(sampleFormat, @@ -507,6 +510,7 @@ void UDPSink::configure(MessageQueue* messageQueue, squelchGate, squelchEnabled, autoRWBalance, + stereoInput, force); messageQueue->push(cmd); } diff --git a/plugins/channeltx/udpsink/udpsink.h b/plugins/channeltx/udpsink/udpsink.h index 575ff7371..84e1a13bc 100644 --- a/plugins/channeltx/udpsink/udpsink.h +++ b/plugins/channeltx/udpsink/udpsink.h @@ -74,6 +74,7 @@ public: Real squelchGate, bool squelchEnabled, bool autoRWBalance, + bool stereoInput, bool force = false); void setSpectrum(MessageQueue* messageQueue, bool enabled); void resetReadIndex(MessageQueue* messageQueue); @@ -106,6 +107,7 @@ private: bool getSquelchEnabled() const { return m_squelchEnabled; } bool getForce() const { return m_force; } bool getAutoRWBalance() const { return m_autoRWBalance; } + bool getStereoInput() const { return m_stereoInput; } static MsgUDPSinkConfigure* create(SampleFormat sampleFormat, @@ -121,6 +123,7 @@ private: Real squelchGate, bool squelchEnabled, bool autoRWBalance, + bool stereoInput, bool force) { return new MsgUDPSinkConfigure(sampleFormat, @@ -136,6 +139,7 @@ private: squelchGate, squelchEnabled, autoRWBalance, + stereoInput, force); } @@ -153,6 +157,7 @@ private: Real m_squelchGate; bool m_squelchEnabled; bool m_autoRWBalance; + bool m_stereoInput; bool m_force; MsgUDPSinkConfigure(SampleFormat sampleFormat, @@ -168,6 +173,7 @@ private: Real squelchGate, bool squelchEnabled, bool autoRWBalance, + bool stereoInput, bool force) : Message(), m_sampleFormat(sampleFormat), @@ -183,6 +189,7 @@ private: m_squelchGate(squelchGate), m_squelchEnabled(squelchEnabled), m_autoRWBalance(autoRWBalance), + m_stereoInput(stereoInput), m_force(force) { } }; @@ -240,6 +247,7 @@ private: Real m_squelchGate; //!< seconds bool m_squelchEnabled; bool m_autoRWBalance; + bool m_stereoInput; QString m_udpAddressStr; quint16 m_udpPort; @@ -260,6 +268,7 @@ private: m_squelchGate(0.05), m_squelchEnabled(true), m_autoRWBalance(true), + m_stereoInput(false), m_udpAddressStr("127.0.0.1"), m_udpPort(9999) {} diff --git a/plugins/channeltx/udpsink/udpsinkgui.cpp b/plugins/channeltx/udpsink/udpsinkgui.cpp index b7b9ae5fc..160632106 100644 --- a/plugins/channeltx/udpsink/udpsinkgui.cpp +++ b/plugins/channeltx/udpsink/udpsinkgui.cpp @@ -417,6 +417,7 @@ void UDPSinkGUI::applySettings(bool force) ui->squelchGate->value() * 0.01f, ui->squelch->value() != -100, ui->autoRWBalance->isChecked(), + ui->stereoInput->isChecked(), force); ui->applyBtn->setEnabled(false); @@ -542,6 +543,11 @@ void UDPSinkGUI::on_autoRWBalance_toggled(bool checked __attribute__((unused))) applySettings(); } +void UDPSinkGUI::on_stereoInput_toggled(bool checked __attribute__((unused))) +{ + applySettings(); +} + void UDPSinkGUI::onWidgetRolled(QWidget* widget, bool rollDown) { if ((widget == ui->spectrumBox) && (m_udpSink != 0)) diff --git a/plugins/channeltx/udpsink/udpsinkgui.h b/plugins/channeltx/udpsink/udpsinkgui.h index 382e9e5b9..6f05083bb 100644 --- a/plugins/channeltx/udpsink/udpsinkgui.h +++ b/plugins/channeltx/udpsink/udpsinkgui.h @@ -74,6 +74,7 @@ private slots: void on_channelMute_toggled(bool checked); void on_resetUDPReadIndex_clicked(); void on_autoRWBalance_toggled(bool checked); + void on_stereoInput_toggled(bool checked); void tick(); private: diff --git a/plugins/channeltx/udpsink/udpsinkgui.ui b/plugins/channeltx/udpsink/udpsinkgui.ui index 758841887..6108a542e 100644 --- a/plugins/channeltx/udpsink/udpsinkgui.ui +++ b/plugins/channeltx/udpsink/udpsinkgui.ui @@ -71,6 +71,262 @@ 3 + + + + + + + 36 + 0 + + + + SRin + + + + + + + Input sample rate (S/s) + + + 0009999 + + + 48000 + + + + + + + + + + + Addr + + + + + + + Address of listening interface (local) + + + 000.000.000.000 + + + 127.0.0.1 + + + + + + + D + + + + + + + Listening data port + + + 00000 + + + 9999 + + + + + + + + + + + + 36 + 0 + + + + RFBW + + + + + + + Signal bandwidth (Hz) + + + 0009999 + + + 32000 + + + + + + + + + + + + 16777215 + 12 + + + + Main buffer read/write positions unbalance: write lags read leads + + + 50 + + + 0 + + + false + + + true + + + %v + + + + + + + + 2 + 14 + + + + . + + + + + + + + 16777215 + 12 + + + + Main buffer read/write positions unbalance: read lags write leads + + + 50 + + + 0 + + + false + + + + + + + + + + + + 30 + 16777215 + + + + Fmt + + + + + + + Samples format + + + 0 + + + + S16LE I/Q + + + + + S16LE NFM + + + + + S16LE NFM Mono + + + + + S16LE LSB + + + + + S16LE USB + + + + + S16LE LSB Mono + + + + + S16LE USB Mono + + + + + S16LE AM Mono + + + + + + + + Toggle mono (1 channel) or stereo (2 channels) input + + + + + + + :/mono.png + :/stereo.png:/mono.png + + + true + + + + + @@ -88,6 +344,240 @@ + + + + + + + 0 + 22 + + + + Gain + + + + + + + 100 + + + 1 + + + 10 + + + Qt::Horizontal + + + + + + + + 32 + 0 + + + + Linear gain value + + + 10.0 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + + 22 + 0 + + + + R/W pointers offset from optimal (%) + + + -00 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 22 + + + + + 22 + 16777215 + + + + Reset UDP buffer index + + + R + + + + + + + + 0 + 22 + + + + + 22 + 16777215 + + + + Automatic R/W balance compensation + + + G + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + Sq + + + + + + + + 30 + 0 + + + + Power squelch threshold (dB) + + + -100 + + + 0 + + + 1 + + + -50 + + + Qt::Horizontal + + + + + + + + 22 + 0 + + + + Power squelch threshold (dB) + + + -00 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 22 + 22 + + + + Squelch gate (ms) + + + 50 + + + 1 + + + 5 + + + + + + + + 24 + 0 + + + + Squelch gate (ms) + + + 000 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + @@ -157,50 +647,6 @@ - - - - - - Addr - - - - - - - Address of listening interface (local) - - - 000.000.000.000 - - - 127.0.0.1 - - - - - - - D - - - - - - - Listening data port - - - 00000 - - - 9999 - - - - - @@ -417,434 +863,6 @@ - - - - - - - 30 - 16777215 - - - - Fmt - - - - - - - Samples format - - - 0 - - - - S16LE I/Q - - - - - S16LE NFM - - - - - S16LE NFM Mono - - - - - S16LE LSB - - - - - S16LE USB - - - - - S16LE LSB Mono - - - - - S16LE USB Mono - - - - - S16LE AM Mono - - - - - - - - - - - - - 36 - 0 - - - - SRin - - - - - - - Input sample rate (S/s) - - - 0009999 - - - 48000 - - - - - - - - - - - - 36 - 0 - - - - RFBW - - - - - - - Signal bandwidth (Hz) - - - 0009999 - - - 32000 - - - - - - - - - - - - 16777215 - 12 - - - - Main buffer read/write positions unbalance: write lags read leads - - - 50 - - - 0 - - - false - - - true - - - %v - - - - - - - - 2 - 14 - - - - . - - - - - - - - 16777215 - 12 - - - - Main buffer read/write positions unbalance: read lags write leads - - - 50 - - - 0 - - - false - - - - - - - - - - - - 22 - 0 - - - - R/W pointers offset from optimal (%) - - - -00 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 22 - - - - - 22 - 16777215 - - - - Reset UDP buffer index - - - R - - - - - - - - 0 - 22 - - - - - 22 - 16777215 - - - - Automatic R/W balance compensation - - - G - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - 0 - 22 - - - - Gain - - - - - - - 100 - - - 1 - - - 10 - - - Qt::Horizontal - - - - - - - - 32 - 0 - - - - Linear gain value - - - 10.0 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - Sq - - - - - - - - 30 - 0 - - - - Power squelch threshold (dB) - - - -100 - - - 0 - - - 1 - - - -50 - - - Qt::Horizontal - - - - - - - - 22 - 0 - - - - Power squelch threshold (dB) - - - -00 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 22 - 22 - - - - Squelch gate (ms) - - - 50 - - - 1 - - - 5 - - - - - - - - 24 - 0 - - - - Squelch gate (ms) - - - 000 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - -