From 20e08741caf0788873eec01636dc5cd8963c5d2e Mon Sep 17 00:00:00 2001 From: f4exb Date: Thu, 5 Jan 2017 11:00:07 +0100 Subject: [PATCH] WFM modulator: use CW keyer at channelizer sample rate --- plugins/channeltx/modwfm/wfmmod.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/plugins/channeltx/modwfm/wfmmod.cpp b/plugins/channeltx/modwfm/wfmmod.cpp index 0fa62d5e7..1ade3aee9 100644 --- a/plugins/channeltx/modwfm/wfmmod.cpp +++ b/plugins/channeltx/modwfm/wfmmod.cpp @@ -78,10 +78,10 @@ WFMMod::WFMMod() : DSPEngine::instance()->addAudioSource(&m_audioFifo); // CW keyer - m_cwKeyer.setSampleRate(m_config.m_audioSampleRate); + m_cwKeyer.setSampleRate(m_config.m_outputSampleRate); + m_cwSmoother.setNbFadeSamples(m_config.m_outputSampleRate / 250); // 4 ms m_cwKeyer.setWPM(13); m_cwKeyer.setMode(CWKeyer::CWNone); - m_cwSmoother.setNbFadeSamples(192); // 2 ms @ 48 kHz } WFMMod::~WFMMod() @@ -120,7 +120,7 @@ void WFMMod::pull(Sample& sample) m_settingsMutex.lock(); - if ((m_afInput == WFMModInputFile) || (m_afInput == WFMModInputAudio) || (m_afInput == WFMModInputCWTone)) + if ((m_afInput == WFMModInputFile) || (m_afInput == WFMModInputAudio)) { if (m_interpolator.interpolate(&m_interpolatorDistanceRemain, m_modSample, &ri)) { @@ -230,21 +230,21 @@ void WFMMod::pullAF(Complex& sample) if (m_cwKeyer.getSample()) { m_cwSmoother.getFadeSample(true, fadeFactor); - sample.real(m_toneNco.next() * m_running.m_volumeFactor * fadeFactor); + sample.real(m_toneNcoRF.next() * m_running.m_volumeFactor * fadeFactor); sample.imag(0.0f); } else { if (m_cwSmoother.getFadeSample(false, fadeFactor)) { - sample.real(m_toneNco.next() * m_running.m_volumeFactor * fadeFactor); + sample.real(m_toneNcoRF.next() * m_running.m_volumeFactor * fadeFactor); sample.imag(0.0f); } else { sample.real(0.0f); sample.imag(0.0f); - m_toneNco.setPhase(0); + m_toneNcoRF.setPhase(0); } } break; @@ -422,10 +422,10 @@ void WFMMod::apply() m_settingsMutex.unlock(); } - if (m_config.m_audioSampleRate != m_running.m_audioSampleRate) + if (m_config.m_outputSampleRate != m_running.m_outputSampleRate) { - m_cwKeyer.setSampleRate(m_config.m_audioSampleRate); - m_cwSmoother.setNbFadeSamples(m_config.m_audioSampleRate / 250); // 4 ms + m_cwKeyer.setSampleRate(m_config.m_outputSampleRate); + m_cwSmoother.setNbFadeSamples(m_config.m_outputSampleRate / 250); // 4 ms } m_running.m_outputSampleRate = m_config.m_outputSampleRate;