mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-25 17:28:50 -05:00
Simple WideFM demod.
This commit is contained in:
parent
1e8b20412c
commit
6de854e8d6
@ -53,13 +53,16 @@ void WFMDemod::feed(SampleVector::const_iterator begin, SampleVector::const_iter
|
|||||||
qint16 sample;
|
qint16 sample;
|
||||||
|
|
||||||
for(SampleVector::const_iterator it = begin; it < end; ++it) {
|
for(SampleVector::const_iterator it = begin; it < end; ++it) {
|
||||||
Complex c(it->real(), it->imag());
|
Real a = (0.005) * m_this.real() * (m_last.imag() - it->imag());
|
||||||
Complex d = c * conj(m_lastSample);
|
Real b = (0.005) * m_this.imag() * (m_last.real() - it->real());
|
||||||
m_lastSample = c;
|
m_last = m_this;
|
||||||
Complex e(atan2(d.imag(), d.real()), 0);
|
m_this = Complex(it->real(), it->imag());
|
||||||
|
Complex e(b - a, 0);
|
||||||
|
Complex c;
|
||||||
|
|
||||||
if(m_interpolator.interpolate(&m_sampleDistanceRemain, e, &c)) {
|
if(m_interpolator.interpolate(&m_sampleDistanceRemain, e, &c)) {
|
||||||
sample = (qint16)(c.real() * m_volume * 800.0);
|
// TODO: Volume is a function of bandwidth
|
||||||
|
sample = (qint16)(c.real() * m_volume * 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;
|
||||||
m_audioBuffer[m_audioBufferFill].r = sample;
|
m_audioBuffer[m_audioBufferFill].r = sample;
|
||||||
|
@ -75,7 +75,7 @@ private:
|
|||||||
|
|
||||||
Interpolator m_interpolator;
|
Interpolator m_interpolator;
|
||||||
Real m_sampleDistanceRemain;
|
Real m_sampleDistanceRemain;
|
||||||
Complex m_lastSample;
|
Complex m_last, m_this;
|
||||||
|
|
||||||
AudioVector m_audioBuffer;
|
AudioVector m_audioBuffer;
|
||||||
uint m_audioBufferFill;
|
uint m_audioBufferFill;
|
||||||
|
Loading…
Reference in New Issue
Block a user