diff --git a/plugins/channelrx/udpsrc/udpsrc.cpp b/plugins/channelrx/udpsrc/udpsrc.cpp index dc2c1ab24..09370909b 100644 --- a/plugins/channelrx/udpsrc/udpsrc.cpp +++ b/plugins/channelrx/udpsrc/udpsrc.cpp @@ -61,7 +61,6 @@ UDPSrc::UDPSrc(DeviceSourceAPI *deviceAPI) : m_udpBuffer16 = new UDPSink(this, udpBlockSize, m_settings.m_udpPort); m_udpBufferMono16 = new UDPSink(this, udpBlockSize, m_settings.m_udpPort); m_udpBuffer24 = new UDPSink(this, udpBlockSize, m_settings.m_udpPort); - m_udpBufferMono24 = new UDPSink(this, udpBlockSize, m_settings.m_udpPort); m_audioSocket = new QUdpSocket(this); m_udpAudioBuf = new char[m_udpAudioPayloadSize]; @@ -113,7 +112,6 @@ UDPSrc::~UDPSrc() { delete m_audioSocket; delete m_udpBuffer24; - delete m_udpBufferMono24; delete m_udpBuffer16; delete m_udpBufferMono16; delete[] m_udpAudioBuf; @@ -153,7 +151,8 @@ void UDPSrc::feed(const SampleVector::const_iterator& begin, const SampleVector: if ((m_settings.m_agc) && (m_settings.m_sampleFormat != UDPSrcSettings::FormatNFM) && (m_settings.m_sampleFormat != UDPSrcSettings::FormatNFMMono) && - (m_settings.m_sampleFormat != UDPSrcSettings::FormatIQ)) + (m_settings.m_sampleFormat != UDPSrcSettings::FormatIQ16) && + (m_settings.m_sampleFormat != UDPSrcSettings::FormatIQ24)) { agcFactor = m_agc.feedAndGetValue(ci); inMagSq = m_agc.getMagSq(); @@ -494,7 +493,6 @@ void UDPSrc::applySettings(const UDPSrcSettings& settings, bool force) << " m_squelchGate" << settings.m_squelchGate << " m_agc" << settings.m_agc << " m_sampleFormat: " << settings.m_sampleFormat - << " m_sampleSize: " << 16 + settings.m_sampleSize*8 << " m_outputSampleRate: " << settings.m_outputSampleRate << " m_rfBandwidth: " << settings.m_rfBandwidth << " m_fmDeviation: " << settings.m_fmDeviation @@ -582,7 +580,6 @@ void UDPSrc::applySettings(const UDPSrcSettings& settings, bool force) m_udpBuffer16->setAddress(const_cast(settings.m_udpAddress)); m_udpBufferMono16->setAddress(const_cast(settings.m_udpAddress)); m_udpBuffer24->setAddress(const_cast(settings.m_udpAddress)); - m_udpBufferMono24->setAddress(const_cast(settings.m_udpAddress)); } if ((settings.m_udpPort != m_settings.m_udpPort) || force) @@ -590,7 +587,6 @@ void UDPSrc::applySettings(const UDPSrcSettings& settings, bool force) m_udpBuffer16->setPort(settings.m_udpPort); m_udpBufferMono16->setPort(settings.m_udpPort); m_udpBuffer24->setPort(settings.m_udpPort); - m_udpBufferMono24->setPort(settings.m_udpPort); } if ((settings.m_audioPort != m_settings.m_audioPort) || force) diff --git a/plugins/channelrx/udpsrc/udpsrc.h b/plugins/channelrx/udpsrc/udpsrc.h index 9e9864d4e..8ef8f75dc 100644 --- a/plugins/channelrx/udpsrc/udpsrc.h +++ b/plugins/channelrx/udpsrc/udpsrc.h @@ -186,7 +186,6 @@ protected: UDPSink *m_udpBuffer16; UDPSink *m_udpBufferMono16; UDPSink *m_udpBuffer24; - UDPSink *m_udpBufferMono24; AudioVector m_audioBuffer; uint m_audioBufferFill; @@ -281,18 +280,22 @@ protected: { if (SDR_RX_SAMP_SZ == 16) { - if (m_settings.m_sampleSize == UDPSrcSettings::Size16bits) { + if (m_settings.m_sampleFormat == UDPSrcSettings::FormatIQ16) { m_udpBuffer16->write(Sample16(real, imag)); - } else if (m_settings.m_sampleSize == UDPSrcSettings::Size24bits) { + } else if (m_settings.m_sampleFormat == UDPSrcSettings::FormatIQ24) { m_udpBuffer24->write(Sample24(real<<8, imag<<8)); + } else { + m_udpBuffer16->write(Sample16(real, imag)); } } else if (SDR_RX_SAMP_SZ == 24) { - if (m_settings.m_sampleSize == UDPSrcSettings::Size16bits) { + if (m_settings.m_sampleFormat == UDPSrcSettings::FormatIQ16) { m_udpBuffer16->write(Sample16(real>>8, imag>>8)); - } else if (m_settings.m_sampleSize == UDPSrcSettings::Size24bits) { + } else if (m_settings.m_sampleFormat == UDPSrcSettings::FormatIQ24) { m_udpBuffer24->write(Sample24(real, imag)); + } else { + m_udpBuffer16->write(Sample16(real>>8, imag>>8)); } } } @@ -301,38 +304,22 @@ protected: { if (SDR_RX_SAMP_SZ == 16) { - if (m_settings.m_sampleSize == UDPSrcSettings::Size16bits) { - m_udpBufferMono16->write(sample); - } else if (m_settings.m_sampleSize == UDPSrcSettings::Size24bits) { - m_udpBufferMono24->write(sample<<8); - } + m_udpBufferMono16->write(sample); } else if (SDR_RX_SAMP_SZ == 24) { - if (m_settings.m_sampleSize == UDPSrcSettings::Size16bits) { - m_udpBufferMono16->write(sample>>8); - } else if (m_settings.m_sampleSize == UDPSrcSettings::Size24bits) { - m_udpBufferMono24->write(sample); - } + m_udpBufferMono16->write(sample>>8); } } void udpWriteNorm(Real real, Real imag) { - if (m_settings.m_sampleSize == UDPSrcSettings::Size16bits) { - m_udpBuffer16->write(Sample16(real*32768.0, imag*32768.0)); - } else if (m_settings.m_sampleSize == UDPSrcSettings::Size24bits) { - m_udpBuffer24->write(Sample24(real*8388608.0, imag*8388608.0)); - } + m_udpBuffer16->write(Sample16(real*32768.0, imag*32768.0)); } void udpWriteNormMono(Real sample) { - if (m_settings.m_sampleSize == UDPSrcSettings::Size16bits) { - m_udpBufferMono16->write(sample*32768.0); - } else if (m_settings.m_sampleSize == UDPSrcSettings::Size24bits) { - m_udpBufferMono24->write(sample*8388608.0); - } + m_udpBufferMono16->write(sample*32768.0); } }; diff --git a/plugins/channelrx/udpsrc/udpsrcgui.cpp b/plugins/channelrx/udpsrc/udpsrcgui.cpp index 518b6cb17..045b13029 100644 --- a/plugins/channelrx/udpsrc/udpsrcgui.cpp +++ b/plugins/channelrx/udpsrc/udpsrcgui.cpp @@ -251,36 +251,39 @@ void UDPSrcGUI::setSampleFormatIndex(const UDPSrcSettings::SampleFormat& sampleF { switch(sampleFormat) { - case UDPSrcSettings::FormatIQ: + case UDPSrcSettings::FormatIQ16: ui->sampleFormat->setCurrentIndex(0); break; - case UDPSrcSettings::FormatNFM: + case UDPSrcSettings::FormatIQ24: ui->sampleFormat->setCurrentIndex(1); break; - case UDPSrcSettings::FormatNFMMono: + case UDPSrcSettings::FormatNFM: ui->sampleFormat->setCurrentIndex(2); break; - case UDPSrcSettings::FormatLSB: + case UDPSrcSettings::FormatNFMMono: ui->sampleFormat->setCurrentIndex(3); break; - case UDPSrcSettings::FormatUSB: + case UDPSrcSettings::FormatLSB: ui->sampleFormat->setCurrentIndex(4); break; - case UDPSrcSettings::FormatLSBMono: + case UDPSrcSettings::FormatUSB: ui->sampleFormat->setCurrentIndex(5); break; - case UDPSrcSettings::FormatUSBMono: + case UDPSrcSettings::FormatLSBMono: ui->sampleFormat->setCurrentIndex(6); break; - case UDPSrcSettings::FormatAMMono: + case UDPSrcSettings::FormatUSBMono: ui->sampleFormat->setCurrentIndex(7); break; - case UDPSrcSettings::FormatAMNoDCMono: + case UDPSrcSettings::FormatAMMono: ui->sampleFormat->setCurrentIndex(8); break; - case UDPSrcSettings::FormatAMBPFMono: + case UDPSrcSettings::FormatAMNoDCMono: ui->sampleFormat->setCurrentIndex(9); break; + case UDPSrcSettings::FormatAMBPFMono: + ui->sampleFormat->setCurrentIndex(10); + break; default: ui->sampleFormat->setCurrentIndex(0); break; @@ -292,47 +295,51 @@ void UDPSrcGUI::setSampleFormat(int index) switch(index) { case 0: - m_settings.m_sampleFormat = UDPSrcSettings::FormatIQ; + m_settings.m_sampleFormat = UDPSrcSettings::FormatIQ16; ui->fmDeviation->setEnabled(false); break; case 1: + m_settings.m_sampleFormat = UDPSrcSettings::FormatIQ24; + ui->fmDeviation->setEnabled(false); + break; + case 2: m_settings.m_sampleFormat = UDPSrcSettings::FormatNFM; ui->fmDeviation->setEnabled(true); break; - case 2: + case 3: m_settings.m_sampleFormat = UDPSrcSettings::FormatNFMMono; ui->fmDeviation->setEnabled(true); break; - case 3: + case 4: m_settings.m_sampleFormat = UDPSrcSettings::FormatLSB; ui->fmDeviation->setEnabled(false); break; - case 4: + case 5: m_settings.m_sampleFormat = UDPSrcSettings::FormatUSB; ui->fmDeviation->setEnabled(false); break; - case 5: + case 6: m_settings.m_sampleFormat = UDPSrcSettings::FormatLSBMono; ui->fmDeviation->setEnabled(false); break; - case 6: + case 7: m_settings.m_sampleFormat = UDPSrcSettings::FormatUSBMono; ui->fmDeviation->setEnabled(false); break; - case 7: + case 8: m_settings.m_sampleFormat = UDPSrcSettings::FormatAMMono; ui->fmDeviation->setEnabled(false); break; - case 8: + case 9: m_settings.m_sampleFormat = UDPSrcSettings::FormatAMNoDCMono; ui->fmDeviation->setEnabled(false); break; - case 9: + case 10: m_settings.m_sampleFormat = UDPSrcSettings::FormatAMBPFMono; ui->fmDeviation->setEnabled(false); break; default: - m_settings.m_sampleFormat = UDPSrcSettings::FormatIQ; + m_settings.m_sampleFormat = UDPSrcSettings::FormatIQ16; ui->fmDeviation->setEnabled(false); break; } @@ -384,18 +391,6 @@ void UDPSrcGUI::on_sampleFormat_currentIndexChanged(int index) ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }"); } -void UDPSrcGUI::on_sampleSize_currentIndexChanged(int index) -{ - if ((index < 0) || (index >= UDPSrcSettings::SizeNone)) { - return; - } - - m_settings.m_sampleSize = (UDPSrcSettings::SampleSize) index; - - ui->applyBtn->setEnabled(true); - ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }"); -} - void UDPSrcGUI::on_sampleRate_textEdited(const QString& arg1 __attribute__((unused))) { bool ok; diff --git a/plugins/channelrx/udpsrc/udpsrcgui.h b/plugins/channelrx/udpsrc/udpsrcgui.h index 0ae8fec13..e6fef1ad2 100644 --- a/plugins/channelrx/udpsrc/udpsrcgui.h +++ b/plugins/channelrx/udpsrc/udpsrcgui.h @@ -94,7 +94,6 @@ private: private slots: void on_deltaFrequency_changed(qint64 value); void on_sampleFormat_currentIndexChanged(int index); - void on_sampleSize_currentIndexChanged(int index); void on_sampleRate_textEdited(const QString& arg1); void on_rfBandwidth_textEdited(const QString& arg1); void on_fmDeviation_textEdited(const QString& arg1); diff --git a/plugins/channelrx/udpsrc/udpsrcgui.ui b/plugins/channelrx/udpsrc/udpsrcgui.ui index 8b50c2c30..19ef8a26c 100644 --- a/plugins/channelrx/udpsrc/udpsrcgui.ui +++ b/plugins/channelrx/udpsrc/udpsrcgui.ui @@ -386,7 +386,12 @@ - I/Q + I/Q 16bits + + + + + I/Q 24bits @@ -436,23 +441,6 @@ - - - - Samples size - - - - 16 bits - - - - - 24 bits - - - - diff --git a/plugins/channelrx/udpsrc/udpsrcplugin.cpp b/plugins/channelrx/udpsrc/udpsrcplugin.cpp index 032b7868b..0ad6887e7 100644 --- a/plugins/channelrx/udpsrc/udpsrcplugin.cpp +++ b/plugins/channelrx/udpsrc/udpsrcplugin.cpp @@ -25,7 +25,7 @@ const PluginDescriptor UDPSrcPlugin::m_pluginDescriptor = { QString("UDP Channel Source"), - QString("3.12.0"), + QString("3.14.3"), QString("(c) Edouard Griffiths, F4EXB"), QString("https://github.com/f4exb/sdrangel"), true, diff --git a/plugins/channelrx/udpsrc/udpsrcsettings.cpp b/plugins/channelrx/udpsrc/udpsrcsettings.cpp index eb28df536..31578c657 100644 --- a/plugins/channelrx/udpsrc/udpsrcsettings.cpp +++ b/plugins/channelrx/udpsrc/udpsrcsettings.cpp @@ -31,8 +31,7 @@ UDPSrcSettings::UDPSrcSettings() : void UDPSrcSettings::resetToDefaults() { m_outputSampleRate = 48000; - m_sampleFormat = FormatIQ; - m_sampleSize = Size16bits; + m_sampleFormat = FormatIQ16; m_inputFrequencyOffset = 0; m_rfBandwidth = 12500; m_fmDeviation = 2500; @@ -78,7 +77,6 @@ QByteArray UDPSrcSettings::serialize() const s.writeS32(17, m_squelchGate); s.writeBool(18, m_agc); s.writeString(19, m_title); - s.writeS32(20, (int) m_sampleFormat); return s.final(); @@ -108,12 +106,12 @@ bool UDPSrcSettings::deserialize(const QByteArray& data) d.readS32(2, &s32tmp, 0); m_inputFrequencyOffset = s32tmp; - d.readS32(3, &s32tmp, FormatIQ); + d.readS32(3, &s32tmp, FormatIQ16); if ((s32tmp >= 0) && (s32tmp < (int) FormatNone)) { m_sampleFormat = (SampleFormat) s32tmp; } else { - m_sampleFormat = FormatIQ; + m_sampleFormat = FormatIQ16; } d.readReal(4, &m_outputSampleRate, 48000.0); @@ -136,14 +134,6 @@ bool UDPSrcSettings::deserialize(const QByteArray& data) d.readBool(18, &m_agc, false); d.readString(19, &m_title, "UDP Sample Source"); - d.readS32(20, &s32tmp, Size16bits); - - if ((s32tmp >= 0) && (s32tmp < (int) SizeNone)) { - m_sampleSize = (SampleSize) s32tmp; - } else { - m_sampleSize = Size16bits; - } - return true; } else diff --git a/plugins/channelrx/udpsrc/udpsrcsettings.h b/plugins/channelrx/udpsrc/udpsrcsettings.h index 7286d5fcf..b268b47c4 100644 --- a/plugins/channelrx/udpsrc/udpsrcsettings.h +++ b/plugins/channelrx/udpsrc/udpsrcsettings.h @@ -26,7 +26,8 @@ class Serializable; struct UDPSrcSettings { enum SampleFormat { - FormatIQ, + FormatIQ16, + FormatIQ24, FormatNFM, FormatNFMMono, FormatLSB, @@ -39,15 +40,8 @@ struct UDPSrcSettings FormatNone }; - enum SampleSize { - Size16bits, - Size24bits, - SizeNone - }; - float m_outputSampleRate; SampleFormat m_sampleFormat; - SampleSize m_sampleSize; int64_t m_inputFrequencyOffset; float m_rfBandwidth; int m_fmDeviation; diff --git a/plugins/channeltx/udpsink/udpsinkplugin.cpp b/plugins/channeltx/udpsink/udpsinkplugin.cpp index 959feead3..e02545094 100644 --- a/plugins/channeltx/udpsink/udpsinkplugin.cpp +++ b/plugins/channeltx/udpsink/udpsinkplugin.cpp @@ -27,7 +27,7 @@ const PluginDescriptor UDPSinkPlugin::m_pluginDescriptor = { QString("UDP Channel Sink"), - QString("3.14.2"), + QString("3.14.3"), QString("(c) Edouard Griffiths, F4EXB"), QString("https://github.com/f4exb/sdrangel"), true,