mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 09:48:45 -05:00
Corrected number of audio samples pulled considering interpolation
This commit is contained in:
parent
e02ac85e50
commit
437891da43
@ -121,7 +121,6 @@ void AMMod::pull(Sample& sample)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_audioBufferFill++;
|
|
||||||
m_interpolatorDistanceRemain += m_interpolatorDistance;
|
m_interpolatorDistanceRemain += m_interpolatorDistance;
|
||||||
|
|
||||||
ci *= m_carrierNco.nextIQ(); // shift to carrier frequency
|
ci *= m_carrierNco.nextIQ(); // shift to carrier frequency
|
||||||
@ -140,13 +139,14 @@ void AMMod::pull(Sample& sample)
|
|||||||
void AMMod::pullAudio(int nbSamples)
|
void AMMod::pullAudio(int nbSamples)
|
||||||
{
|
{
|
||||||
// qDebug("AMMod::pullAudio: %d", nbSamples);
|
// qDebug("AMMod::pullAudio: %d", nbSamples);
|
||||||
|
int nbAudioSamples = nbSamples * m_interpolatorDistance;
|
||||||
|
|
||||||
if (nbSamples > m_audioBuffer.size())
|
if (nbAudioSamples > m_audioBuffer.size())
|
||||||
{
|
{
|
||||||
m_audioBuffer.resize(nbSamples);
|
m_audioBuffer.resize(nbAudioSamples);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_audioFifo.read(reinterpret_cast<quint8*>(&m_audioBuffer[0]), nbSamples*sizeof(AudioSample), 10);
|
m_audioFifo.read(reinterpret_cast<quint8*>(&m_audioBuffer[0]), nbAudioSamples*sizeof(AudioSample), 10);
|
||||||
m_audioBufferFill = 0;
|
m_audioBufferFill = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,6 +156,7 @@ void AMMod::modulateSample()
|
|||||||
|
|
||||||
pullAF(t);
|
pullAF(t);
|
||||||
calculateLevel(t);
|
calculateLevel(t);
|
||||||
|
m_audioBufferFill++;
|
||||||
|
|
||||||
m_modSample.real((t*m_running.m_modFactor + 1.0f) * 16384.0f); // modulate and scale zero frequency carrier
|
m_modSample.real((t*m_running.m_modFactor + 1.0f) * 16384.0f); // modulate and scale zero frequency carrier
|
||||||
m_modSample.imag(0.0f);
|
m_modSample.imag(0.0f);
|
||||||
|
@ -136,7 +136,6 @@ void NFMMod::pull(Sample& sample)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_audioBufferFill++;
|
|
||||||
m_interpolatorDistanceRemain += m_interpolatorDistance;
|
m_interpolatorDistanceRemain += m_interpolatorDistance;
|
||||||
|
|
||||||
ci *= m_carrierNco.nextIQ(); // shift to carrier frequency
|
ci *= m_carrierNco.nextIQ(); // shift to carrier frequency
|
||||||
@ -154,12 +153,14 @@ void NFMMod::pull(Sample& sample)
|
|||||||
|
|
||||||
void NFMMod::pullAudio(int nbSamples)
|
void NFMMod::pullAudio(int nbSamples)
|
||||||
{
|
{
|
||||||
if (nbSamples > m_audioBuffer.size())
|
int nbSamplesAudio = nbSamples * m_interpolatorDistance;
|
||||||
|
|
||||||
|
if (nbSamplesAudio > m_audioBuffer.size())
|
||||||
{
|
{
|
||||||
m_audioBuffer.resize(nbSamples);
|
m_audioBuffer.resize(nbSamplesAudio);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_audioFifo.read(reinterpret_cast<quint8*>(&m_audioBuffer[0]), nbSamples*sizeof(AudioSample), 10);
|
m_audioFifo.read(reinterpret_cast<quint8*>(&m_audioBuffer[0]), nbSamplesAudio*sizeof(AudioSample), 10);
|
||||||
m_audioBufferFill = 0;
|
m_audioBufferFill = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,6 +170,7 @@ void NFMMod::modulateSample()
|
|||||||
|
|
||||||
pullAF(t);
|
pullAF(t);
|
||||||
calculateLevel(t);
|
calculateLevel(t);
|
||||||
|
m_audioBufferFill++;
|
||||||
|
|
||||||
if (m_running.m_ctcssOn)
|
if (m_running.m_ctcssOn)
|
||||||
{
|
{
|
||||||
|
@ -166,7 +166,6 @@ void SSBMod::pull(Sample& sample)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_audioBufferFill++;
|
|
||||||
m_interpolatorDistanceRemain += m_interpolatorDistance;
|
m_interpolatorDistanceRemain += m_interpolatorDistance;
|
||||||
|
|
||||||
ci *= m_carrierNco.nextIQ(); // shift to carrier frequency
|
ci *= m_carrierNco.nextIQ(); // shift to carrier frequency
|
||||||
@ -185,12 +184,14 @@ void SSBMod::pull(Sample& sample)
|
|||||||
|
|
||||||
void SSBMod::pullAudio(int nbSamples)
|
void SSBMod::pullAudio(int nbSamples)
|
||||||
{
|
{
|
||||||
if (nbSamples > m_audioBuffer.size())
|
int nbSamplesAudio = nbSamples * m_interpolatorDistance;
|
||||||
|
|
||||||
|
if (nbSamplesAudio > m_audioBuffer.size())
|
||||||
{
|
{
|
||||||
m_audioBuffer.resize(nbSamples);
|
m_audioBuffer.resize(nbSamplesAudio);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_audioFifo.read(reinterpret_cast<quint8*>(&m_audioBuffer[0]), nbSamples*sizeof(AudioSample), 10);
|
m_audioFifo.read(reinterpret_cast<quint8*>(&m_audioBuffer[0]), nbSamplesAudio*sizeof(AudioSample), 10);
|
||||||
m_audioBufferFill = 0;
|
m_audioBufferFill = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,6 +199,7 @@ void SSBMod::modulateSample()
|
|||||||
{
|
{
|
||||||
pullAF(m_modSample);
|
pullAF(m_modSample);
|
||||||
calculateLevel(m_modSample);
|
calculateLevel(m_modSample);
|
||||||
|
m_audioBufferFill++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SSBMod::pullAF(Complex& sample)
|
void SSBMod::pullAF(Complex& sample)
|
||||||
|
@ -119,7 +119,6 @@ void WFMMod::pull(Sample& sample)
|
|||||||
m_audioBufferFill++;
|
m_audioBufferFill++;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_audioBufferFill++;
|
|
||||||
m_interpolatorDistanceRemain += m_interpolatorDistance;
|
m_interpolatorDistanceRemain += m_interpolatorDistance;
|
||||||
|
|
||||||
m_modPhasor += (m_running.m_fmDeviation / (float) m_running.m_outputSampleRate) * ri.real() * M_PI;
|
m_modPhasor += (m_running.m_fmDeviation / (float) m_running.m_outputSampleRate) * ri.real() * M_PI;
|
||||||
@ -143,12 +142,14 @@ void WFMMod::pull(Sample& sample)
|
|||||||
|
|
||||||
void WFMMod::pullAudio(int nbSamples)
|
void WFMMod::pullAudio(int nbSamples)
|
||||||
{
|
{
|
||||||
if (nbSamples > m_audioBuffer.size())
|
int nbSamplesAudio = nbSamples * m_interpolatorDistance;
|
||||||
|
|
||||||
|
if (nbSamplesAudio > m_audioBuffer.size())
|
||||||
{
|
{
|
||||||
m_audioBuffer.resize(nbSamples);
|
m_audioBuffer.resize(nbSamplesAudio);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_audioFifo.read(reinterpret_cast<quint8*>(&m_audioBuffer[0]), nbSamples*sizeof(AudioSample), 10);
|
m_audioFifo.read(reinterpret_cast<quint8*>(&m_audioBuffer[0]), nbSamplesAudio*sizeof(AudioSample), 10);
|
||||||
m_audioBufferFill = 0;
|
m_audioBufferFill = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user