mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-02-20 12:42:17 -05:00
Tx ph.1: fixed AM modulator frequency translation
This commit is contained in:
parent
9f1b801d1a
commit
7b4032ac0d
@ -65,22 +65,17 @@ void AMMod::pull(Sample& sample)
|
|||||||
{
|
{
|
||||||
Complex ci;
|
Complex ci;
|
||||||
|
|
||||||
if (m_interpolator.interpolate(&m_interpolatorDistanceRemain, m_modSample, &ci))
|
if (m_interpolator.interpolate(&m_interpolatorDistanceRemain, m_modSample, &ci))
|
||||||
{
|
{
|
||||||
m_settingsMutex.lock();
|
Real t = m_toneNco.next();
|
||||||
m_carrierNco.nextPhase();
|
m_modSample.real(((t+1.0f) * m_running.m_modFactor * 16384.0f)); // modulate and scale zero frequency carrier
|
||||||
m_toneNco.nextPhase();
|
m_modSample.imag(0.0f);
|
||||||
m_settingsMutex.unlock();
|
m_interpolatorDistanceRemain += m_interpolatorDistance;
|
||||||
|
}
|
||||||
|
|
||||||
m_carrierNco.getIQ(m_modSample);
|
ci *= m_carrierNco.nextIQ(); // shift to carrier frequency
|
||||||
Real t = m_toneNco.get();
|
|
||||||
|
|
||||||
m_modSample *= (t+1.0f) * m_running.m_modFactor * 16384.0f; // modulate and scale carrier
|
Real magsq = ci.real() * ci.real() + ci.imag() * ci.imag();
|
||||||
|
|
||||||
m_interpolatorDistanceRemain += m_interpolatorDistance;
|
|
||||||
}
|
|
||||||
|
|
||||||
Real magsq = ci.real() * ci.real() + ci.imag() * ci.imag();
|
|
||||||
magsq /= (1<<30);
|
magsq /= (1<<30);
|
||||||
m_movingAverage.feed(magsq);
|
m_movingAverage.feed(magsq);
|
||||||
m_magsq = m_movingAverage.average();
|
m_magsq = m_movingAverage.average();
|
||||||
@ -148,9 +143,10 @@ bool AMMod::handleMessage(const Message& cmd)
|
|||||||
void AMMod::apply()
|
void AMMod::apply()
|
||||||
{
|
{
|
||||||
|
|
||||||
if(m_config.m_inputFrequencyOffset != m_running.m_inputFrequencyOffset)
|
if ((m_config.m_inputFrequencyOffset != m_running.m_inputFrequencyOffset) ||
|
||||||
|
(m_config.m_outputSampleRate != m_running.m_outputSampleRate))
|
||||||
{
|
{
|
||||||
m_carrierNco.setFreq(m_config.m_inputFrequencyOffset, m_config.m_audioSampleRate);
|
m_carrierNco.setFreq(m_config.m_inputFrequencyOffset, m_config.m_outputSampleRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if((m_config.m_outputSampleRate != m_running.m_outputSampleRate) ||
|
if((m_config.m_outputSampleRate != m_running.m_outputSampleRate) ||
|
||||||
|
Loading…
Reference in New Issue
Block a user