1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-18 22:31:48 -05:00

SDRdaemon plugin: changed sample buffer to raw format (uint8_t)

This commit is contained in:
f4exb 2016-01-26 08:27:45 +01:00
parent fd8c9c41eb
commit 458767aa45
2 changed files with 28 additions and 10 deletions

View File

@ -31,7 +31,11 @@ SDRdaemonBuffer::SDRdaemonBuffer(std::size_t blockSize) :
m_nbDecodes(0), m_nbDecodes(0),
m_nbSuccessfulDecodes(0), m_nbSuccessfulDecodes(0),
m_nbCRCOK(0), m_nbCRCOK(0),
m_dataCRC(0) m_dataCRC(0),
m_sampleRate(1000000),
m_sampleBytes(2),
m_sampleBits(12),
m_rawBuffer(0)
{ {
m_buf = new uint8_t[blockSize]; m_buf = new uint8_t[blockSize];
m_currentMeta.init(); m_currentMeta.init();
@ -39,6 +43,10 @@ SDRdaemonBuffer::SDRdaemonBuffer(std::size_t blockSize) :
SDRdaemonBuffer::~SDRdaemonBuffer() SDRdaemonBuffer::~SDRdaemonBuffer()
{ {
if (m_rawBuffer) {
delete[] m_rawBuffer;
}
delete[] m_buf; delete[] m_buf;
} }
@ -210,6 +218,14 @@ void SDRdaemonBuffer::updateSizes(MetaData *metaData)
m_lz4InCount = 0; m_lz4InCount = 0;
} }
void SDRdaemonBuffer::updateBufferSize()
{
if (m_rawBuffer) {
delete[] m_rawBuffer;
}
m_rawBuffer = new uint8_t[m_sampleRate * 2 * m_sampleBytes]; // store 1 second of samples
}
void SDRdaemonBuffer::printMeta(MetaData *metaData) void SDRdaemonBuffer::printMeta(MetaData *metaData)
{ {
@ -227,6 +243,3 @@ void SDRdaemonBuffer::printMeta(MetaData *metaData)
<< std::endl; << std::endl;
} }

View File

@ -69,6 +69,7 @@ public:
private: private:
bool writeAndReadLZ4(uint8_t *array, std::size_t length, uint8_t *data, std::size_t& dataLength); bool writeAndReadLZ4(uint8_t *array, std::size_t length, uint8_t *data, std::size_t& dataLength);
void updateSizes(MetaData *metaData); void updateSizes(MetaData *metaData);
void updateBufferSize();
void printMeta(MetaData *metaData); void printMeta(MetaData *metaData);
std::size_t m_blockSize; //!< UDP block (payload) size std::size_t m_blockSize; //!< UDP block (payload) size
@ -88,7 +89,11 @@ private:
uint32_t m_nbCRCOK; uint32_t m_nbCRCOK;
uint64_t m_dataCRC; uint64_t m_dataCRC;
SampleVector m_convertBuffer; uint32_t m_sampleRate; //!< Current sample rate in Hz
uint8_t m_sampleBytes; //!< Current number of bytes per I or Q sample
uint8_t m_sampleBits; //!< Current number of effective bits per sample
uint8_t *m_rawBuffer; //!< Buffer for raw samples obtained from UDP (I/Q not in a formal I/Q structure)
}; };