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

AM Modulator: corrected modulation

This commit is contained in:
f4exb 2016-11-30 17:58:35 +01:00
parent 47eb55a319
commit c6a61cb94c
2 changed files with 14 additions and 10 deletions

View File

@ -82,30 +82,23 @@ void AMMod::configure(MessageQueue* messageQueue,
void AMMod::pull(Sample& sample) void AMMod::pull(Sample& sample)
{ {
Complex ci; Complex ci;
Real t;
m_settingsMutex.lock(); m_settingsMutex.lock();
if (m_interpolatorDistance > 1.0f) // decimate if (m_interpolatorDistance > 1.0f) // decimate
{ {
pullAF(t); modulateSample();
m_modSample.real(((t+1.0f) * m_running.m_modFactor * 16384.0f)); // modulate and scale zero frequency carrier
m_modSample.imag(0.0f);
while (!m_interpolator.decimate(&m_interpolatorDistanceRemain, m_modSample, &ci)) while (!m_interpolator.decimate(&m_interpolatorDistanceRemain, m_modSample, &ci))
{ {
pullAF(t); modulateSample();
m_modSample.real(((t+1.0f) * m_running.m_modFactor * 16384.0f)); // modulate and scale zero frequency carrier
m_modSample.imag(0.0f);
} }
} }
else else
{ {
if (m_interpolator.interpolate(&m_interpolatorDistanceRemain, m_modSample, &ci)) if (m_interpolator.interpolate(&m_interpolatorDistanceRemain, m_modSample, &ci))
{ {
pullAF(t); modulateSample();
m_modSample.real(((t+1.0f) * m_running.m_modFactor * 16384.0f)); // modulate and scale zero frequency carrier
m_modSample.imag(0.0f);
} }
} }
@ -124,6 +117,16 @@ void AMMod::pull(Sample& sample)
sample.m_imag = (FixReal) ci.imag(); sample.m_imag = (FixReal) ci.imag();
} }
void AMMod::modulateSample()
{
Real t;
pullAF(t);
m_modSample.real((t*m_running.m_modFactor + 1.0f) * 16384.0f); // modulate and scale zero frequency carrier
m_modSample.imag(0.0f);
}
void AMMod::pullAF(Real& sample) void AMMod::pullAF(Real& sample)
{ {
int16_t audioSample[2]; int16_t audioSample[2];

View File

@ -285,6 +285,7 @@ private:
void apply(); void apply();
void pullAF(Real& sample); void pullAF(Real& sample);
void modulateSample();
void openFileStream(); void openFileStream();
void seekFileStream(int seekPercentage); void seekFileStream(int seekPercentage);
}; };