mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-03-23 20:58:42 -04:00
Correctness.
This commit is contained in:
parent
0203283876
commit
cb8026b957
@ -40,6 +40,7 @@ SSBDemod::SSBDemod(AudioFifo* audioFifo, SampleSink* sampleSink) :
|
||||
|
||||
m_audioBuffer.resize(512);
|
||||
m_audioBufferFill = 0;
|
||||
m_undersampleCount = 0;
|
||||
}
|
||||
|
||||
SSBDemod::~SSBDemod()
|
||||
@ -52,7 +53,6 @@ void SSBDemod::configure(MessageQueue* messageQueue, Real Bandwidth, Real volume
|
||||
cmd->submit(messageQueue, this);
|
||||
}
|
||||
|
||||
int undersamplecount = 0;
|
||||
void SSBDemod::feed(SampleVector::const_iterator begin, SampleVector::const_iterator end, bool positiveOnly)
|
||||
{
|
||||
Complex ci;
|
||||
@ -69,7 +69,7 @@ void SSBDemod::feed(SampleVector::const_iterator begin, SampleVector::const_iter
|
||||
demod = 32768.0 * m_lowpass.filter(demod * 0.7);
|
||||
|
||||
// Downsample by 4x for audio display
|
||||
if (!(undersamplecount++ & 3))
|
||||
if (!(m_undersampleCount++ & 3))
|
||||
m_sampleBuffer.push_back(Sample(demod, 0.0));
|
||||
|
||||
qint16 sample = (qint16)(demod * m_volume);
|
||||
|
@ -72,6 +72,7 @@ private:
|
||||
|
||||
Real m_Bandwidth;
|
||||
Real m_volume;
|
||||
int m_undersampleCount;
|
||||
int m_sampleRate;
|
||||
int m_frequency;
|
||||
|
||||
|
@ -30,6 +30,7 @@ RTLSDRThread::RTLSDRThread(rtlsdr_dev_t* dev, SampleFifo* sampleFifo, QObject* p
|
||||
m_sampleFifo(sampleFifo),
|
||||
m_decimation(2)
|
||||
{
|
||||
m_localdecimation = 0;
|
||||
}
|
||||
|
||||
RTLSDRThread::~RTLSDRThread()
|
||||
@ -135,15 +136,14 @@ void RTLSDRThread::decimate16(SampleVector::iterator* it, const quint8* buf, qin
|
||||
}
|
||||
}
|
||||
|
||||
int localdecimation = 0;
|
||||
void RTLSDRThread::callback(const quint8* buf, qint32 len)
|
||||
{
|
||||
qint16 xreal, yimag, phase;
|
||||
SampleVector::iterator it = m_convertBuffer.begin();
|
||||
int decimationFactor[] = {16, 8, 4, 2, 1, 0};
|
||||
|
||||
if (++localdecimation < decimationFactor[m_decimation]) return;
|
||||
localdecimation = 0;
|
||||
if (++m_localdecimation < decimationFactor[m_decimation]) return;
|
||||
m_localdecimation = 0;
|
||||
|
||||
switch(m_decimation) {
|
||||
case 0: // 1:1 = no decimation
|
||||
|
@ -47,6 +47,7 @@ private:
|
||||
SampleFifo* m_sampleFifo;
|
||||
|
||||
int m_decimation;
|
||||
int m_localdecimation;
|
||||
|
||||
void run();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user