diff --git a/plugins/channeltx/modam/ammodsource.cpp b/plugins/channeltx/modam/ammodsource.cpp index 895ed2b3e..37ac850f4 100644 --- a/plugins/channeltx/modam/ammodsource.cpp +++ b/plugins/channeltx/modam/ammodsource.cpp @@ -343,10 +343,12 @@ void AMModSource::applyFeedbackAudioSampleRate(int sampleRate) qDebug("AMModSource::applyFeedbackAudioSampleRate: %u", sampleRate); + // Resample from the audio input rate to the feedback device rate. The distance is + // input samples per output sample and the filter is designed at the input rate. m_feedbackInterpolatorDistanceRemain = 0; - m_feedbackInterpolatorDistance = (Real) sampleRate / (Real) m_audioSampleRate; + m_feedbackInterpolatorDistance = (Real) m_audioSampleRate / (Real) sampleRate; Real cutoff = ((float) std::min(sampleRate, m_audioSampleRate)) / 2.2f; - m_feedbackInterpolator.create(48, sampleRate, cutoff, 3.0); + m_feedbackInterpolator.create(48, m_audioSampleRate, cutoff, 3.0); m_feedbackAudioSampleRate = sampleRate; } diff --git a/plugins/channeltx/modm17/m17modsource.cpp b/plugins/channeltx/modm17/m17modsource.cpp index 888eab0e3..bd0878190 100644 --- a/plugins/channeltx/modm17/m17modsource.cpp +++ b/plugins/channeltx/modm17/m17modsource.cpp @@ -518,11 +518,13 @@ void M17ModSource::applyFeedbackAudioSampleRate(int sampleRate) qDebug("NFMModSource::applyFeedbackAudioSampleRate: %d", sampleRate); + // Resample from the audio input rate to the feedback device rate. The distance is + // input samples per output sample and the filter is designed at the input rate. m_feedbackInterpolatorDistanceRemain = 0; m_feedbackInterpolatorConsumed = false; - m_feedbackInterpolatorDistance = (Real) sampleRate / (Real) m_audioSampleRate; + m_feedbackInterpolatorDistance = (Real) m_audioSampleRate / (Real) sampleRate; Real cutoff = std::min(sampleRate, m_audioSampleRate) / 2.2f; - m_feedbackInterpolator.create(48, sampleRate, cutoff, 3.0); + m_feedbackInterpolator.create(48, m_audioSampleRate, cutoff, 3.0); m_feedbackAudioSampleRate = sampleRate; } diff --git a/plugins/channeltx/modnfm/nfmmod.cpp b/plugins/channeltx/modnfm/nfmmod.cpp index fe0e8567a..35082363b 100644 --- a/plugins/channeltx/modnfm/nfmmod.cpp +++ b/plugins/channeltx/modnfm/nfmmod.cpp @@ -17,7 +17,6 @@ // along with this program. If not, see . // /////////////////////////////////////////////////////////////////////////////////// -#include #include #include #include @@ -31,8 +30,6 @@ #include "SWGChannelReport.h" #include "SWGNFMModReport.h" -#include -#include #include #include "dsp/dspcommands.h" diff --git a/plugins/channeltx/modnfm/nfmmod.h b/plugins/channeltx/modnfm/nfmmod.h index 659fd1c76..7382ec727 100644 --- a/plugins/channeltx/modnfm/nfmmod.h +++ b/plugins/channeltx/modnfm/nfmmod.h @@ -248,11 +248,6 @@ public: static const char* const m_channelId; private: - enum RateState { - RSInitialFill, - RSRunning - }; - DeviceAPI* m_deviceAPI; QThread *m_thread; bool m_running = false; @@ -261,7 +256,6 @@ private: int m_basebandSampleRate; qint64 m_centerFrequency; - SampleVector m_sampleBuffer; QRecursiveMutex m_settingsMutex; std::ifstream m_ifstream; diff --git a/plugins/channeltx/modnfm/nfmmodsource.cpp b/plugins/channeltx/modnfm/nfmmodsource.cpp index eb7f561c7..e0176d7f1 100644 --- a/plugins/channeltx/modnfm/nfmmodsource.cpp +++ b/plugins/channeltx/modnfm/nfmmodsource.cpp @@ -364,7 +364,6 @@ void NFMModSource::applyAudioSampleRate(int sampleRate) qDebug("NFMModSource::applyAudioSampleRate: %d", sampleRate); m_interpolatorDistanceRemain = 0; - m_interpolatorConsumed = false; m_interpolatorDistance = (Real) sampleRate / (Real) m_channelSampleRate; m_interpolator.create(48, sampleRate, m_settings.m_rfBandwidth / 2.2, 3.0); m_lowpass.create(301, sampleRate, m_settings.m_afBandwidth); @@ -409,11 +408,12 @@ void NFMModSource::applyFeedbackAudioSampleRate(int sampleRate) qDebug("NFMModSource::applyFeedbackAudioSampleRate: %d", sampleRate); + // Resample from the audio input rate to the feedback device rate. The distance is + // input samples per output sample and the filter is designed at the input rate. m_feedbackInterpolatorDistanceRemain = 0; - m_feedbackInterpolatorConsumed = false; - m_feedbackInterpolatorDistance = (Real) sampleRate / (Real) m_audioSampleRate; + m_feedbackInterpolatorDistance = (Real) m_audioSampleRate / (Real) sampleRate; Real cutoff = (float) std::min(sampleRate, m_audioSampleRate) / 2.2f; - m_feedbackInterpolator.create(48, sampleRate, cutoff, 3.0); + m_feedbackInterpolator.create(48, m_audioSampleRate, cutoff, 3.0); m_feedbackAudioSampleRate = sampleRate; } @@ -474,7 +474,6 @@ void NFMModSource::applyChannelSettings(int channelSampleRate, int channelFreque if ((channelSampleRate != m_channelSampleRate) || force) { m_interpolatorDistanceRemain = 0; - m_interpolatorConsumed = false; m_interpolatorDistance = (Real) m_audioSampleRate / (Real) channelSampleRate; m_interpolator.create(48, m_audioSampleRate, m_settings.m_rfBandwidth / 2.2, 3.0); } diff --git a/plugins/channeltx/modnfm/nfmmodsource.h b/plugins/channeltx/modnfm/nfmmodsource.h index 236853cfc..237061dc6 100644 --- a/plugins/channeltx/modnfm/nfmmodsource.h +++ b/plugins/channeltx/modnfm/nfmmodsource.h @@ -88,12 +88,10 @@ private: Interpolator m_interpolator; Real m_interpolatorDistance; Real m_interpolatorDistanceRemain; - bool m_interpolatorConsumed; Interpolator m_feedbackInterpolator; Real m_feedbackInterpolatorDistance; Real m_feedbackInterpolatorDistanceRemain; - bool m_feedbackInterpolatorConsumed; QVector m_demodBuffer; int m_demodBufferFill; diff --git a/plugins/channeltx/modnfm/nfmmodwebapiadapter.cpp b/plugins/channeltx/modnfm/nfmmodwebapiadapter.cpp index da7a20ea0..32f704401 100644 --- a/plugins/channeltx/modnfm/nfmmodwebapiadapter.cpp +++ b/plugins/channeltx/modnfm/nfmmodwebapiadapter.cpp @@ -59,7 +59,6 @@ int NFMModWebAPIAdapter::webapiSettingsPutPatch( SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getNfmModSettings()->getCwKeyer(); CWKeyer::webapiSettingsPutPatch(channelSettingsKeys, newCWKeyerSettings, apiCwKeyerSettings); m_settings.setCWKeyerSettings(newCWKeyerSettings); - const QByteArray& serializedNewSettings = m_settings.serialize(); // effectively update CW keyer settings } NFMMod::webapiFormatChannelSettings(response, m_settings); diff --git a/plugins/channeltx/modssb/ssbmodsource.cpp b/plugins/channeltx/modssb/ssbmodsource.cpp index bea9c2dbf..bc936fd7a 100644 --- a/plugins/channeltx/modssb/ssbmodsource.cpp +++ b/plugins/channeltx/modssb/ssbmodsource.cpp @@ -644,11 +644,13 @@ void SSBModSource::applyFeedbackAudioSampleRate(int sampleRate) qDebug("SSBModSource::applyFeedbackAudioSampleRate: %d", sampleRate); + // Resample from the audio input rate to the feedback device rate. The distance is + // input samples per output sample and the filter is designed at the input rate. m_feedbackInterpolatorDistanceRemain = 0; m_feedbackInterpolatorConsumed = false; - m_feedbackInterpolatorDistance = (Real) sampleRate / (Real) m_audioSampleRate; + m_feedbackInterpolatorDistance = (Real) m_audioSampleRate / (Real) sampleRate; Real cutoff = (float) (std::min(sampleRate, m_audioSampleRate)) / 2.2f; - m_feedbackInterpolator.create(48, sampleRate, cutoff, 3.0); + m_feedbackInterpolator.create(48, m_audioSampleRate, cutoff, 3.0); m_feedbackAudioSampleRate = sampleRate; } diff --git a/plugins/channeltx/modwfm/wfmmodsource.cpp b/plugins/channeltx/modwfm/wfmmodsource.cpp index c03698a1a..f9a3f16c0 100644 --- a/plugins/channeltx/modwfm/wfmmodsource.cpp +++ b/plugins/channeltx/modwfm/wfmmodsource.cpp @@ -398,11 +398,13 @@ void WFMModSource::applyFeedbackAudioSampleRate(int sampleRate) qDebug("WFMModSource::applyFeedbackAudioSampleRate: %d", sampleRate); + // Resample from the audio input rate to the feedback device rate. The distance is + // input samples per output sample and the filter is designed at the input rate. m_feedbackInterpolatorDistanceRemain = 0; m_feedbackInterpolatorConsumed = false; - m_feedbackInterpolatorDistance = (Real) sampleRate / (Real) m_audioSampleRate; + m_feedbackInterpolatorDistance = (Real) m_audioSampleRate / (Real) sampleRate; Real cutoff = std::min(sampleRate, m_audioSampleRate) / 2.2f; - m_feedbackInterpolator.create(48, sampleRate, cutoff, 3.0); + m_feedbackInterpolator.create(48, m_audioSampleRate, cutoff, 3.0); m_feedbackAudioSampleRate = sampleRate; }