1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

Tx ph.2: implemented ancient interpolator in AMMod

This commit is contained in:
f4exb 2016-10-27 19:55:52 +02:00
parent 4618e007de
commit 9540a99ac4
2 changed files with 13 additions and 8 deletions

View File

@ -65,13 +65,16 @@ void AMMod::pull(Sample& sample)
{
Complex ci;
if (m_interpolator.interpolate(&m_interpolatorDistanceRemain, m_modSample, &ci))
{
Real t = m_toneNco.next();
m_modSample.real(((t+1.0f) * m_running.m_modFactor * 16384.0f)); // modulate and scale zero frequency carrier
m_modSample.imag(0.0f);
m_interpolatorDistanceRemain += m_interpolatorDistance;
}
m_interpolator.interpolate(&m_interpolatorDistanceRemain, m_modSample, &m_interpolatorConsumed, &ci);
m_interpolatorDistanceRemain += m_interpolatorDistance;
if (m_interpolatorConsumed)
{
Real t = m_toneNco.next();
m_modSample.real(((t+1.0f) * m_running.m_modFactor * 16384.0f)); // modulate and scale zero frequency carrier
m_modSample.imag(0.0f);
m_interpolatorConsumed = false;
}
ci *= m_carrierNco.nextIQ(); // shift to carrier frequency
@ -157,7 +160,8 @@ void AMMod::apply()
m_settingsMutex.lock();
m_interpolator.create(16, m_config.m_outputSampleRate, m_config.m_rfBandwidth / 2.2);
m_interpolatorDistanceRemain = 0;
m_interpolatorDistance = (Real) m_config.m_outputSampleRate / (Real) m_config.m_audioSampleRate;
m_interpolatorConsumed = false;
m_interpolatorDistance = (Real) m_config.m_audioSampleRate / (Real) m_config.m_outputSampleRate;
m_settingsMutex.unlock();
}

View File

@ -114,6 +114,7 @@ private:
Interpolator m_interpolator;
Real m_interpolatorDistance;
Real m_interpolatorDistanceRemain;
bool m_interpolatorConsumed;
Lowpass<Real> m_lowpass;
Real m_magsq;