mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-23 08:28:36 -05:00
BFM demod: working stereo decode. Mono/Stereo controls not implemented
This commit is contained in:
parent
cd31cc6c0e
commit
83423e13e0
@ -73,7 +73,7 @@ void BFMDemod::configure(MessageQueue* messageQueue, Real rfBandwidth, Real afBa
|
|||||||
|
|
||||||
void BFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool firstOfBurst)
|
void BFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool firstOfBurst)
|
||||||
{
|
{
|
||||||
Complex ci;
|
Complex ci, cs;
|
||||||
fftfilt::cmplx *rf;
|
fftfilt::cmplx *rf;
|
||||||
int rf_out;
|
int rf_out;
|
||||||
Real msq, demod;
|
Real msq, demod;
|
||||||
@ -124,14 +124,24 @@ void BFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
|
|||||||
m_pilotPLL.process(demod, pilotSample);
|
m_pilotPLL.process(demod, pilotSample);
|
||||||
m_sampleBuffer.push_back(Sample(demod * (1<<15), 0.0));
|
m_sampleBuffer.push_back(Sample(demod * (1<<15), 0.0));
|
||||||
//m_sampleBuffer.push_back(Sample(pilotSample * (1<<15), 0.0)); // debug pilot
|
//m_sampleBuffer.push_back(Sample(pilotSample * (1<<15), 0.0)); // debug pilot
|
||||||
|
|
||||||
|
Complex s(demod*2.0*pilotSample, 0);
|
||||||
|
quint16 sampleStereo;
|
||||||
|
|
||||||
|
if (m_interpolatorStereo.interpolate(&m_interpolatorStereoDistanceRemain, s, &cs))
|
||||||
|
{
|
||||||
|
sampleStereo = (qint16)(cs.real() * 3000 * m_running.m_volume);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Complex e(demod, 0);
|
Complex e(demod, 0);
|
||||||
|
|
||||||
if(m_interpolator.interpolate(&m_interpolatorDistanceRemain, e, &ci))
|
if(m_interpolator.interpolate(&m_interpolatorDistanceRemain, e, &ci))
|
||||||
{
|
{
|
||||||
quint16 sample = (qint16)(ci.real() * 3000 * m_running.m_volume);
|
quint16 sample = (qint16)(ci.real() * 3000 * m_running.m_volume);
|
||||||
//m_sampleBuffer.push_back(Sample(sample, sample));
|
//m_sampleBuffer.push_back(Sample(sample, sample));
|
||||||
m_audioBuffer[m_audioBufferFill].l = sample;
|
m_audioBuffer[m_audioBufferFill].l = sample + sampleStereo;
|
||||||
m_audioBuffer[m_audioBufferFill].r = sample;
|
m_audioBuffer[m_audioBufferFill].r = sample - sampleStereo;
|
||||||
++m_audioBufferFill;
|
++m_audioBufferFill;
|
||||||
|
|
||||||
if(m_audioBufferFill >= m_audioBuffer.size())
|
if(m_audioBufferFill >= m_audioBuffer.size())
|
||||||
@ -255,6 +265,9 @@ void BFMDemod::apply()
|
|||||||
m_interpolator.create(16, m_config.m_inputSampleRate, m_config.m_afBandwidth);
|
m_interpolator.create(16, m_config.m_inputSampleRate, m_config.m_afBandwidth);
|
||||||
m_interpolatorDistanceRemain = (Real) m_config.m_inputSampleRate / m_config.m_audioSampleRate;
|
m_interpolatorDistanceRemain = (Real) m_config.m_inputSampleRate / m_config.m_audioSampleRate;
|
||||||
m_interpolatorDistance = (Real) m_config.m_inputSampleRate / (Real) m_config.m_audioSampleRate;
|
m_interpolatorDistance = (Real) m_config.m_inputSampleRate / (Real) m_config.m_audioSampleRate;
|
||||||
|
m_interpolatorStereo.create(16, m_config.m_inputSampleRate, m_config.m_afBandwidth);
|
||||||
|
m_interpolatorStereoDistanceRemain = (Real) m_config.m_inputSampleRate / m_config.m_audioSampleRate;
|
||||||
|
m_interpolatorStereoDistance = (Real) m_config.m_inputSampleRate / (Real) m_config.m_audioSampleRate;
|
||||||
m_settingsMutex.unlock();
|
m_settingsMutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,6 +117,9 @@ private:
|
|||||||
Interpolator m_interpolator; //!< Interpolator between fixed demod bandwidth and audio bandwidth (rational)
|
Interpolator m_interpolator; //!< Interpolator between fixed demod bandwidth and audio bandwidth (rational)
|
||||||
Real m_interpolatorDistance;
|
Real m_interpolatorDistance;
|
||||||
Real m_interpolatorDistanceRemain;
|
Real m_interpolatorDistanceRemain;
|
||||||
|
Interpolator m_interpolatorStereo; //!< Twin Interpolator for stereo subcarrier
|
||||||
|
Real m_interpolatorStereoDistance;
|
||||||
|
Real m_interpolatorStereoDistanceRemain;
|
||||||
Lowpass<Real> m_lowpass;
|
Lowpass<Real> m_lowpass;
|
||||||
fftfilt* m_rfFilter;
|
fftfilt* m_rfFilter;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user