1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 16:08:39 -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)
{
Complex ci;
Real t;
m_settingsMutex.lock();
if (m_interpolatorDistance > 1.0f) // decimate
{
pullAF(t);
m_modSample.real(((t+1.0f) * m_running.m_modFactor * 16384.0f)); // modulate and scale zero frequency carrier
m_modSample.imag(0.0f);
modulateSample();
while (!m_interpolator.decimate(&m_interpolatorDistanceRemain, m_modSample, &ci))
{
pullAF(t);
m_modSample.real(((t+1.0f) * m_running.m_modFactor * 16384.0f)); // modulate and scale zero frequency carrier
m_modSample.imag(0.0f);
modulateSample();
}
}
else
{
if (m_interpolator.interpolate(&m_interpolatorDistanceRemain, m_modSample, &ci))
{
pullAF(t);
m_modSample.real(((t+1.0f) * m_running.m_modFactor * 16384.0f)); // modulate and scale zero frequency carrier
m_modSample.imag(0.0f);
modulateSample();
}
}
@ -124,6 +117,16 @@ void AMMod::pull(Sample& sample)
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)
{
int16_t audioSample[2];

View File

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