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.
sdrplaythread.h
Go to the documentation of this file.
1 // Copyright (C) 2016 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_SDRPLAY_SDRPLAYTHREAD_H_
19 #define PLUGINS_SAMPLESOURCE_SDRPLAY_SDRPLAYTHREAD_H_
20 
21 #include <QThread>
22 #include <QMutex>
23 #include <QWaitCondition>
24 #include <mirisdr.h>
25 #include "dsp/samplesinkfifo.h"
26 #include "dsp/decimators.h"
27 
28 #define SDRPLAY_INIT_NBSAMPLES (1<<14)
29 
30 class SDRPlayThread : public QThread {
31  Q_OBJECT
32 
33 public:
34  SDRPlayThread(mirisdr_dev_t* dev, SampleSinkFifo* sampleFifo, QObject* parent = NULL);
36 
37  void startWork();
38  void stopWork();
39  void setSamplerate(int samplerate);
40  void setLog2Decimation(unsigned int log2_decim);
41  void setFcPos(int fcPos);
42 
43 private:
45  QWaitCondition m_startWaiter;
46  bool m_running;
47 
48  mirisdr_dev_t *m_dev;
51 
53  unsigned int m_log2Decim;
54  int m_fcPos;
55 
57 
58  void run();
59  void callback(const qint16* buf, qint32 len);
60 
61  static void callbackHelper(unsigned char* buf, uint32_t len, void* ctx);
62 };
63 
64 #endif /* PLUGINS_SAMPLESOURCE_SDRPLAY_SDRPLAYTHREAD_H_ */
void setSamplerate(int samplerate)
std::vector< Sample > SampleVector
Definition: dsptypes.h:96
mirisdr_dev_t * m_dev
Definition: sdrplaythread.h:48
unsigned int m_log2Decim
Definition: sdrplaythread.h:53
QWaitCondition m_startWaiter
Definition: sdrplaythread.h:45
unsigned int uint32_t
Definition: rtptypes_win.h:46
void setLog2Decimation(unsigned int log2_decim)
SDRPlayThread(mirisdr_dev_t *dev, SampleSinkFifo *sampleFifo, QObject *parent=NULL)
QMutex m_startWaitMutex
Definition: sdrplaythread.h:44
SampleVector m_convertBuffer
Definition: sdrplaythread.h:49
SampleSinkFifo * m_sampleFifo
Definition: sdrplaythread.h:50
void callback(const qint16 *buf, qint32 len)
static void callbackHelper(unsigned char *buf, uint32_t len, void *ctx)
void setFcPos(int fcPos)
Decimators< qint32, qint16, SDR_RX_SAMP_SZ, 12 > m_decimators
Definition: sdrplaythread.h:56