Renamed SampleSourceFifo to SampleSourceFifoDB to mark double buffered nature of FIFO

pull/442/head
f4exb 2019-11-02 00:50:00 +01:00
rodzic 5bc6b7e702
commit e6a929470f
38 zmienionych plików z 116 dodań i 116 usunięć

Wyświetl plik

@ -14431,7 +14431,7 @@
"height": 13,
"autoResize": false,
"underline": false,
"text": "SampleSourceFifo",
"text": "SampleSourceFifoDB",
"horizontalAlignment": 2,
"verticalAlignment": 5
},
@ -29096,7 +29096,7 @@
"height": 13,
"autoResize": false,
"underline": false,
"text": "Lifeline2: SampleSourceFifo",
"text": "Lifeline2: SampleSourceFifoDB",
"horizontalAlignment": 2,
"verticalAlignment": 5
},
@ -31908,7 +31908,7 @@
"_parent": {
"$ref": "AAAAAAFQXc4WXZjpioY="
},
"name": "SampleSourceFifo",
"name": "SampleSourceFifoDB",
"visibility": "public",
"operations": [
{

Wyświetl plik

@ -172,7 +172,7 @@ private:
LocalSourceSettings m_settings;
LocalSourceThread *m_sinkThread;
SampleSourceFifo *m_localSampleSourceFifo;
SampleSourceFifoDB *m_localSampleSourceFifo;
int m_chunkSize;
SampleVector m_localSamples;
int m_localSamplesIndex;

Wyświetl plik

@ -15,7 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include "dsp/samplesourcefifo.h"
#include "dsp/samplesourcefifodb.h"
#include "localsourcethread.h"
@ -40,7 +40,7 @@ void LocalSourceThread::startStop(bool start)
m_inputMessageQueue.push(msg);
}
void LocalSourceThread::setSampleFifo(SampleSourceFifo *sampleFifo)
void LocalSourceThread::setSampleFifo(SampleSourceFifoDB *sampleFifo)
{
m_sampleFifo = sampleFifo;
}

Wyświetl plik

@ -26,7 +26,7 @@
#include "util/message.h"
#include "util/messagequeue.h"
class SampleSourceFifo;
class SampleSourceFifoDB;
class LocalSourceThread : public QThread {
Q_OBJECT
@ -55,7 +55,7 @@ public:
~LocalSourceThread();
void startStop(bool start);
void setSampleFifo(SampleSourceFifo *sampleFifo);
void setSampleFifo(SampleSourceFifoDB *sampleFifo);
public slots:
void pullSamples(unsigned int count);
@ -67,7 +67,7 @@ private:
QMutex m_startWaitMutex;
QWaitCondition m_startWaiter;
volatile bool m_running;
SampleSourceFifo *m_sampleFifo;
SampleSourceFifoDB *m_sampleFifo;
MessageQueue m_inputMessageQueue;

Wyświetl plik

@ -23,7 +23,7 @@
Bladerf1OutputThread::Bladerf1OutputThread(struct bladerf* dev, SampleSourceFifo* sampleFifo, QObject* parent) :
Bladerf1OutputThread::Bladerf1OutputThread(struct bladerf* dev, SampleSourceFifoDB* sampleFifo, QObject* parent) :
QThread(parent),
m_running(false),
m_dev(dev),

Wyświetl plik

@ -22,7 +22,7 @@
#include <QMutex>
#include <QWaitCondition>
#include <libbladeRF.h>
#include "dsp/samplesourcefifo.h"
#include "dsp/samplesourcefifodb.h"
#include "dsp/interpolators.h"
#define BLADERFOUTPUT_BLOCKSIZE (1<<16)
@ -31,7 +31,7 @@ class Bladerf1OutputThread : public QThread {
Q_OBJECT
public:
Bladerf1OutputThread(struct bladerf* dev, SampleSourceFifo* sampleFifo, QObject* parent = NULL);
Bladerf1OutputThread(struct bladerf* dev, SampleSourceFifoDB* sampleFifo, QObject* parent = NULL);
~Bladerf1OutputThread();
void startWork();
@ -46,7 +46,7 @@ private:
struct bladerf* m_dev;
qint16 m_buf[2*BLADERFOUTPUT_BLOCKSIZE];
SampleSourceFifo* m_sampleFifo;
SampleSourceFifoDB* m_sampleFifo;
unsigned int m_log2Interp;

Wyświetl plik

@ -279,7 +279,7 @@ bool BladeRF2Output::start()
{
qDebug("BladeRF2Output::start: expand channels. Re-allocate thread and take ownership");
SampleSourceFifo **fifos = new SampleSourceFifo*[nbOriginalChannels];
SampleSourceFifoDB **fifos = new SampleSourceFifoDB*[nbOriginalChannels];
unsigned int *log2Interps = new unsigned int[nbOriginalChannels];
for (int i = 0; i < nbOriginalChannels; i++) // save original FIFO references and data
@ -407,7 +407,7 @@ void BladeRF2Output::stop()
{
qDebug("BladeRF2Output::stop: MO mode. Reduce by deleting and re-creating the thread");
bladeRF2OutputThread->stopWork();
SampleSourceFifo **fifos = new SampleSourceFifo*[nbOriginalChannels-1];
SampleSourceFifoDB **fifos = new SampleSourceFifoDB*[nbOriginalChannels-1];
unsigned int *log2Interps = new unsigned int[nbOriginalChannels-1];
bool stillActiveFIFO = false;
@ -714,7 +714,7 @@ bool BladeRF2Output::applySettings(const BladeRF2OutputSettings& settings, bool
{
reverseAPIKeys.append("devSampleRate");
BladeRF2OutputThread *bladeRF2OutputThread = findThread();
SampleSourceFifo *fifo = 0;
SampleSourceFifoDB *fifo = 0;
if (bladeRF2OutputThread)
{

Wyświetl plik

@ -17,7 +17,7 @@
#include <algorithm>
#include "dsp/samplesourcefifo.h"
#include "dsp/samplesourcefifodb.h"
#include "bladerf2outputthread.h"
@ -151,14 +151,14 @@ unsigned int BladeRF2OutputThread::getLog2Interpolation(unsigned int channel) co
}
}
void BladeRF2OutputThread::setFifo(unsigned int channel, SampleSourceFifo *sampleFifo)
void BladeRF2OutputThread::setFifo(unsigned int channel, SampleSourceFifoDB *sampleFifo)
{
if (channel < m_nbChannels) {
m_channels[channel].m_sampleFifo = sampleFifo;
}
}
SampleSourceFifo *BladeRF2OutputThread::getFifo(unsigned int channel)
SampleSourceFifoDB *BladeRF2OutputThread::getFifo(unsigned int channel)
{
if (channel < m_nbChannels) {
return m_channels[channel].m_sampleFifo;

Wyświetl plik

@ -26,7 +26,7 @@
#include "bladerf2/devicebladerf2shared.h"
#include "dsp/interpolators.h"
class SampleSourceFifo;
class SampleSourceFifoDB;
class BladeRF2OutputThread : public QThread {
Q_OBJECT
@ -41,13 +41,13 @@ public:
unsigned int getNbChannels() const { return m_nbChannels; }
void setLog2Interpolation(unsigned int channel, unsigned int log2_interp);
unsigned int getLog2Interpolation(unsigned int channel) const;
void setFifo(unsigned int channel, SampleSourceFifo *sampleFifo);
SampleSourceFifo *getFifo(unsigned int channel);
void setFifo(unsigned int channel, SampleSourceFifoDB *sampleFifo);
SampleSourceFifoDB *getFifo(unsigned int channel);
private:
struct Channel
{
SampleSourceFifo* m_sampleFifo;
SampleSourceFifoDB* m_sampleFifo;
unsigned int m_log2Interp;
Interpolators<qint16, SDR_TX_SAMP_SZ, 12> m_interpolators;

Wyświetl plik

@ -21,10 +21,10 @@
#include <algorithm>
#include <QDebug>
#include "dsp/samplesourcefifo.h"
#include "dsp/samplesourcefifodb.h"
#include "filesinkthread.h"
FileSinkThread::FileSinkThread(std::ofstream *samplesStream, SampleSourceFifo* sampleFifo, QObject* parent) :
FileSinkThread::FileSinkThread(std::ofstream *samplesStream, SampleSourceFifoDB* sampleFifo, QObject* parent) :
QThread(parent),
m_running(false),
m_ofstream(samplesStream),

Wyświetl plik

@ -33,13 +33,13 @@
#define FILESINK_THROTTLE_MS 50
class SampleSourceFifo;
class SampleSourceFifoDB;
class FileSinkThread : public QThread {
Q_OBJECT
public:
FileSinkThread(std::ofstream *samplesStream, SampleSourceFifo* sampleFifo, QObject* parent = 0);
FileSinkThread(std::ofstream *samplesStream, SampleSourceFifoDB* sampleFifo, QObject* parent = 0);
~FileSinkThread();
void startWork();
@ -61,7 +61,7 @@ private:
std::ofstream* m_ofstream;
std::size_t m_bufsize;
unsigned int m_samplesChunkSize;
SampleSourceFifo* m_sampleFifo;
SampleSourceFifoDB* m_sampleFifo;
std::size_t m_samplesCount;
int m_samplerate;

Wyświetl plik

@ -20,9 +20,9 @@
#include <stdio.h>
#include <errno.h>
#include "dsp/samplesourcefifo.h"
#include "dsp/samplesourcefifodb.h"
HackRFOutputThread::HackRFOutputThread(hackrf_device* dev, SampleSourceFifo* sampleFifo, QObject* parent) :
HackRFOutputThread::HackRFOutputThread(hackrf_device* dev, SampleSourceFifoDB* sampleFifo, QObject* parent) :
QThread(parent),
m_running(false),
m_dev(dev),

Wyświetl plik

@ -23,7 +23,7 @@
#include <QWaitCondition>
#include <libhackrf/hackrf.h>
#include "dsp/samplesourcefifo.h"
#include "dsp/samplesourcefifodb.h"
#include "dsp/interpolators.h"
#define HACKRF_BLOCKSIZE (1<<17)
@ -32,7 +32,7 @@ class HackRFOutputThread : public QThread {
Q_OBJECT
public:
HackRFOutputThread(hackrf_device* dev, SampleSourceFifo* sampleFifo, QObject* parent = NULL);
HackRFOutputThread(hackrf_device* dev, SampleSourceFifoDB* sampleFifo, QObject* parent = NULL);
~HackRFOutputThread();
void startWork();
@ -47,7 +47,7 @@ private:
hackrf_device* m_dev;
qint8 m_buf[2*HACKRF_BLOCKSIZE];
SampleSourceFifo* m_sampleFifo;
SampleSourceFifoDB* m_sampleFifo;
unsigned int m_log2Interp;
int m_fcPos;

Wyświetl plik

@ -21,7 +21,7 @@
#include "limesdroutputthread.h"
#include "limesdroutputsettings.h"
LimeSDROutputThread::LimeSDROutputThread(lms_stream_t* stream, SampleSourceFifo* sampleFifo, QObject* parent) :
LimeSDROutputThread::LimeSDROutputThread(lms_stream_t* stream, SampleSourceFifoDB* sampleFifo, QObject* parent) :
QThread(parent),
m_running(false),
m_stream(stream),

Wyświetl plik

@ -24,7 +24,7 @@
#include "lime/LimeSuite.h"
#include "dsp/samplesourcefifo.h"
#include "dsp/samplesourcefifodb.h"
#include "dsp/interpolators.h"
#include "limesdr/devicelimesdrshared.h"
@ -35,7 +35,7 @@ class LimeSDROutputThread : public QThread, public DeviceLimeSDRShared::ThreadIn
Q_OBJECT
public:
LimeSDROutputThread(lms_stream_t* stream, SampleSourceFifo* sampleFifo, QObject* parent = 0);
LimeSDROutputThread(lms_stream_t* stream, SampleSourceFifoDB* sampleFifo, QObject* parent = 0);
~LimeSDROutputThread();
virtual void startWork();
@ -51,7 +51,7 @@ private:
lms_stream_t* m_stream;
qint16 m_buf[2*LIMESDROUTPUT_BLOCKSIZE]; //must hold I+Q values of each sample hence 2xcomplex size
SampleSourceFifo* m_sampleFifo;
SampleSourceFifoDB* m_sampleFifo;
unsigned int m_log2Interp; // soft decimation

Wyświetl plik

@ -20,7 +20,7 @@
#include "iio.h"
#include "plutosdroutputthread.h"
PlutoSDROutputThread::PlutoSDROutputThread(uint32_t blocksizeSamples, DevicePlutoSDRBox* plutoBox, SampleSourceFifo* sampleFifo, QObject* parent) :
PlutoSDROutputThread::PlutoSDROutputThread(uint32_t blocksizeSamples, DevicePlutoSDRBox* plutoBox, SampleSourceFifoDB* sampleFifo, QObject* parent) :
QThread(parent),
m_running(false),
m_plutoBox(plutoBox),

Wyświetl plik

@ -22,7 +22,7 @@
#include <QMutex>
#include <QWaitCondition>
#include "dsp/samplesourcefifo.h"
#include "dsp/samplesourcefifodb.h"
#include "dsp/interpolators.h"
#include "plutosdr/deviceplutosdrshared.h"
@ -33,7 +33,7 @@ class PlutoSDROutputThread : public QThread, public DevicePlutoSDRShared::Thread
Q_OBJECT
public:
PlutoSDROutputThread(uint32_t blocksize, DevicePlutoSDRBox* plutoBox, SampleSourceFifo* sampleFifo, QObject* parent = 0);
PlutoSDROutputThread(uint32_t blocksize, DevicePlutoSDRBox* plutoBox, SampleSourceFifoDB* sampleFifo, QObject* parent = 0);
~PlutoSDROutputThread();
virtual void startWork();
@ -51,7 +51,7 @@ private:
int16_t *m_buf; //!< holds I+Q values of each sample from devce
// int16_t *m_bufConv; //!< holds I+Q values of each sample converted to host format via iio_channel_convert
uint32_t m_blockSizeSamples; //!< buffer sizes in number of (I,Q) samples
SampleSourceFifo* m_sampleFifo; //!< DSP sample FIFO (I,Q)
SampleSourceFifoDB* m_sampleFifo; //!< DSP sample FIFO (I,Q)
unsigned int m_log2Interp; // soft interpolation

Wyświetl plik

@ -21,11 +21,11 @@
#include <algorithm>
#include <QDebug>
#include "dsp/samplesourcefifo.h"
#include "dsp/samplesourcefifodb.h"
#include "util/timeutil.h"
#include "remoteoutputthread.h"
RemoteOutputThread::RemoteOutputThread(SampleSourceFifo* sampleFifo, QObject* parent) :
RemoteOutputThread::RemoteOutputThread(SampleSourceFifoDB* sampleFifo, QObject* parent) :
QThread(parent),
m_running(false),
m_samplesChunkSize(0),

Wyświetl plik

@ -36,14 +36,14 @@
#define REMOTEOUTPUT_THROTTLE_MS 50
class SampleSourceFifo;
class SampleSourceFifoDB;
struct timeval;
class RemoteOutputThread : public QThread {
Q_OBJECT
public:
RemoteOutputThread(SampleSourceFifo* sampleFifo, QObject* parent = 0);
RemoteOutputThread(SampleSourceFifoDB* sampleFifo, QObject* parent = 0);
~RemoteOutputThread();
void startWork();
@ -68,7 +68,7 @@ private:
volatile bool m_running;
int m_samplesChunkSize;
SampleSourceFifo* m_sampleFifo;
SampleSourceFifoDB* m_sampleFifo;
uint32_t m_samplesCount;
int m_chunkCorrection;

Wyświetl plik

@ -463,7 +463,7 @@ bool SoapySDROutput::start()
{
qDebug("SoapySDROutput::start: expand channels. Re-allocate thread and take ownership");
SampleSourceFifo **fifos = new SampleSourceFifo*[nbOriginalChannels];
SampleSourceFifoDB **fifos = new SampleSourceFifoDB*[nbOriginalChannels];
unsigned int *log2Interps = new unsigned int[nbOriginalChannels];
for (int i = 0; i < nbOriginalChannels; i++) // save original FIFO references and data
@ -574,7 +574,7 @@ void SoapySDROutput::stop()
{
qDebug("SoapySDROutput::stop: MO mode. Reduce by deleting and re-creating the thread");
soapySDROutputThread->stopWork();
SampleSourceFifo **fifos = new SampleSourceFifo*[nbOriginalChannels-1];
SampleSourceFifoDB **fifos = new SampleSourceFifoDB*[nbOriginalChannels-1];
unsigned int *log2Interps = new unsigned int[nbOriginalChannels-1];
int highestActiveChannelIndex = -1;
@ -871,7 +871,7 @@ bool SoapySDROutput::applySettings(const SoapySDROutputSettings& settings, bool
if ((m_settings.m_devSampleRate != settings.m_devSampleRate) || (m_settings.m_log2Interp != settings.m_log2Interp) || force)
{
SoapySDROutputThread *soapySDROutputThread = findThread();
SampleSourceFifo *fifo = 0;
SampleSourceFifoDB *fifo = 0;
if (soapySDROutputThread)
{

Wyświetl plik

@ -20,7 +20,7 @@
#include <SoapySDR/Formats.hpp>
#include <SoapySDR/Errors.hpp>
#include "dsp/samplesourcefifo.h"
#include "dsp/samplesourcefifodb.h"
#include "soapysdroutputthread.h"
@ -218,14 +218,14 @@ unsigned int SoapySDROutputThread::getLog2Interpolation(unsigned int channel) co
}
}
void SoapySDROutputThread::setFifo(unsigned int channel, SampleSourceFifo *sampleFifo)
void SoapySDROutputThread::setFifo(unsigned int channel, SampleSourceFifoDB *sampleFifo)
{
if (channel < m_nbChannels) {
m_channels[channel].m_sampleFifo = sampleFifo;
}
}
SampleSourceFifo *SoapySDROutputThread::getFifo(unsigned int channel)
SampleSourceFifoDB *SoapySDROutputThread::getFifo(unsigned int channel)
{
if (channel < m_nbChannels) {
return m_channels[channel].m_sampleFifo;

Wyświetl plik

@ -29,7 +29,7 @@
#include "dsp/interpolators.h"
#include "dsp/interpolatorsif.h"
class SampleSourceFifo;
class SampleSourceFifoDB;
class SoapySDROutputThread : public QThread {
Q_OBJECT
@ -46,13 +46,13 @@ public:
unsigned int getLog2Interpolation(unsigned int channel) const;
void setSampleRate(unsigned int sampleRate) { m_sampleRate = sampleRate; }
unsigned int getSampleRate() const { return m_sampleRate; }
void setFifo(unsigned int channel, SampleSourceFifo *sampleFifo);
SampleSourceFifo *getFifo(unsigned int channel);
void setFifo(unsigned int channel, SampleSourceFifoDB *sampleFifo);
SampleSourceFifoDB *getFifo(unsigned int channel);
private:
struct Channel
{
SampleSourceFifo* m_sampleFifo;
SampleSourceFifoDB* m_sampleFifo;
unsigned int m_log2Interp;
Interpolators<qint8, SDR_TX_SAMP_SZ, 8> m_interpolators8;
Interpolators<qint16, SDR_TX_SAMP_SZ, 12> m_interpolators12;

Wyświetl plik

@ -21,11 +21,11 @@
#include <algorithm>
#include <QDebug>
#include "dsp/samplesourcefifo.h"
#include "dsp/samplesourcefifodb.h"
#include "dsp/basebandsamplesink.h"
#include "testsinkthread.h"
TestSinkThread::TestSinkThread(SampleSourceFifo* sampleFifo, QObject* parent) :
TestSinkThread::TestSinkThread(SampleSourceFifoDB* sampleFifo, QObject* parent) :
QThread(parent),
m_running(false),
m_bufsize(0),

Wyświetl plik

@ -34,14 +34,14 @@
#define TESTSINK_THROTTLE_MS 50
class SampleSourceFifo;
class SampleSourceFifoDB;
class BasebandSampleSink;
class TestSinkThread : public QThread {
Q_OBJECT
public:
TestSinkThread(SampleSourceFifo* sampleFifo, QObject* parent = nullptr);
TestSinkThread(SampleSourceFifoDB* sampleFifo, QObject* parent = nullptr);
~TestSinkThread();
void startWork();
@ -70,7 +70,7 @@ private:
std::size_t m_bufsize;
unsigned int m_samplesChunkSize;
SampleSourceFifo* m_sampleFifo;
SampleSourceFifoDB* m_sampleFifo;
std::size_t m_samplesCount;
int m_samplerate;

Wyświetl plik

@ -278,7 +278,7 @@ bool XTRXOutput::start()
{
qDebug("XTRXOutput::start: expand channels. Re-allocate thread and take ownership");
SampleSourceFifo **fifos = new SampleSourceFifo*[2];
SampleSourceFifoDB **fifos = new SampleSourceFifoDB*[2];
unsigned int *log2Interps = new unsigned int[2];
for (int i = 0; i < 2; i++) // save original FIFO references and data

Wyświetl plik

@ -20,7 +20,7 @@
#include <thread>
#include "xtrx/devicextrx.h"
#include "dsp/samplesourcefifo.h"
#include "dsp/samplesourcefifodb.h"
#include "xtrxoutputthread.h"
@ -94,14 +94,14 @@ unsigned int XTRXOutputThread::getLog2Interpolation(unsigned int channel) const
}
}
void XTRXOutputThread::setFifo(unsigned int channel, SampleSourceFifo *sampleFifo)
void XTRXOutputThread::setFifo(unsigned int channel, SampleSourceFifoDB *sampleFifo)
{
if (channel < 2) {
m_channels[channel].m_sampleFifo = sampleFifo;
}
}
SampleSourceFifo *XTRXOutputThread::getFifo(unsigned int channel)
SampleSourceFifoDB *XTRXOutputThread::getFifo(unsigned int channel)
{
if (channel < 2) {
return m_channels[channel].m_sampleFifo;

Wyświetl plik

@ -24,7 +24,7 @@
#include "xtrx_api.h"
#include "dsp/samplesourcefifo.h"
#include "dsp/samplesourcefifodb.h"
#include "dsp/interpolators.h"
#include "xtrx/devicextrxshared.h"
@ -44,13 +44,13 @@ public:
unsigned int getNbChannels() const { return m_nbChannels; }
void setLog2Interpolation(unsigned int channel, unsigned int log2_interp);
unsigned int getLog2Interpolation(unsigned int channel) const;
void setFifo(unsigned int channel, SampleSourceFifo *sampleFifo);
SampleSourceFifo *getFifo(unsigned int channel);
void setFifo(unsigned int channel, SampleSourceFifoDB *sampleFifo);
SampleSourceFifoDB *getFifo(unsigned int channel);
private:
struct Channel
{
SampleSourceFifo* m_sampleFifo;
SampleSourceFifoDB* m_sampleFifo;
unsigned int m_log2Interp;
Interpolators<qint16, SDR_TX_SAMP_SZ, 12> m_interpolators;

Wyświetl plik

@ -101,7 +101,7 @@ set(sdrbase_SOURCES
dsp/samplemififo.cpp
dsp/samplemofifo.cpp
dsp/samplesinkfifo.cpp
dsp/samplesourcefifo.cpp
dsp/samplesourcefifodb.cpp
dsp/basebandsamplesink.cpp
dsp/basebandsamplesource.cpp
dsp/nullsink.cpp
@ -241,7 +241,7 @@ set(sdrbase_HEADERS
dsp/samplemififo.h
dsp/samplemofifo.h
dsp/samplesinkfifo.h
dsp/samplesourcefifo.h
dsp/samplesourcefifodb.h
dsp/basebandsamplesink.h
dsp/basebandsamplesource.h
dsp/nullsink.h

Wyświetl plik

@ -55,7 +55,7 @@ void BasebandSampleSource::handleWriteToDeviceFifo(int nbSamples)
handleWriteToFifo(m_deviceSampleFifo, nbSamples);
}
void BasebandSampleSource::handleWriteToFifo(SampleSourceFifo *sampleFifo, int nbSamples)
void BasebandSampleSource::handleWriteToFifo(SampleSourceFifoDB *sampleFifo, int nbSamples)
{
SampleVector::iterator writeAt;
sampleFifo->getWriteIterator(writeAt);
@ -69,7 +69,7 @@ void BasebandSampleSource::handleWriteToFifo(SampleSourceFifo *sampleFifo, int n
}
void BasebandSampleSource::setDeviceSampleSourceFifo(SampleSourceFifo *deviceSampleFifo)
void BasebandSampleSource::setDeviceSampleSourceFifo(SampleSourceFifoDB *deviceSampleFifo)
{
if (m_deviceSampleFifo != deviceSampleFifo)
{

Wyświetl plik

@ -21,7 +21,7 @@
#include <QObject>
#include "dsp/dsptypes.h"
#include "dsp/samplesourcefifo.h"
#include "dsp/samplesourcefifodb.h"
#include "export.h"
#include "util/messagequeue.h"
@ -39,7 +39,7 @@ public:
virtual void pullAudio(int nbSamples) { (void) nbSamples; }
/** direct feeding of sample source FIFO */
void feed(SampleSourceFifo* sampleFifo, int nbSamples)
void feed(SampleSourceFifoDB* sampleFifo, int nbSamples)
{
SampleVector::iterator writeAt;
sampleFifo->getWriteIterator(writeAt);
@ -52,22 +52,22 @@ public:
}
}
SampleSourceFifo& getSampleSourceFifo() { return m_sampleFifo; }
SampleSourceFifoDB& getSampleSourceFifo() { return m_sampleFifo; }
virtual bool handleMessage(const Message& cmd) = 0; //!< Processing of a message. Returns true if message has actually been processed
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } //!< Get the queue for asynchronous inbound communication
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
MessageQueue *getMessageQueueToGUI() { return m_guiMessageQueue; }
void setDeviceSampleSourceFifo(SampleSourceFifo *deviceSampleFifo);
void setDeviceSampleSourceFifo(SampleSourceFifoDB *deviceSampleFifo);
protected:
MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication
MessageQueue *m_guiMessageQueue; //!< Input message queue to the GUI
SampleSourceFifo m_sampleFifo; //!< Internal FIFO for multi-channel processing
SampleSourceFifo *m_deviceSampleFifo; //!< Reference to the device FIFO for single channel processing
SampleSourceFifoDB m_sampleFifo; //!< Internal FIFO for multi-channel processing
SampleSourceFifoDB *m_deviceSampleFifo; //!< Reference to the device FIFO for single channel processing
void handleWriteToFifo(SampleSourceFifo *sampleFifo, int nbSamples);
void handleWriteToFifo(SampleSourceFifoDB *sampleFifo, int nbSamples);
protected slots:
void handleInputMessages();

Wyświetl plik

@ -21,7 +21,7 @@
#include <vector>
#include "samplesourcefifo.h"
#include "samplesourcefifodb.h"
#include "samplemififo.h"
#include "samplemofifo.h"
#include "util/message.h"

Wyświetl plik

@ -21,7 +21,7 @@
#include <QtGlobal>
#include "samplesourcefifo.h"
#include "samplesourcefifodb.h"
#include "util/message.h"
#include "util/messagequeue.h"
#include "export.h"
@ -114,7 +114,7 @@ public:
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
virtual void setMessageQueueToGUI(MessageQueue *queue) = 0; // pure virtual so that child classes must have to deal with this
MessageQueue *getMessageQueueToGUI() { return m_guiMessageQueue; }
SampleSourceFifo* getSampleFifo() { return &m_sampleSourceFifo; }
SampleSourceFifoDB* getSampleFifo() { return &m_sampleSourceFifo; }
static qint64 calculateDeviceCenterFrequency(
quint64 centerFrequency,
@ -141,7 +141,7 @@ protected slots:
void handleInputMessages();
protected:
SampleSourceFifo m_sampleSourceFifo;
SampleSourceFifoDB m_sampleSourceFifo;
MessageQueue m_inputMessageQueue; //!< Input queue to the sink
MessageQueue *m_guiMessageQueue; //!< Input message queue to the GUI
};

Wyświetl plik

@ -1129,7 +1129,7 @@ void DSPDeviceMIMOEngine::handleSynchronousMessages()
// if (!m_spectrumInputSourceElseSink && m_deviceSampleMIMO && (m_spectrumInputIndex < m_deviceSampleMIMO->getNbSinkStreams()))
// {
// SampleSourceFifo *inputFIFO = m_deviceSampleMIMO->getSampleSourceFifo(m_spectrumInputIndex);
// SampleSourceFifoDB *inputFIFO = m_deviceSampleMIMO->getSampleSourceFifo(m_spectrumInputIndex);
// disconnect(inputFIFO, SIGNAL(dataRead(int)), this, SLOT(handleForwardToSpectrumSink(int)));
// }
@ -1145,13 +1145,13 @@ void DSPDeviceMIMOEngine::handleSynchronousMessages()
{
// if (!m_spectrumInputSourceElseSink) // remove the source listener
// {
// SampleSourceFifo *inputFIFO = m_deviceSampleMIMO->getSampleSourceFifo(m_spectrumInputIndex);
// SampleSourceFifoDB *inputFIFO = m_deviceSampleMIMO->getSampleSourceFifo(m_spectrumInputIndex);
// disconnect(inputFIFO, SIGNAL(dataRead(int)), this, SLOT(handleForwardToSpectrumSink(int)));
// }
if ((!spectrumInputSourceElseSink) && (spectrumInputIndex < m_deviceSampleMIMO->getNbSinkStreams())) // add the source listener
{
// SampleSourceFifo *inputFIFO = m_deviceSampleMIMO->getSampleSourceFifo(spectrumInputIndex);
// SampleSourceFifoDB *inputFIFO = m_deviceSampleMIMO->getSampleSourceFifo(spectrumInputIndex);
// connect(inputFIFO, SIGNAL(dataRead(int)), this, SLOT(handleForwardToSpectrumSink(int)));
if (m_spectrumSink)

Wyświetl plik

@ -26,7 +26,7 @@
#include "dsp/basebandsamplesink.h"
#include "dsp/devicesamplesink.h"
#include "dsp/dspcommands.h"
#include "samplesourcefifo.h"
#include "samplesourcefifodb.h"
#include "threadedbasebandsamplesource.h"
DSPDeviceSinkEngine::DSPDeviceSinkEngine(uint32_t uid, QObject* parent) :
@ -165,7 +165,7 @@ void DSPDeviceSinkEngine::work(int nbWriteSamples)
// qDebug("DSPDeviceSinkEngine::work: multiple channel sources handling: %u", m_multipleSourcesDivisionFactor);
SampleVector::iterator writeBegin;
SampleSourceFifo* sampleFifo = m_deviceSampleSink->getSampleFifo();
SampleSourceFifoDB* sampleFifo = m_deviceSampleSink->getSampleFifo();
sampleFifo->getWriteIterator(writeBegin);
SampleVector::iterator writeAt = writeBegin;
std::vector<SampleVector::iterator> sampleSourceIterators;
@ -560,7 +560,7 @@ void DSPDeviceSinkEngine::handleForwardToSpectrumSink(int nbSamples)
{
if (m_spectrumSink)
{
SampleSourceFifo* sampleFifo = m_deviceSampleSink->getSampleFifo();
SampleSourceFifoDB* sampleFifo = m_deviceSampleSink->getSampleFifo();
SampleVector::iterator readUntil;
sampleFifo->getReadIterator(readUntil);
m_spectrumSink->feed(readUntil - nbSamples, readUntil, false);
@ -569,7 +569,7 @@ void DSPDeviceSinkEngine::handleForwardToSpectrumSink(int nbSamples)
void DSPDeviceSinkEngine::checkNumberOfBasebandSources()
{
SampleSourceFifo* sampleFifo = m_deviceSampleSink->getSampleFifo();
SampleSourceFifoDB* sampleFifo = m_deviceSampleSink->getSampleFifo();
// single channel source handling
if ((m_threadedBasebandSampleSources.size() + m_basebandSampleSources.size()) == 1)

Wyświetl plik

@ -17,9 +17,9 @@
#include <algorithm>
#include <assert.h>
#include "samplesourcefifo.h"
#include "samplesourcefifodb.h"
SampleSourceFifo::SampleSourceFifo(uint32_t size, QObject* parent) :
SampleSourceFifoDB::SampleSourceFifoDB(uint32_t size, QObject* parent) :
QObject(parent),
m_size(size),
m_init(false)
@ -28,7 +28,7 @@ SampleSourceFifo::SampleSourceFifo(uint32_t size, QObject* parent) :
init();
}
SampleSourceFifo::SampleSourceFifo(const SampleSourceFifo& other) :
SampleSourceFifoDB::SampleSourceFifoDB(const SampleSourceFifoDB& other) :
QObject(other.parent()),
m_size(other.m_size),
m_data(other.m_data)
@ -36,19 +36,19 @@ SampleSourceFifo::SampleSourceFifo(const SampleSourceFifo& other) :
init();
}
SampleSourceFifo::~SampleSourceFifo()
SampleSourceFifoDB::~SampleSourceFifoDB()
{}
void SampleSourceFifo::resize(uint32_t size)
void SampleSourceFifoDB::resize(uint32_t size)
{
qDebug("SampleSourceFifo::resize: %d", size);
qDebug("SampleSourceFifoDB::resize: %d", size);
m_size = size;
m_data.resize(2*m_size);
init();
}
void SampleSourceFifo::init()
void SampleSourceFifoDB::init()
{
static Sample zero = {0,0};
std::fill(m_data.begin(), m_data.end(), zero);
@ -57,7 +57,7 @@ void SampleSourceFifo::init()
m_init = true;
}
void SampleSourceFifo::readAdvance(SampleVector::iterator& readUntil, unsigned int nbSamples)
void SampleSourceFifoDB::readAdvance(SampleVector::iterator& readUntil, unsigned int nbSamples)
{
// QMutexLocker mutexLocker(&m_mutex);
assert(nbSamples <= m_size/2);
@ -68,7 +68,7 @@ void SampleSourceFifo::readAdvance(SampleVector::iterator& readUntil, unsigned i
emit dataRead(nbSamples);
}
void SampleSourceFifo::readAdvance(SampleVector::const_iterator& readUntil, unsigned int nbSamples)
void SampleSourceFifoDB::readAdvance(SampleVector::const_iterator& readUntil, unsigned int nbSamples)
{
// QMutexLocker mutexLocker(&m_mutex);
assert(nbSamples <= m_size/2);
@ -79,7 +79,7 @@ void SampleSourceFifo::readAdvance(SampleVector::const_iterator& readUntil, unsi
emit dataRead(nbSamples);
}
void SampleSourceFifo::write(const Sample& sample)
void SampleSourceFifoDB::write(const Sample& sample)
{
m_data[m_iw] = sample;
m_data[m_iw+m_size] = sample;
@ -90,17 +90,17 @@ void SampleSourceFifo::write(const Sample& sample)
}
}
void SampleSourceFifo::getReadIterator(SampleVector::iterator& readUntil)
void SampleSourceFifoDB::getReadIterator(SampleVector::iterator& readUntil)
{
readUntil = m_data.begin() + m_size + m_ir;
}
void SampleSourceFifo::getWriteIterator(SampleVector::iterator& writeAt)
void SampleSourceFifoDB::getWriteIterator(SampleVector::iterator& writeAt)
{
writeAt = m_data.begin() + m_iw;
}
void SampleSourceFifo::bumpIndex(SampleVector::iterator& writeAt)
void SampleSourceFifoDB::bumpIndex(SampleVector::iterator& writeAt)
{
m_data[m_iw+m_size] = m_data[m_iw];
@ -112,12 +112,12 @@ void SampleSourceFifo::bumpIndex(SampleVector::iterator& writeAt)
writeAt = m_data.begin() + m_iw;
}
int SampleSourceFifo::getIteratorOffset(const SampleVector::iterator& iterator)
int SampleSourceFifoDB::getIteratorOffset(const SampleVector::iterator& iterator)
{
return iterator - m_data.begin();
}
void SampleSourceFifo::setIteratorFromOffset(SampleVector::iterator& iterator, int offset)
void SampleSourceFifoDB::setIteratorFromOffset(SampleVector::iterator& iterator, int offset)
{
iterator = m_data.begin() + offset;
}

Wyświetl plik

@ -15,8 +15,8 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#ifndef SDRBASE_DSP_SAMPLESOURCEFIFO_H_
#define SDRBASE_DSP_SAMPLESOURCEFIFO_H_
#ifndef SDRBASE_DSP_SAMPLESOURCEFIFODB_H_
#define SDRBASE_DSP_SAMPLESOURCEFIFODB_H_
#include <QObject>
#include <QMutex>
@ -25,13 +25,13 @@
#include "export.h"
#include "dsp/dsptypes.h"
class SDRBASE_API SampleSourceFifo : public QObject {
class SDRBASE_API SampleSourceFifoDB : public QObject {
Q_OBJECT
public:
SampleSourceFifo(uint32_t size, QObject* parent = nullptr);
SampleSourceFifo(const SampleSourceFifo& other);
~SampleSourceFifo();
SampleSourceFifoDB(uint32_t size, QObject* parent = nullptr);
SampleSourceFifoDB(const SampleSourceFifoDB& other);
~SampleSourceFifoDB();
void resize(uint32_t size);
uint32_t size() const { return m_size; }

Wyświetl plik

@ -64,7 +64,7 @@ void ThreadedBasebandSampleSource::pull(Sample& sample)
m_basebandSampleSource->pull(sample);
}
void ThreadedBasebandSampleSource::feed(SampleSourceFifo* sampleFifo,
void ThreadedBasebandSampleSource::feed(SampleSourceFifoDB* sampleFifo,
int nbSamples)
{
m_basebandSampleSource->feed(sampleFifo, nbSamples);

Wyświetl plik

@ -48,11 +48,11 @@ public:
void pullAudio(int nbSamples) { if (m_basebandSampleSource) m_basebandSampleSource->pullAudio(nbSamples); }
/** direct feeding of sample source FIFO */
void feed(SampleSourceFifo* sampleFifo,
void feed(SampleSourceFifoDB* sampleFifo,
int nbSamples);
SampleSourceFifo& getSampleSourceFifo() { return m_basebandSampleSource->getSampleSourceFifo(); }
void setDeviceSampleSourceFifo(SampleSourceFifo *deviceSampleFifo) { m_basebandSampleSource->setDeviceSampleSourceFifo(deviceSampleFifo); }
SampleSourceFifoDB& getSampleSourceFifo() { return m_basebandSampleSource->getSampleSourceFifo(); }
void setDeviceSampleSourceFifo(SampleSourceFifoDB *deviceSampleFifo) { m_basebandSampleSource->setDeviceSampleSourceFifo(deviceSampleFifo); }
QString getSampleSourceObjectName() const;