SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
xtrxoutputthread.h
Go to the documentation of this file.
1 // Copyright (C) 2019 Edouard Griffiths, F4EXB //
3 // //
4 // This program is free software; you can redistribute it and/or modify //
5 // it under the terms of the GNU General Public License as published by //
6 // the Free Software Foundation as version 3 of the License, or //
7 // (at your option) any later version. //
8 // //
9 // This program is distributed in the hope that it will be useful, //
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
12 // GNU General Public License V3 for more details. //
13 // //
14 // You should have received a copy of the GNU General Public License //
15 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
17 
18 #ifndef PLUGINS_SAMPLESOURCE_XTRXOUTPUT_XTRXOUTPUTTHREAD_H_
19 #define PLUGINS_SAMPLESOURCE_XTRXOUTPUT_XTRXOUTPUTTHREAD_H_
20 
21 #include <QThread>
22 #include <QMutex>
23 #include <QWaitCondition>
24 
25 #include "xtrx_api.h"
26 
27 #include "dsp/samplesourcefifo.h"
28 #include "dsp/interpolators.h"
29 #include "xtrx/devicextrxshared.h"
30 
31 struct xtrx_dev;
32 
34 {
35  Q_OBJECT
36 
37 public:
38  XTRXOutputThread(struct xtrx_dev *dev, unsigned int nbChannels, unsigned int uniqueChannelIndex = 0, QObject* parent = 0);
40 
41  virtual void startWork();
42  virtual void stopWork();
43  virtual bool isRunning() { return m_running; }
44  unsigned int getNbChannels() const { return m_nbChannels; }
45  void setLog2Interpolation(unsigned int channel, unsigned int log2_interp);
46  unsigned int getLog2Interpolation(unsigned int channel) const;
47  void setFifo(unsigned int channel, SampleSourceFifo *sampleFifo);
48  SampleSourceFifo *getFifo(unsigned int channel);
49 
50 private:
51  struct Channel
52  {
54  unsigned int m_log2Interp;
56 
57  Channel() :
58  m_sampleFifo(0),
59  m_log2Interp(0)
60  {}
61 
63  {}
64  };
65 
67  QWaitCondition m_startWaiter;
68  bool m_running;
69  struct xtrx_dev *m_dev;
70 
72  unsigned int m_nbChannels;
73  unsigned int m_uniqueChannelIndex;
74 
75  void run();
76  unsigned int getNbFifos();
77  void callback(qint16* buf, qint32 len);
78  void callbackSO(qint16* buf, qint32 len);
79  void callbackMO(qint16* buf0, qint16* buf1, qint32 len);
80 };
81 
82 #endif /* PLUGINS_SAMPLESOURCE_XTRXOUTPUT_XTRXOUTPUTTHREAD_H_ */
virtual bool isRunning()
unsigned int getLog2Interpolation(unsigned int channel) const
virtual void stopWork()
void callbackSO(qint16 *buf, qint32 len)
unsigned int m_nbChannels
Channel * m_channels
Array of channels dynamically allocated for the given number of Rx channels.
void callback(qint16 *buf, qint32 len)
SampleSourceFifo * getFifo(unsigned int channel)
void setFifo(unsigned int channel, SampleSourceFifo *sampleFifo)
struct xtrx_dev * m_dev
XTRXOutputThread(struct xtrx_dev *dev, unsigned int nbChannels, unsigned int uniqueChannelIndex=0, QObject *parent=0)
unsigned int getNbChannels() const
SampleSourceFifo * m_sampleFifo
Interpolators< qint16, SDR_TX_SAMP_SZ, 12 > m_interpolators
unsigned int getNbFifos()
virtual void startWork()
unsigned int m_uniqueChannelIndex
void callbackMO(qint16 *buf0, qint16 *buf1, qint32 len)
void setLog2Interpolation(unsigned int channel, unsigned int log2_interp)
QWaitCondition m_startWaiter