mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-01 13:47:01 -04:00
SampleSourceFifo refactoring and Tx code reorganization
This commit is contained in:
@@ -20,9 +20,9 @@
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "dsp/samplesourcefifodb.h"
|
||||
#include "dsp/samplesourcefifo.h"
|
||||
|
||||
HackRFOutputThread::HackRFOutputThread(hackrf_device* dev, SampleSourceFifoDB* sampleFifo, QObject* parent) :
|
||||
HackRFOutputThread::HackRFOutputThread(hackrf_device* dev, SampleSourceFifo* sampleFifo, QObject* parent) :
|
||||
QThread(parent),
|
||||
m_running(false),
|
||||
m_dev(dev),
|
||||
@@ -118,9 +118,25 @@ void HackRFOutputThread::run()
|
||||
// Interpolate according to specified log2 (ex: log2=4 => interp=16)
|
||||
void HackRFOutputThread::callback(qint8* buf, qint32 len)
|
||||
{
|
||||
SampleVector::iterator beginRead;
|
||||
m_sampleFifo->readAdvance(beginRead, len/(2*(1<<m_log2Interp)));
|
||||
beginRead -= len/(2*(1<<m_log2Interp));
|
||||
SampleVector& data = m_sampleFifo->getData();
|
||||
unsigned int iPart1Begin, iPart1End, iPart2Begin, iPart2End;
|
||||
m_sampleFifo->read(len/(2*(1<<m_log2Interp)), iPart1Begin, iPart1End, iPart2Begin, iPart2End);
|
||||
|
||||
if (iPart1Begin != iPart1End) {
|
||||
callbackPart(buf, data, iPart1Begin, iPart1End);
|
||||
}
|
||||
|
||||
unsigned int shift = (iPart1End - iPart1Begin)*(1<<m_log2Interp);
|
||||
|
||||
if (iPart2Begin != iPart2End) {
|
||||
callbackPart(buf + 2*shift, data, iPart2Begin, iPart2End);
|
||||
}
|
||||
}
|
||||
|
||||
void HackRFOutputThread::callbackPart(qint8* buf, SampleVector& data, unsigned int iBegin, unsigned int iEnd)
|
||||
{
|
||||
SampleVector::iterator beginRead = data.begin() + iBegin;
|
||||
int len = 2*(iEnd - iBegin)*(1<<m_log2Interp);
|
||||
|
||||
if (m_log2Interp == 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user