mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-09-04 14:17:50 -04:00
SSB modulator: fixed audio compressor constants. Fixes #719
This commit is contained in:
parent
ea4785b546
commit
d1e0f8d865
@ -18,6 +18,7 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
#include "dsp/basebandsamplesink.h"
|
#include "dsp/basebandsamplesink.h"
|
||||||
|
#include "dsp/misc.h"
|
||||||
#include "ssbmodsource.h"
|
#include "ssbmodsource.h"
|
||||||
|
|
||||||
const int SSBModSource::m_ssbFftLen = 1024;
|
const int SSBModSource::m_ssbFftLen = 1024;
|
||||||
@ -63,8 +64,8 @@ SSBModSource::SSBModSource() :
|
|||||||
|
|
||||||
m_audioCompressor.initSimple(
|
m_audioCompressor.initSimple(
|
||||||
m_audioSampleRate,
|
m_audioSampleRate,
|
||||||
50, // pregain (dB)
|
-10, // pregain (dB) -3
|
||||||
-30, // threshold (dB)
|
-60, // threshold (dB) -50
|
||||||
20, // knee (dB)
|
20, // knee (dB)
|
||||||
12, // ratio (dB)
|
12, // ratio (dB)
|
||||||
0.003, // attack (s)
|
0.003, // attack (s)
|
||||||
@ -162,7 +163,6 @@ void SSBModSource::modulateSample()
|
|||||||
}
|
}
|
||||||
|
|
||||||
calculateLevel(m_modSample);
|
calculateLevel(m_modSample);
|
||||||
m_audioBufferFill++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SSBModSource::pullAF(Complex& sample)
|
void SSBModSource::pullAF(Complex& sample)
|
||||||
@ -246,8 +246,7 @@ void SSBModSource::pullAF(Complex& sample)
|
|||||||
|
|
||||||
if (m_settings.m_agc)
|
if (m_settings.m_agc)
|
||||||
{
|
{
|
||||||
real = m_audioCompressor.compress(real);
|
ci.real(clamp<float>(m_audioCompressor.compress(real), -1.0f, 1.0f));
|
||||||
ci.real(real);
|
|
||||||
ci.imag(0.0f);
|
ci.imag(0.0f);
|
||||||
ci *= m_settings.m_volumeFactor;
|
ci *= m_settings.m_volumeFactor;
|
||||||
}
|
}
|
||||||
@ -283,8 +282,8 @@ void SSBModSource::pullAF(Complex& sample)
|
|||||||
{
|
{
|
||||||
if (m_settings.m_agc)
|
if (m_settings.m_agc)
|
||||||
{
|
{
|
||||||
ci.real(((m_audioBuffer[m_audioBufferFill].l + m_audioBuffer[m_audioBufferFill].r) / 65536.0f));
|
float sample = (m_audioBuffer[m_audioBufferFill].l + m_audioBuffer[m_audioBufferFill].r) / 65536.0f;
|
||||||
ci.real(m_audioCompressor.compress(ci.real()));
|
ci.real(clamp<float>(m_audioCompressor.compress(sample), -1.0f, 1.0f));
|
||||||
ci.imag(0.0f);
|
ci.imag(0.0f);
|
||||||
ci *= m_settings.m_volumeFactor;
|
ci *= m_settings.m_volumeFactor;
|
||||||
}
|
}
|
||||||
@ -295,6 +294,16 @@ void SSBModSource::pullAF(Complex& sample)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_audioBufferFill < m_audioBuffer.size() - 1)
|
||||||
|
{
|
||||||
|
m_audioBufferFill++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qDebug("SSBModSource::pullAF: starve audio samples: size: %lu", m_audioBuffer.size());
|
||||||
|
m_audioBufferFill = m_audioBuffer.size() - 1;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case SSBModSettings::SSBModInputCWTone:
|
case SSBModSettings::SSBModInputCWTone:
|
||||||
Real fadeFactor;
|
Real fadeFactor;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user