1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-17 23:28:50 -05:00

LimeSDR: use constant instead of define for buffer size

This commit is contained in:
f4exb 2020-04-09 06:45:12 +02:00
parent f528347fd5
commit 03d39f8483
5 changed files with 14 additions and 14 deletions

View File

@ -62,6 +62,8 @@ public:
/** Set clock source and external clock frequency if required */
static bool setClockSource(lms_device_t *device, bool extClock, uint32_t extClockFrequency);
static const unsigned int blockSize = (1<<15);
private:
static bool findSerial(const char *lmsInfoStr, std::string& serial);
};

View File

@ -30,7 +30,7 @@ LimeSDROutputThread::LimeSDROutputThread(lms_stream_t* stream, SampleSourceFifo*
m_sampleFifo(sampleFifo),
m_log2Interp(0)
{
std::fill(m_buf, m_buf + 2*LIMESDROUTPUT_BLOCKSIZE, 0);
std::fill(m_buf, m_buf + 2*DeviceLimeSDR::blockSize, 0);
}
LimeSDROutputThread::~LimeSDROutputThread()
@ -89,18 +89,18 @@ void LimeSDROutputThread::run()
while (m_running)
{
callback(m_buf, LIMESDROUTPUT_BLOCKSIZE);
callback(m_buf, DeviceLimeSDR::blockSize);
res = LMS_SendStream(m_stream, (void *) m_buf, LIMESDROUTPUT_BLOCKSIZE, &metadata, 1000000);
res = LMS_SendStream(m_stream, (void *) m_buf, DeviceLimeSDR::blockSize, &metadata, 1000000);
if (res < 0)
{
qCritical("LimeSDROutputThread::run write error: %s", strerror(errno));
break;
}
else if (res != LIMESDROUTPUT_BLOCKSIZE)
else if (res != DeviceLimeSDR::blockSize)
{
qDebug("LimeSDROutputThread::run written %d/%d samples", res, LIMESDROUTPUT_BLOCKSIZE);
qDebug("LimeSDROutputThread::run written %d/%d samples", res, DeviceLimeSDR::blockSize);
}
}

View File

@ -26,8 +26,7 @@
#include "dsp/interpolators.h"
#include "limesdr/devicelimesdrshared.h"
#define LIMESDROUTPUT_BLOCKSIZE (1<<15) //complex samples per buffer ~10k (16k)
#include "limesdr/devicelimesdr.h"
class SampleSourceFifo;
@ -51,7 +50,7 @@ private:
bool m_running;
lms_stream_t* m_stream;
qint16 m_buf[2*LIMESDROUTPUT_BLOCKSIZE]; //must hold I+Q values of each sample hence 2xcomplex size
qint16 m_buf[2*DeviceLimeSDR::blockSize]; //must hold I+Q values of each sample hence 2xcomplex size
SampleSourceFifo* m_sampleFifo;
unsigned int m_log2Interp; // soft decimation

View File

@ -25,11 +25,11 @@ LimeSDRInputThread::LimeSDRInputThread(lms_stream_t* stream, SampleSinkFifo* sam
QThread(parent),
m_running(false),
m_stream(stream),
m_convertBuffer(LIMESDR_BLOCKSIZE),
m_convertBuffer(DeviceLimeSDR::blockSize),
m_sampleFifo(sampleFifo),
m_log2Decim(0)
{
std::fill(m_buf, m_buf + 2*LIMESDR_BLOCKSIZE, 0);
std::fill(m_buf, m_buf + 2*DeviceLimeSDR::blockSize, 0);
}
LimeSDRInputThread::~LimeSDRInputThread()
@ -88,7 +88,7 @@ void LimeSDRInputThread::run()
while (m_running)
{
if ((res = LMS_RecvStream(m_stream, (void *) m_buf, LIMESDR_BLOCKSIZE, &metadata, 1000)) < 0)
if ((res = LMS_RecvStream(m_stream, (void *) m_buf, DeviceLimeSDR::blockSize, &metadata, 1000)) < 0)
{
qCritical("LimeSDRInputThread::run read error: %s", strerror(errno));
break;

View File

@ -27,8 +27,7 @@
#include "dsp/samplesinkfifo.h"
#include "dsp/decimators.h"
#include "limesdr/devicelimesdrshared.h"
#define LIMESDR_BLOCKSIZE (1<<15) //complex samples per buffer
#include "limesdr/devicelimesdr.h"
class LimeSDRInputThread : public QThread, public DeviceLimeSDRShared::ThreadInterface
{
@ -50,7 +49,7 @@ private:
bool m_running;
lms_stream_t* m_stream;
qint16 m_buf[2*LIMESDR_BLOCKSIZE]; //must hold I+Q values of each sample hence 2xcomplex size
qint16 m_buf[2*DeviceLimeSDR::blockSize]; //must hold I+Q values of each sample hence 2xcomplex size
SampleVector m_convertBuffer;
SampleSinkFifo* m_sampleFifo;