From 74604a25d4226decd7a6a808384e74d7ba256fd0 Mon Sep 17 00:00:00 2001 From: f4exb Date: Fri, 1 Mar 2019 00:25:57 +0100 Subject: [PATCH] FreeDV: a few fixes --- debian/changelog | 2 +- plugins/channelrx/demodfreedv/freedvdemod.cpp | 23 ++++-- .../channelrx/demodfreedv/freedvdemodgui.cpp | 6 +- plugins/channeltx/modfreedv/freedvmodgui.cpp | 2 +- plugins/channeltx/modfreedv/freedvmodgui.ui | 70 ++++++++++--------- 5 files changed, 61 insertions(+), 42 deletions(-) diff --git a/debian/changelog b/debian/changelog index d67e1649d..b82b5c709 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,6 @@ sdrangel (4.5.0-1) unstable; urgency=medium - * Implemented a FreeDV modulator + * Implemented a FreeDV modulator and demodulator -- Edouard Griffiths, F4EXB Sun, 03 Mar 2019 20:14:18 +0100 diff --git a/plugins/channelrx/demodfreedv/freedvdemod.cpp b/plugins/channelrx/demodfreedv/freedvdemod.cpp index 1cac39ec4..9a47dfa9b 100644 --- a/plugins/channelrx/demodfreedv/freedvdemod.cpp +++ b/plugins/channelrx/demodfreedv/freedvdemod.cpp @@ -301,8 +301,10 @@ void FreeDVDemod::feed(const SampleVector::const_iterator& begin, const SampleVe m_sum.imag(0.0); } - fftfilt::cmplx z = sideband[i]; - Real demod = (z.real() + z.imag()) * 0.7; + // fftfilt::cmplx z = sideband[i]; + // Real demod = (z.real() + z.imag()) * 0.7; + Real demod = sideband[i].real(); // works as good + if (m_agcActive) { m_simpleAGC.feed(demod); @@ -448,13 +450,22 @@ void FreeDVDemod::pushSampleToDV(int16_t sample) m_freeDVStats.collect(m_freeDV); m_freeDVSNR.accumulate(m_freeDVStats.m_snrEst); - for (int i = 0; i < nout; i++) + if (m_settings.m_audioMute) { - while (!m_audioResampler.upSample(m_speechOut[i], audioSample)) { + for (uint32_t i = 0; i < nout * m_audioResampler.getDecimation(); i++) { + pushSampleToAudio(0); + } + } + else + { + for (int i = 0; i < nout; i++) + { + while (!m_audioResampler.upSample(m_speechOut[i], audioSample)) { + pushSampleToAudio(audioSample); + } + pushSampleToAudio(audioSample); } - - pushSampleToAudio(audioSample); } m_iModem = 0; diff --git a/plugins/channelrx/demodfreedv/freedvdemodgui.cpp b/plugins/channelrx/demodfreedv/freedvdemodgui.cpp index ba708c687..d39be1113 100644 --- a/plugins/channelrx/demodfreedv/freedvdemodgui.cpp +++ b/plugins/channelrx/demodfreedv/freedvdemodgui.cpp @@ -21,7 +21,6 @@ #include "device/devicesourceapi.h" #include "device/deviceuiset.h" -#include "ui_freedvdemodgui.h" #include "dsp/spectrumvis.h" #include "dsp/dspengine.h" #include "dsp/dspcommands.h" @@ -33,6 +32,8 @@ #include "gui/crightclickenabler.h" #include "gui/audioselectdialog.h" #include "mainwindow.h" + +#include "ui_freedvdemodgui.h" #include "freedvdemod.h" FreeDVDemodGUI* FreeDVDemodGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel) @@ -387,6 +388,9 @@ void FreeDVDemodGUI::displaySettings() ui->volume->setValue(m_settings.m_volume * 10.0); ui->volumeText->setText(QString("%1").arg(m_settings.m_volume, 0, 'f', 1)); + ui->volumeIn->setValue(m_settings.m_volumeIn * 10.0); + ui->volumeInText->setText(QString("%1").arg(m_settings.m_volumeIn, 0, 'f', 1)); + blockApplySettings(false); } diff --git a/plugins/channeltx/modfreedv/freedvmodgui.cpp b/plugins/channeltx/modfreedv/freedvmodgui.cpp index a7628c0cb..2983b638e 100644 --- a/plugins/channeltx/modfreedv/freedvmodgui.cpp +++ b/plugins/channeltx/modfreedv/freedvmodgui.cpp @@ -25,7 +25,6 @@ #include "device/devicesinkapi.h" #include "device/deviceuiset.h" #include "dsp/spectrumvis.h" -#include "ui_freedvmodgui.h" #include "plugin/pluginapi.h" #include "util/simpleserializer.h" #include "util/db.h" @@ -35,6 +34,7 @@ #include "gui/audioselectdialog.h" #include "gui/basicchannelsettingsdialog.h" #include "mainwindow.h" +#include "ui_freedvmodgui.h" FreeDVModGUI* FreeDVModGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx) { diff --git a/plugins/channeltx/modfreedv/freedvmodgui.ui b/plugins/channeltx/modfreedv/freedvmodgui.ui index db21b9f82..68ed35013 100644 --- a/plugins/channeltx/modfreedv/freedvmodgui.ui +++ b/plugins/channeltx/modfreedv/freedvmodgui.ui @@ -161,7 +161,43 @@ - + + + 6 + + + + + FreeDV mode + + + + 2400A + + + + + 1600 + + + + + 800XA + + + + + 700C + + + + + 700D + + + + + @@ -385,38 +421,6 @@ - - - - FreeDV mode - - - - 2400A - - - - - 1600 - - - - - 800XA - - - - - 700C - - - - - 700D - - - -