1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 09:48:45 -05:00

WFM modulator: use CW keyer at channelizer sample rate

This commit is contained in:
f4exb 2017-01-05 11:00:07 +01:00
parent 5e324e816a
commit 20e08741ca

View File

@ -78,10 +78,10 @@ WFMMod::WFMMod() :
DSPEngine::instance()->addAudioSource(&m_audioFifo); DSPEngine::instance()->addAudioSource(&m_audioFifo);
// CW keyer // 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.setWPM(13);
m_cwKeyer.setMode(CWKeyer::CWNone); m_cwKeyer.setMode(CWKeyer::CWNone);
m_cwSmoother.setNbFadeSamples(192); // 2 ms @ 48 kHz
} }
WFMMod::~WFMMod() WFMMod::~WFMMod()
@ -120,7 +120,7 @@ void WFMMod::pull(Sample& sample)
m_settingsMutex.lock(); 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)) if (m_interpolator.interpolate(&m_interpolatorDistanceRemain, m_modSample, &ri))
{ {
@ -230,21 +230,21 @@ void WFMMod::pullAF(Complex& sample)
if (m_cwKeyer.getSample()) if (m_cwKeyer.getSample())
{ {
m_cwSmoother.getFadeSample(true, fadeFactor); 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); sample.imag(0.0f);
} }
else else
{ {
if (m_cwSmoother.getFadeSample(false, fadeFactor)) 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); sample.imag(0.0f);
} }
else else
{ {
sample.real(0.0f); sample.real(0.0f);
sample.imag(0.0f); sample.imag(0.0f);
m_toneNco.setPhase(0); m_toneNcoRF.setPhase(0);
} }
} }
break; break;
@ -422,10 +422,10 @@ void WFMMod::apply()
m_settingsMutex.unlock(); 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_cwKeyer.setSampleRate(m_config.m_outputSampleRate);
m_cwSmoother.setNbFadeSamples(m_config.m_audioSampleRate / 250); // 4 ms m_cwSmoother.setNbFadeSamples(m_config.m_outputSampleRate / 250); // 4 ms
} }
m_running.m_outputSampleRate = m_config.m_outputSampleRate; m_running.m_outputSampleRate = m_config.m_outputSampleRate;