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.
Classes | Public Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
TestMIThread Class Reference

#include <testmithread.h>

Inherits QThread.

+ Collaboration diagram for TestMIThread:

Classes

class  MsgStartStop
 

Public Member Functions

 TestMIThread (SampleSinkFifo *sampleFifo, int streamIndex, QObject *parent=0)
 
 ~TestMIThread ()
 
void startStop (bool start)
 
void setSamplerate (int samplerate)
 
void setLog2Decimation (unsigned int log2_decim)
 
void setFcPos (int fcPos)
 
void setBitSize (uint32_t bitSizeIndex)
 
void setAmplitudeBits (int32_t amplitudeBits)
 
void setDCFactor (float iFactor)
 
void setIFactor (float iFactor)
 
void setQFactor (float qFactor)
 
void setPhaseImbalance (float phaseImbalance)
 
void setFrequencyShift (int shift)
 
void setToneFrequency (int toneFrequency)
 
void setModulation (TestMIStreamSettings::Modulation modulation)
 
void setAMModulation (float amModulation)
 
void setFMDeviation (float deviation)
 
void setPattern0 ()
 
void setPattern1 ()
 
void setPattern2 ()
 

Private Slots

void tick ()
 
void handleInputMessages ()
 

Private Member Functions

void startWork ()
 
void stopWork ()
 
void run ()
 
void callback (const qint16 *buf, qint32 len)
 
void setBuffers (quint32 chunksize)
 
void generate (quint32 chunksize)
 
void pullAF (Real &afSample)
 
void convert_8 (SampleVector::iterator *it, const qint16 *buf, qint32 len)
 
void convert_12 (SampleVector::iterator *it, const qint16 *buf, qint32 len)
 
void convert_16 (SampleVector::iterator *it, const qint16 *buf, qint32 len)
 

Private Attributes

QMutex m_startWaitMutex
 
QWaitCondition m_startWaiter
 
volatile bool m_running
 
qint16 * m_buf
 
quint32 m_bufsize
 
quint32 m_chunksize
 
SampleVector m_convertBuffer
 
SampleSinkFifom_sampleFifo
 
int m_streamIndex
 
NCOF m_nco
 
NCOF m_toneNco
 
int m_frequencyShift
 
int m_toneFrequency
 
TestMIStreamSettings::Modulation m_modulation
 
float m_amModulation
 
float m_fmDeviationUnit
 
float m_fmPhasor
 
uint32_t m_pulseWidth
 pulse width in number of samples More...
 
uint32_t m_pulseSampleCount
 
uint32_t m_pulsePatternCount
 
uint32_t m_pulsePatternCycle
 
uint32_t m_pulsePatternPlaces
 
int m_samplerate
 
unsigned int m_log2Decim
 
int m_fcPos
 
uint32_t m_bitSizeIndex
 
uint32_t m_bitShift
 
int32_t m_amplitudeBits
 
float m_dcBias
 
float m_iBias
 
float m_qBias
 
float m_phaseImbalance
 
int32_t m_amplitudeBitsDC
 
int32_t m_amplitudeBitsI
 
int32_t m_amplitudeBitsQ
 
uint64_t m_frequency
 
int m_fcPosShift
 
int m_throttlems
 
QTimer m_timer
 
QElapsedTimer m_elapsedTimer
 
bool m_throttleToggle
 
QMutex m_mutex
 
MessageQueue m_inputMessageQueue
 
Decimators< qint32, qint16, SDR_RX_SAMP_SZ, 8 > m_decimators_8
 
Decimators< qint32, qint16, SDR_RX_SAMP_SZ, 12 > m_decimators_12
 
Decimators< qint32, qint16, SDR_RX_SAMP_SZ, 16 > m_decimators_16
 

Detailed Description

Definition at line 38 of file testmithread.h.

Constructor & Destructor Documentation

◆ TestMIThread()

TestMIThread::TestMIThread ( SampleSinkFifo sampleFifo,
int  streamIndex,
QObject *  parent = 0 
)

Definition at line 31 of file testmithread.cpp.

Referenced by TestMIThread::MsgStartStop::MsgStartStop().

31  :
32  QThread(parent),
33  m_running(false),
34  m_buf(0),
35  m_bufsize(0),
36  m_chunksize(0),
38  m_sampleFifo(sampleFifo),
39  m_streamIndex(streamIndex),
41  m_toneFrequency(440),
43  m_amModulation(0.5f),
44  m_fmDeviationUnit(0.0f),
45  m_fmPhasor(0.0f),
46  m_pulseWidth(150),
51  m_samplerate(48000),
52  m_log2Decim(4),
53  m_fcPos(0),
54  m_bitSizeIndex(0),
55  m_bitShift(8),
56  m_amplitudeBits(127),
57  m_dcBias(0.0f),
58  m_iBias(0.0f),
59  m_qBias(0.0f),
60  m_phaseImbalance(0.0f),
62  m_amplitudeBitsI(127),
63  m_amplitudeBitsQ(127),
64  m_frequency(435*1000),
65  m_fcPosShift(0),
67  m_throttleToggle(false),
68  m_mutex(QMutex::Recursive)
69 {
70  connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
71 }
SampleSinkFifo * m_sampleFifo
Definition: testmithread.h:92
bool m_throttleToggle
Definition: testmithread.h:128
int32_t m_amplitudeBitsDC
Definition: testmithread.h:118
unsigned int m_log2Decim
Definition: testmithread.h:109
TestMIStreamSettings::Modulation m_modulation
Definition: testmithread.h:98
#define TESTMI_BLOCKSIZE
uint32_t m_pulseSampleCount
Definition: testmithread.h:103
uint32_t m_bitSizeIndex
Definition: testmithread.h:111
float m_phaseImbalance
Definition: testmithread.h:117
uint32_t m_bitShift
Definition: testmithread.h:112
uint32_t m_pulsePatternCycle
Definition: testmithread.h:105
int32_t m_amplitudeBitsQ
Definition: testmithread.h:120
uint32_t m_pulsePatternPlaces
Definition: testmithread.h:106
SampleVector m_convertBuffer
Definition: testmithread.h:91
#define TESTMI_THROTTLE_MS
Definition: testmithread.h:36
int32_t m_amplitudeBits
Definition: testmithread.h:113
uint32_t m_pulsePatternCount
Definition: testmithread.h:104
MessageQueue m_inputMessageQueue
Definition: testmithread.h:131
void handleInputMessages()
uint64_t m_frequency
Definition: testmithread.h:122
float m_fmPhasor
Definition: testmithread.h:101
volatile bool m_running
Definition: testmithread.h:86
QMutex m_mutex
Definition: testmithread.h:129
int m_toneFrequency
Definition: testmithread.h:97
float m_amModulation
Definition: testmithread.h:99
uint32_t m_pulseWidth
pulse width in number of samples
Definition: testmithread.h:102
int32_t m_amplitudeBitsI
Definition: testmithread.h:119
quint32 m_chunksize
Definition: testmithread.h:90
qint16 * m_buf
Definition: testmithread.h:88
quint32 m_bufsize
Definition: testmithread.h:89
int m_frequencyShift
Definition: testmithread.h:96
float m_fmDeviationUnit
Definition: testmithread.h:100
+ Here is the caller graph for this function:

◆ ~TestMIThread()

TestMIThread::~TestMIThread ( )

Definition at line 73 of file testmithread.cpp.

Referenced by TestMIThread::MsgStartStop::MsgStartStop().

74 {
75 }
+ Here is the caller graph for this function:

Member Function Documentation

◆ callback()

void TestMIThread::callback ( const qint16 *  buf,
qint32  len 
)
private

Definition at line 371 of file testmithread.cpp.

References convert_12(), convert_16(), convert_8(), m_bitSizeIndex, m_convertBuffer, m_sampleFifo, and SampleSinkFifo::write().

Referenced by generate().

372 {
373  SampleVector::iterator it = m_convertBuffer.begin();
374 
375  switch (m_bitSizeIndex)
376  {
377  case 0: // 8 bit samples
378  convert_8(&it, buf, len);
379  break;
380  case 1: // 12 bit samples
381  convert_12(&it, buf, len);
382  break;
383  case 2: // 16 bit samples
384  default:
385  convert_16(&it, buf, len);
386  break;
387  }
388 
389  m_sampleFifo->write(m_convertBuffer.begin(), it);
390 }
SampleSinkFifo * m_sampleFifo
Definition: testmithread.h:92
void convert_16(SampleVector::iterator *it, const qint16 *buf, qint32 len)
Definition: testmithread.h:302
uint write(const quint8 *data, uint count)
uint32_t m_bitSizeIndex
Definition: testmithread.h:111
SampleVector m_convertBuffer
Definition: testmithread.h:91
void convert_8(SampleVector::iterator *it, const qint16 *buf, qint32 len)
Definition: testmithread.h:146
void convert_12(SampleVector::iterator *it, const qint16 *buf, qint32 len)
Definition: testmithread.h:224
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ convert_12()

void TestMIThread::convert_12 ( SampleVector::iterator *  it,
const qint16 *  buf,
qint32  len 
)
inlineprivate

Definition at line 224 of file testmithread.h.

References Decimators< StorageType, T, SdrBits, InputBits >::decimate1(), Decimators< StorageType, T, SdrBits, InputBits >::decimate16_cen(), Decimators< StorageType, T, SdrBits, InputBits >::decimate16_inf(), Decimators< StorageType, T, SdrBits, InputBits >::decimate16_sup(), Decimators< StorageType, T, SdrBits, InputBits >::decimate2_cen(), Decimators< StorageType, T, SdrBits, InputBits >::decimate2_inf(), Decimators< StorageType, T, SdrBits, InputBits >::decimate2_sup(), Decimators< StorageType, T, SdrBits, InputBits >::decimate32_cen(), Decimators< StorageType, T, SdrBits, InputBits >::decimate32_inf(), Decimators< StorageType, T, SdrBits, InputBits >::decimate32_sup(), Decimators< StorageType, T, SdrBits, InputBits >::decimate4_cen(), Decimators< StorageType, T, SdrBits, InputBits >::decimate4_inf(), Decimators< StorageType, T, SdrBits, InputBits >::decimate4_sup(), Decimators< StorageType, T, SdrBits, InputBits >::decimate64_cen(), Decimators< StorageType, T, SdrBits, InputBits >::decimate64_inf(), Decimators< StorageType, T, SdrBits, InputBits >::decimate64_sup(), Decimators< StorageType, T, SdrBits, InputBits >::decimate8_cen(), Decimators< StorageType, T, SdrBits, InputBits >::decimate8_inf(), and Decimators< StorageType, T, SdrBits, InputBits >::decimate8_sup().

Referenced by callback().

225  {
226  if (m_log2Decim == 0) {
227  m_decimators_12.decimate1(it, buf, len);
228  } else {
229  if (m_fcPos == 0) { // Infradyne
230  switch (m_log2Decim) {
231  case 1:
232  m_decimators_12.decimate2_inf(it, buf, len);
233  break;
234  case 2:
235  m_decimators_12.decimate4_inf(it, buf, len);
236  break;
237  case 3:
238  m_decimators_12.decimate8_inf(it, buf, len);
239  break;
240  case 4:
241  m_decimators_12.decimate16_inf(it, buf, len);
242  break;
243  case 5:
244  m_decimators_12.decimate32_inf(it, buf, len);
245  break;
246  case 6:
247  m_decimators_12.decimate64_inf(it, buf, len);
248  break;
249  default:
250  break;
251  }
252  } else if (m_fcPos == 1) {// Supradyne
253  switch (m_log2Decim) {
254  case 1:
255  m_decimators_12.decimate2_sup(it, buf, len);
256  break;
257  case 2:
258  m_decimators_12.decimate4_sup(it, buf, len);
259  break;
260  case 3:
261  m_decimators_12.decimate8_sup(it, buf, len);
262  break;
263  case 4:
264  m_decimators_12.decimate16_sup(it, buf, len);
265  break;
266  case 5:
267  m_decimators_12.decimate32_sup(it, buf, len);
268  break;
269  case 6:
270  m_decimators_12.decimate64_sup(it, buf, len);
271  break;
272  default:
273  break;
274  }
275  } else { // Centered
276  switch (m_log2Decim) {
277  case 1:
278  m_decimators_12.decimate2_cen(it, buf, len);
279  break;
280  case 2:
281  m_decimators_12.decimate4_cen(it, buf, len);
282  break;
283  case 3:
284  m_decimators_12.decimate8_cen(it, buf, len);
285  break;
286  case 4:
287  m_decimators_12.decimate16_cen(it, buf, len);
288  break;
289  case 5:
290  m_decimators_12.decimate32_cen(it, buf, len);
291  break;
292  case 6:
293  m_decimators_12.decimate64_cen(it, buf, len);
294  break;
295  default:
296  break;
297  }
298  }
299  }
300  }
void decimate2_inf(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:498
void decimate64_sup(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:2975
void decimate64_cen(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:3040
void decimate2_sup(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:526
void decimate2_cen(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:554
unsigned int m_log2Decim
Definition: testmithread.h:109
void decimate8_sup(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:941
void decimate64_inf(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:2418
void decimate32_inf(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:1592
void decimate32_sup(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:1902
void decimate4_sup(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:682
void decimate8_cen(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:1057
void decimate8_inf(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:825
void decimate16_sup(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:1300
void decimate4_cen(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:782
void decimate4_inf(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:582
Decimators< qint32, qint16, SDR_RX_SAMP_SZ, 12 > m_decimators_12
Definition: testmithread.h:134
void decimate16_inf(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:1117
void decimate16_cen(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:1483
void decimate32_cen(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:2212
void decimate1(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:462
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ convert_16()

void TestMIThread::convert_16 ( SampleVector::iterator *  it,
const qint16 *  buf,
qint32  len 
)
inlineprivate

Definition at line 302 of file testmithread.h.

References Decimators< StorageType, T, SdrBits, InputBits >::decimate1(), Decimators< StorageType, T, SdrBits, InputBits >::decimate16_cen(), Decimators< StorageType, T, SdrBits, InputBits >::decimate16_inf(), Decimators< StorageType, T, SdrBits, InputBits >::decimate16_sup(), Decimators< StorageType, T, SdrBits, InputBits >::decimate2_cen(), Decimators< StorageType, T, SdrBits, InputBits >::decimate2_inf(), Decimators< StorageType, T, SdrBits, InputBits >::decimate2_sup(), Decimators< StorageType, T, SdrBits, InputBits >::decimate32_cen(), Decimators< StorageType, T, SdrBits, InputBits >::decimate32_inf(), Decimators< StorageType, T, SdrBits, InputBits >::decimate32_sup(), Decimators< StorageType, T, SdrBits, InputBits >::decimate4_cen(), Decimators< StorageType, T, SdrBits, InputBits >::decimate4_inf(), Decimators< StorageType, T, SdrBits, InputBits >::decimate4_sup(), Decimators< StorageType, T, SdrBits, InputBits >::decimate64_cen(), Decimators< StorageType, T, SdrBits, InputBits >::decimate64_inf(), Decimators< StorageType, T, SdrBits, InputBits >::decimate64_sup(), Decimators< StorageType, T, SdrBits, InputBits >::decimate8_cen(), Decimators< StorageType, T, SdrBits, InputBits >::decimate8_inf(), Decimators< StorageType, T, SdrBits, InputBits >::decimate8_sup(), handleInputMessages(), and tick().

Referenced by callback().

303  {
304  if (m_log2Decim == 0) {
305  m_decimators_16.decimate1(it, buf, len);
306  } else {
307  if (m_fcPos == 0) { // Infradyne
308  switch (m_log2Decim) {
309  case 1:
310  m_decimators_16.decimate2_inf(it, buf, len);
311  break;
312  case 2:
313  m_decimators_16.decimate4_inf(it, buf, len);
314  break;
315  case 3:
316  m_decimators_16.decimate8_inf(it, buf, len);
317  break;
318  case 4:
319  m_decimators_16.decimate16_inf(it, buf, len);
320  break;
321  case 5:
322  m_decimators_16.decimate32_inf(it, buf, len);
323  break;
324  case 6:
325  m_decimators_16.decimate64_inf(it, buf, len);
326  break;
327  default:
328  break;
329  }
330  } else if (m_fcPos == 1) {// Supradyne
331  switch (m_log2Decim) {
332  case 1:
333  m_decimators_16.decimate2_sup(it, buf, len);
334  break;
335  case 2:
336  m_decimators_16.decimate4_sup(it, buf, len);
337  break;
338  case 3:
339  m_decimators_16.decimate8_sup(it, buf, len);
340  break;
341  case 4:
342  m_decimators_16.decimate16_sup(it, buf, len);
343  break;
344  case 5:
345  m_decimators_16.decimate32_sup(it, buf, len);
346  break;
347  case 6:
348  m_decimators_16.decimate64_sup(it, buf, len);
349  break;
350  default:
351  break;
352  }
353  } else { // Centered
354  switch (m_log2Decim) {
355  case 1:
356  m_decimators_16.decimate2_cen(it, buf, len);
357  break;
358  case 2:
359  m_decimators_16.decimate4_cen(it, buf, len);
360  break;
361  case 3:
362  m_decimators_16.decimate8_cen(it, buf, len);
363  break;
364  case 4:
365  m_decimators_16.decimate16_cen(it, buf, len);
366  break;
367  case 5:
368  m_decimators_16.decimate32_cen(it, buf, len);
369  break;
370  case 6:
371  m_decimators_16.decimate64_cen(it, buf, len);
372  break;
373  default:
374  break;
375  }
376  }
377  }
378  }
void decimate2_inf(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:498
void decimate64_sup(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:2975
void decimate64_cen(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:3040
void decimate2_sup(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:526
void decimate2_cen(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:554
unsigned int m_log2Decim
Definition: testmithread.h:109
void decimate8_sup(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:941
void decimate64_inf(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:2418
void decimate32_inf(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:1592
void decimate32_sup(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:1902
void decimate4_sup(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:682
void decimate8_cen(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:1057
void decimate8_inf(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:825
void decimate16_sup(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:1300
Decimators< qint32, qint16, SDR_RX_SAMP_SZ, 16 > m_decimators_16
Definition: testmithread.h:135
void decimate4_cen(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:782
void decimate4_inf(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:582
void decimate16_inf(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:1117
void decimate16_cen(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:1483
void decimate32_cen(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:2212
void decimate1(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:462
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ convert_8()

void TestMIThread::convert_8 ( SampleVector::iterator *  it,
const qint16 *  buf,
qint32  len 
)
inlineprivate

Definition at line 146 of file testmithread.h.

References Decimators< StorageType, T, SdrBits, InputBits >::decimate1(), Decimators< StorageType, T, SdrBits, InputBits >::decimate16_cen(), Decimators< StorageType, T, SdrBits, InputBits >::decimate16_inf(), Decimators< StorageType, T, SdrBits, InputBits >::decimate16_sup(), Decimators< StorageType, T, SdrBits, InputBits >::decimate2_cen(), Decimators< StorageType, T, SdrBits, InputBits >::decimate2_inf(), Decimators< StorageType, T, SdrBits, InputBits >::decimate2_sup(), Decimators< StorageType, T, SdrBits, InputBits >::decimate32_cen(), Decimators< StorageType, T, SdrBits, InputBits >::decimate32_inf(), Decimators< StorageType, T, SdrBits, InputBits >::decimate32_sup(), Decimators< StorageType, T, SdrBits, InputBits >::decimate4_cen(), Decimators< StorageType, T, SdrBits, InputBits >::decimate4_inf(), Decimators< StorageType, T, SdrBits, InputBits >::decimate4_sup(), Decimators< StorageType, T, SdrBits, InputBits >::decimate64_cen(), Decimators< StorageType, T, SdrBits, InputBits >::decimate64_inf(), Decimators< StorageType, T, SdrBits, InputBits >::decimate64_sup(), Decimators< StorageType, T, SdrBits, InputBits >::decimate8_cen(), Decimators< StorageType, T, SdrBits, InputBits >::decimate8_inf(), and Decimators< StorageType, T, SdrBits, InputBits >::decimate8_sup().

Referenced by callback().

147  {
148  if (m_log2Decim == 0) {
149  m_decimators_8.decimate1(it, buf, len);
150  } else {
151  if (m_fcPos == 0) { // Infradyne
152  switch (m_log2Decim) {
153  case 1:
154  m_decimators_8.decimate2_inf(it, buf, len);
155  break;
156  case 2:
157  m_decimators_8.decimate4_inf(it, buf, len);
158  break;
159  case 3:
160  m_decimators_8.decimate8_inf(it, buf, len);
161  break;
162  case 4:
163  m_decimators_8.decimate16_inf(it, buf, len);
164  break;
165  case 5:
166  m_decimators_8.decimate32_inf(it, buf, len);
167  break;
168  case 6:
169  m_decimators_8.decimate64_inf(it, buf, len);
170  break;
171  default:
172  break;
173  }
174  } else if (m_fcPos == 1) {// Supradyne
175  switch (m_log2Decim) {
176  case 1:
177  m_decimators_8.decimate2_sup(it, buf, len);
178  break;
179  case 2:
180  m_decimators_8.decimate4_sup(it, buf, len);
181  break;
182  case 3:
183  m_decimators_8.decimate8_sup(it, buf, len);
184  break;
185  case 4:
186  m_decimators_8.decimate16_sup(it, buf, len);
187  break;
188  case 5:
189  m_decimators_8.decimate32_sup(it, buf, len);
190  break;
191  case 6:
192  m_decimators_8.decimate64_sup(it, buf, len);
193  break;
194  default:
195  break;
196  }
197  } else { // Centered
198  switch (m_log2Decim) {
199  case 1:
200  m_decimators_8.decimate2_cen(it, buf, len);
201  break;
202  case 2:
203  m_decimators_8.decimate4_cen(it, buf, len);
204  break;
205  case 3:
206  m_decimators_8.decimate8_cen(it, buf, len);
207  break;
208  case 4:
209  m_decimators_8.decimate16_cen(it, buf, len);
210  break;
211  case 5:
212  m_decimators_8.decimate32_cen(it, buf, len);
213  break;
214  case 6:
215  m_decimators_8.decimate64_cen(it, buf, len);
216  break;
217  default:
218  break;
219  }
220  }
221  }
222  }
void decimate2_inf(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:498
void decimate64_sup(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:2975
void decimate64_cen(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:3040
void decimate2_sup(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:526
void decimate2_cen(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:554
unsigned int m_log2Decim
Definition: testmithread.h:109
void decimate8_sup(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:941
void decimate64_inf(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:2418
void decimate32_inf(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:1592
void decimate32_sup(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:1902
void decimate4_sup(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:682
void decimate8_cen(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:1057
void decimate8_inf(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:825
void decimate16_sup(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:1300
void decimate4_cen(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:782
void decimate4_inf(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:582
void decimate16_inf(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:1117
Decimators< qint32, qint16, SDR_RX_SAMP_SZ, 8 > m_decimators_8
Definition: testmithread.h:133
void decimate16_cen(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:1483
void decimate32_cen(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:2212
void decimate1(SampleVector::iterator *it, const T *buf, qint32 len)
Definition: decimators.h:462
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ generate()

void TestMIThread::generate ( quint32  chunksize)
private

Definition at line 242 of file testmithread.cpp.

References callback(), cos(), i, m_amModulation, m_amplitudeBitsDC, m_amplitudeBitsI, m_amplitudeBitsQ, m_buf, m_fmDeviationUnit, m_fmPhasor, m_modulation, m_nco, m_phaseImbalance, M_PI, m_pulsePatternCount, m_pulsePatternCycle, m_pulsePatternPlaces, m_pulseSampleCount, m_pulseWidth, TestMIStreamSettings::ModulationAM, TestMIStreamSettings::ModulationFM, TestMIStreamSettings::ModulationNone, TestMIStreamSettings::ModulationPattern0, TestMIStreamSettings::ModulationPattern1, TestMIStreamSettings::ModulationPattern2, NCOF::nextIQ(), pullAF(), setBuffers(), and sin().

Referenced by tick().

243 {
244  int n = chunksize / 2;
245  setBuffers(chunksize);
246 
247  for (int i = 0; i < n-1;)
248  {
249  switch (m_modulation)
250  {
252  {
253  Complex c = m_nco.nextIQ();
254  Real t, re, im;
255  pullAF(t);
256  t = (t*m_amModulation + 1.0f)*0.5f;
257  re = c.real()*t;
258  im = c.imag()*t + m_phaseImbalance*re;
259  m_buf[i++] = (int16_t) (re * (float) m_amplitudeBitsI) + m_amplitudeBitsDC;
260  m_buf[i++] = (int16_t) (im * (float) m_amplitudeBitsQ);
261  }
262  break;
264  {
265  Complex c = m_nco.nextIQ();
266  Real t, re, im;
267  pullAF(t);
269  m_fmPhasor = m_fmPhasor < -1.0f ? -m_fmPhasor - 1.0f : m_fmPhasor > 1.0f ? m_fmPhasor - 1.0f : m_fmPhasor;
270  re = c.real()*cos(m_fmPhasor*M_PI) - c.imag()*sin(m_fmPhasor*M_PI);
271  im = (c.real()*sin(m_fmPhasor*M_PI) + c.imag()*cos(m_fmPhasor*M_PI)) + m_phaseImbalance*re;
272  m_buf[i++] = (int16_t) (re * (float) m_amplitudeBitsI) + m_amplitudeBitsDC;
273  m_buf[i++] = (int16_t) (im * (float) m_amplitudeBitsQ);
274  }
275  break;
276  case TestMIStreamSettings::ModulationPattern0: // binary pattern
277  {
278  if (m_pulseSampleCount < m_pulseWidth) // sync pattern: 0
279  {
281  m_buf[i++] = 0;
282  }
283  else if (m_pulseSampleCount < 2*m_pulseWidth) // sync pattern: 1
284  {
286  m_buf[i++] = (int16_t) (m_phaseImbalance * (float) m_amplitudeBitsQ);
287  }
288  else if (m_pulseSampleCount < 3*m_pulseWidth) // sync pattern: 0
289  {
291  m_buf[i++] = 0;
292  }
293  else if (m_pulseSampleCount < (3+m_pulsePatternPlaces)*m_pulseWidth) // binary pattern
294  {
295  uint32_t patPulseSampleCount = m_pulseSampleCount - 3*m_pulseWidth;
296  uint32_t patPulseIndex = patPulseSampleCount / m_pulseWidth;
297  float patFigure = (m_pulsePatternCount & (1<<patPulseIndex)) != 0 ? 0.3 : 0.0; // make binary pattern ~-10dB vs sync pattern
298  m_buf[i++] = (int16_t) (patFigure * (float) m_amplitudeBitsI) + m_amplitudeBitsDC;
299  m_buf[i++] = (int16_t) (patFigure * (float) m_phaseImbalance * m_amplitudeBitsQ);
300  }
301 
302  if (m_pulseSampleCount < (4+m_pulsePatternPlaces)*m_pulseWidth - 1)
303  {
305  }
306  else
307  {
310  } else {
312  }
313 
314  m_pulseSampleCount = 0;
315  }
316  }
317  break;
318  case TestMIStreamSettings::ModulationPattern1: // sawtooth pattern
319  {
320  Real re, im;
321  re = (float) (m_pulseWidth - m_pulseSampleCount) / (float) m_pulseWidth;
322  im = m_phaseImbalance*re;
323  m_buf[i++] = (int16_t) (re * (float) m_amplitudeBitsI) + m_amplitudeBitsDC;
324  m_buf[i++] = (int16_t) (im * (float) m_amplitudeBitsQ);
325 
326  if (m_pulseSampleCount < m_pulseWidth - 1) {
328  } else {
329  m_pulseSampleCount = 0;
330  }
331  }
332  break;
333  case TestMIStreamSettings::ModulationPattern2: // 50% duty cycle square pattern
334  {
335  if (m_pulseSampleCount < m_pulseWidth) // 1
336  {
338  m_buf[i++] = (int16_t) (m_phaseImbalance * (float) m_amplitudeBitsQ);
339  } else { // 0
341  m_buf[i++] = 0;
342  }
343 
344  if (m_pulseSampleCount < 2*m_pulseWidth - 1) {
346  } else {
347  m_pulseSampleCount = 0;
348  }
349  }
350  break;
352  default:
353  {
355  m_buf[i++] = (int16_t) (c.real() * (float) m_amplitudeBitsI) + m_amplitudeBitsDC;
356  m_buf[i++] = (int16_t) (c.imag() * (float) m_amplitudeBitsQ);
357  }
358  break;
359  }
360  }
361 
362  callback(m_buf, n);
363 }
short int16_t
Definition: rtptypes_win.h:43
Fixed< IntType, IntBits > cos(Fixed< IntType, IntBits > const &x)
Definition: fixed.h:2271
int32_t m_amplitudeBitsDC
Definition: testmithread.h:118
TestMIStreamSettings::Modulation m_modulation
Definition: testmithread.h:98
uint32_t m_pulseSampleCount
Definition: testmithread.h:103
float m_phaseImbalance
Definition: testmithread.h:117
uint32_t m_pulsePatternCycle
Definition: testmithread.h:105
int32_t m_amplitudeBitsQ
Definition: testmithread.h:120
#define M_PI
Definition: rdsdemod.cpp:27
uint32_t m_pulsePatternPlaces
Definition: testmithread.h:106
Complex nextIQ()
Return next complex sample.
Definition: ncof.cpp:63
unsigned int uint32_t
Definition: rtptypes_win.h:46
uint32_t m_pulsePatternCount
Definition: testmithread.h:104
void setBuffers(quint32 chunksize)
Fixed< IntType, IntBits > sin(Fixed< IntType, IntBits > const &x)
Definition: fixed.h:2265
int32_t i
Definition: decimators.h:244
float m_fmPhasor
Definition: testmithread.h:101
void pullAF(Real &afSample)
void callback(const qint16 *buf, qint32 len)
float m_amModulation
Definition: testmithread.h:99
uint32_t m_pulseWidth
pulse width in number of samples
Definition: testmithread.h:102
int32_t m_amplitudeBitsI
Definition: testmithread.h:119
std::complex< Real > Complex
Definition: dsptypes.h:43
qint16 * m_buf
Definition: testmithread.h:88
float Real
Definition: dsptypes.h:42
float m_fmDeviationUnit
Definition: testmithread.h:100
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleInputMessages

void TestMIThread::handleInputMessages ( )
privateslot

Definition at line 410 of file testmithread.cpp.

References TestMIThread::MsgStartStop::getStartStop(), m_inputMessageQueue, Message::match(), MessageQueue::pop(), startWork(), and stopWork().

Referenced by convert_16().

411 {
412  Message* message;
413 
414  while ((message = m_inputMessageQueue.pop()) != 0)
415  {
416  if (MsgStartStop::match(*message))
417  {
418  MsgStartStop* notif = (MsgStartStop*) message;
419  qDebug("TestMIThread::handleInputMessages: MsgStartStop: %s", notif->getStartStop() ? "start" : "stop");
420 
421  if (notif->getStartStop()) {
422  startWork();
423  } else {
424  stopWork();
425  }
426 
427  delete message;
428  }
429  }
430 }
Message * pop()
Pop message from queue.
MessageQueue m_inputMessageQueue
Definition: testmithread.h:131
static bool match(const Message *message)
Definition: message.cpp:45
void startWork()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pullAF()

void TestMIThread::pullAF ( Real afSample)
private

Definition at line 365 of file testmithread.cpp.

References m_toneNco, and NCOF::next().

Referenced by generate().

366 {
367  afSample = m_toneNco.next();
368 }
Real next()
Return next real sample.
Definition: ncof.cpp:57
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ run()

void TestMIThread::run ( )
private

Definition at line 203 of file testmithread.cpp.

References m_running, and m_startWaiter.

204 {
205  m_running = true;
206  m_startWaiter.wakeAll();
207 
208  while (m_running) // actual work is in the tick() function
209  {
210  sleep(1);
211  }
212 
213  m_running = false;
214 }
QWaitCondition m_startWaiter
Definition: testmithread.h:85
volatile bool m_running
Definition: testmithread.h:86

◆ setAMModulation()

void TestMIThread::setAMModulation ( float  amModulation)

Definition at line 185 of file testmithread.cpp.

References m_amModulation.

Referenced by TestMIThread::MsgStartStop::MsgStartStop().

186 {
187  m_amModulation = amModulation < 0.0f ? 0.0f : amModulation > 1.0f ? 1.0f : amModulation;
188 }
float m_amModulation
Definition: testmithread.h:99
+ Here is the caller graph for this function:

◆ setAmplitudeBits()

void TestMIThread::setAmplitudeBits ( int32_t  amplitudeBits)

Definition at line 139 of file testmithread.cpp.

References m_amplitudeBits, m_amplitudeBitsDC, m_amplitudeBitsI, m_amplitudeBitsQ, m_dcBias, m_iBias, and m_qBias.

Referenced by TestMIThread::MsgStartStop::MsgStartStop().

140 {
141  m_amplitudeBits = amplitudeBits;
142  m_amplitudeBitsDC = m_dcBias * amplitudeBits;
143  m_amplitudeBitsI = (1.0f + m_iBias) * amplitudeBits;
144  m_amplitudeBitsQ = (1.0f + m_qBias) * amplitudeBits;
145 }
int32_t m_amplitudeBitsDC
Definition: testmithread.h:118
int32_t m_amplitudeBitsQ
Definition: testmithread.h:120
int32_t m_amplitudeBits
Definition: testmithread.h:113
int32_t m_amplitudeBitsI
Definition: testmithread.h:119
+ Here is the caller graph for this function:

◆ setBitSize()

void TestMIThread::setBitSize ( uint32_t  bitSizeIndex)

Definition at line 119 of file testmithread.cpp.

References m_bitShift, and m_bitSizeIndex.

Referenced by TestMIThread::MsgStartStop::MsgStartStop().

120 {
121  switch (bitSizeIndex)
122  {
123  case 0:
124  m_bitShift = 7;
125  m_bitSizeIndex = 0;
126  break;
127  case 1:
128  m_bitShift = 11;
129  m_bitSizeIndex = 1;
130  break;
131  case 2:
132  default:
133  m_bitShift = 15;
134  m_bitSizeIndex = 2;
135  break;
136  }
137 }
uint32_t m_bitSizeIndex
Definition: testmithread.h:111
uint32_t m_bitShift
Definition: testmithread.h:112
+ Here is the caller graph for this function:

◆ setBuffers()

void TestMIThread::setBuffers ( quint32  chunksize)
private

Definition at line 216 of file testmithread.cpp.

References m_buf, m_bufsize, and m_convertBuffer.

Referenced by generate().

217 {
218  if (chunksize > m_bufsize)
219  {
220  m_bufsize = chunksize;
221 
222  if (m_buf == 0)
223  {
224  qDebug() << "TestMIThread::setBuffer: Allocate buffer: "
225  << " size: " << m_bufsize << " bytes"
226  << " #samples: " << (m_bufsize/4);
227  m_buf = (qint16*) malloc(m_bufsize);
228  }
229  else
230  {
231  qDebug() << "TestMIThread::setBuffer: Re-allocate buffer: "
232  << " size: " << m_bufsize << " bytes"
233  << " #samples: " << (m_bufsize/4);
234  free(m_buf);
235  m_buf = (qint16*) malloc(m_bufsize);
236  }
237 
238  m_convertBuffer.resize(chunksize/4);
239  }
240 }
SampleVector m_convertBuffer
Definition: testmithread.h:91
qint16 * m_buf
Definition: testmithread.h:88
quint32 m_bufsize
Definition: testmithread.h:89
+ Here is the caller graph for this function:

◆ setDCFactor()

void TestMIThread::setDCFactor ( float  iFactor)

Definition at line 147 of file testmithread.cpp.

References m_amplitudeBits, m_amplitudeBitsDC, and m_dcBias.

Referenced by TestMIThread::MsgStartStop::MsgStartStop().

148 {
149  m_dcBias = dcFactor;
151 }
int32_t m_amplitudeBitsDC
Definition: testmithread.h:118
int32_t m_amplitudeBits
Definition: testmithread.h:113
+ Here is the caller graph for this function:

◆ setFcPos()

void TestMIThread::setFcPos ( int  fcPos)

Definition at line 114 of file testmithread.cpp.

References m_fcPos.

Referenced by TestMIThread::MsgStartStop::MsgStartStop().

115 {
116  m_fcPos = fcPos;
117 }
+ Here is the caller graph for this function:

◆ setFMDeviation()

void TestMIThread::setFMDeviation ( float  deviation)

Definition at line 190 of file testmithread.cpp.

References m_fmDeviationUnit, and m_samplerate.

Referenced by TestMIThread::MsgStartStop::MsgStartStop().

191 {
192  float fmDeviationUnit = deviation / (float) m_samplerate;
193  m_fmDeviationUnit = fmDeviationUnit < 0.0f ? 0.0f : fmDeviationUnit > 0.5f ? 0.5f : fmDeviationUnit;
194  qDebug("TestMIThread::setFMDeviation: m_fmDeviationUnit: %f", m_fmDeviationUnit);
195 }
float m_fmDeviationUnit
Definition: testmithread.h:100
+ Here is the caller graph for this function:

◆ setFrequencyShift()

void TestMIThread::setFrequencyShift ( int  shift)

Definition at line 170 of file testmithread.cpp.

References m_nco, m_samplerate, and NCOF::setFreq().

Referenced by TestMIThread::MsgStartStop::MsgStartStop().

171 {
172  m_nco.setFreq(shift, m_samplerate);
173 }
void setFreq(Real freq, Real sampleRate)
Definition: ncof.cpp:51
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setIFactor()

void TestMIThread::setIFactor ( float  iFactor)

Definition at line 153 of file testmithread.cpp.

References m_amplitudeBits, m_amplitudeBitsI, and m_iBias.

Referenced by TestMIThread::MsgStartStop::MsgStartStop().

154 {
155  m_iBias = iFactor;
157 }
int32_t m_amplitudeBits
Definition: testmithread.h:113
int32_t m_amplitudeBitsI
Definition: testmithread.h:119
+ Here is the caller graph for this function:

◆ setLog2Decimation()

void TestMIThread::setLog2Decimation ( unsigned int  log2_decim)

Definition at line 109 of file testmithread.cpp.

References m_log2Decim.

Referenced by TestMIThread::MsgStartStop::MsgStartStop().

110 {
111  m_log2Decim = log2_decim;
112 }
unsigned int m_log2Decim
Definition: testmithread.h:109
+ Here is the caller graph for this function:

◆ setModulation()

void TestMIThread::setModulation ( TestMIStreamSettings::Modulation  modulation)

Definition at line 180 of file testmithread.cpp.

References m_modulation.

Referenced by TestMIThread::MsgStartStop::MsgStartStop().

181 {
182  m_modulation = modulation;
183 }
TestMIStreamSettings::Modulation m_modulation
Definition: testmithread.h:98
+ Here is the caller graph for this function:

◆ setPattern0()

void TestMIThread::setPattern0 ( )

Definition at line 432 of file testmithread.cpp.

References m_pulsePatternCount, m_pulsePatternCycle, m_pulsePatternPlaces, m_pulseSampleCount, and m_pulseWidth.

Referenced by TestMIThread::MsgStartStop::MsgStartStop().

433 {
434  m_pulseWidth = 150;
435  m_pulseSampleCount = 0;
439 }
uint32_t m_pulseSampleCount
Definition: testmithread.h:103
uint32_t m_pulsePatternCycle
Definition: testmithread.h:105
uint32_t m_pulsePatternPlaces
Definition: testmithread.h:106
uint32_t m_pulsePatternCount
Definition: testmithread.h:104
uint32_t m_pulseWidth
pulse width in number of samples
Definition: testmithread.h:102
+ Here is the caller graph for this function:

◆ setPattern1()

void TestMIThread::setPattern1 ( )

Definition at line 441 of file testmithread.cpp.

References m_pulseSampleCount, and m_pulseWidth.

Referenced by TestMIThread::MsgStartStop::MsgStartStop().

442 {
443  m_pulseWidth = 1000;
444  m_pulseSampleCount = 0;
445 }
uint32_t m_pulseSampleCount
Definition: testmithread.h:103
uint32_t m_pulseWidth
pulse width in number of samples
Definition: testmithread.h:102
+ Here is the caller graph for this function:

◆ setPattern2()

void TestMIThread::setPattern2 ( )

Definition at line 447 of file testmithread.cpp.

References m_pulseSampleCount, and m_pulseWidth.

Referenced by TestMIThread::MsgStartStop::MsgStartStop().

448 {
449  m_pulseWidth = 1000;
450  m_pulseSampleCount = 0;
451 }
uint32_t m_pulseSampleCount
Definition: testmithread.h:103
uint32_t m_pulseWidth
pulse width in number of samples
Definition: testmithread.h:102
+ Here is the caller graph for this function:

◆ setPhaseImbalance()

void TestMIThread::setPhaseImbalance ( float  phaseImbalance)

Definition at line 165 of file testmithread.cpp.

References m_phaseImbalance.

Referenced by TestMIThread::MsgStartStop::MsgStartStop().

166 {
167  m_phaseImbalance = phaseImbalance;
168 }
float m_phaseImbalance
Definition: testmithread.h:117
+ Here is the caller graph for this function:

◆ setQFactor()

void TestMIThread::setQFactor ( float  qFactor)

Definition at line 159 of file testmithread.cpp.

References m_amplitudeBits, m_amplitudeBitsQ, and m_qBias.

Referenced by TestMIThread::MsgStartStop::MsgStartStop().

160 {
161  m_qBias = iFactor;
163 }
int32_t m_amplitudeBitsQ
Definition: testmithread.h:120
int32_t m_amplitudeBits
Definition: testmithread.h:113
+ Here is the caller graph for this function:

◆ setSamplerate()

void TestMIThread::setSamplerate ( int  samplerate)

Definition at line 98 of file testmithread.cpp.

References m_chunksize, m_frequencyShift, m_mutex, m_nco, m_samplerate, m_throttlems, m_throttleToggle, m_toneFrequency, m_toneNco, and NCOF::setFreq().

Referenced by TestMIThread::MsgStartStop::MsgStartStop().

99 {
100  QMutexLocker mutexLocker(&m_mutex);
101 
102  m_samplerate = samplerate;
103  m_chunksize = 4 * ((m_samplerate * (m_throttlems+(m_throttleToggle ? 1 : 0))) / 1000);
107 }
bool m_throttleToggle
Definition: testmithread.h:128
QMutex m_mutex
Definition: testmithread.h:129
int m_toneFrequency
Definition: testmithread.h:97
void setFreq(Real freq, Real sampleRate)
Definition: ncof.cpp:51
quint32 m_chunksize
Definition: testmithread.h:90
int m_frequencyShift
Definition: testmithread.h:96
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setToneFrequency()

void TestMIThread::setToneFrequency ( int  toneFrequency)

Definition at line 175 of file testmithread.cpp.

References m_samplerate, m_toneNco, and NCOF::setFreq().

Referenced by TestMIThread::MsgStartStop::MsgStartStop().

176 {
177  m_toneNco.setFreq(toneFrequency, m_samplerate);
178 }
void setFreq(Real freq, Real sampleRate)
Definition: ncof.cpp:51
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ startStop()

void TestMIThread::startStop ( bool  start)

Definition at line 197 of file testmithread.cpp.

References TestMIThread::MsgStartStop::create(), m_inputMessageQueue, and MessageQueue::push().

Referenced by TestMIThread::MsgStartStop::MsgStartStop().

198 {
199  MsgStartStop *msg = MsgStartStop::create(start);
201 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
static MsgStartStop * create(bool startStop)
Definition: testmithread.h:48
MessageQueue m_inputMessageQueue
Definition: testmithread.h:131
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ startWork()

void TestMIThread::startWork ( )
private

Definition at line 77 of file testmithread.cpp.

References m_elapsedTimer, m_running, m_startWaiter, m_startWaitMutex, m_timer, and tick().

Referenced by handleInputMessages().

78 {
79  m_timer.setTimerType(Qt::PreciseTimer);
80  connect(&m_timer, SIGNAL(timeout()), this, SLOT(tick()));
81  m_timer.start(50);
82  m_startWaitMutex.lock();
83  m_elapsedTimer.start();
84  start();
85  while(!m_running)
86  m_startWaiter.wait(&m_startWaitMutex, 100);
87  m_startWaitMutex.unlock();
88 }
QElapsedTimer m_elapsedTimer
Definition: testmithread.h:127
QWaitCondition m_startWaiter
Definition: testmithread.h:85
volatile bool m_running
Definition: testmithread.h:86
QMutex m_startWaitMutex
Definition: testmithread.h:84
QTimer m_timer
Definition: testmithread.h:126
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ stopWork()

void TestMIThread::stopWork ( )
private

Definition at line 90 of file testmithread.cpp.

References m_running, m_timer, and tick().

Referenced by handleInputMessages().

91 {
92  m_running = false;
93  wait();
94  m_timer.stop();
95  disconnect(&m_timer, SIGNAL(timeout()), this, SLOT(tick()));
96 }
volatile bool m_running
Definition: testmithread.h:86
QTimer m_timer
Definition: testmithread.h:126
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ tick

void TestMIThread::tick ( )
privateslot

Definition at line 392 of file testmithread.cpp.

References generate(), m_chunksize, m_elapsedTimer, m_mutex, m_running, m_samplerate, m_throttlems, and m_throttleToggle.

Referenced by convert_16(), startWork(), and stopWork().

393 {
394  if (m_running)
395  {
396  qint64 throttlems = m_elapsedTimer.restart();
397 
398  if ((throttlems > 45) && (throttlems < 55) && (throttlems != m_throttlems))
399  {
400  QMutexLocker mutexLocker(&m_mutex);
401  m_throttlems = throttlems;
402  m_chunksize = 4 * ((m_samplerate * (m_throttlems+(m_throttleToggle ? 1 : 0))) / 1000);
404  }
405 
407  }
408 }
bool m_throttleToggle
Definition: testmithread.h:128
QElapsedTimer m_elapsedTimer
Definition: testmithread.h:127
void generate(quint32 chunksize)
volatile bool m_running
Definition: testmithread.h:86
QMutex m_mutex
Definition: testmithread.h:129
quint32 m_chunksize
Definition: testmithread.h:90
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_amModulation

float TestMIThread::m_amModulation
private

Definition at line 99 of file testmithread.h.

Referenced by generate(), and setAMModulation().

◆ m_amplitudeBits

int32_t TestMIThread::m_amplitudeBits
private

Definition at line 113 of file testmithread.h.

Referenced by setAmplitudeBits(), setDCFactor(), setIFactor(), and setQFactor().

◆ m_amplitudeBitsDC

int32_t TestMIThread::m_amplitudeBitsDC
private

Definition at line 118 of file testmithread.h.

Referenced by generate(), setAmplitudeBits(), and setDCFactor().

◆ m_amplitudeBitsI

int32_t TestMIThread::m_amplitudeBitsI
private

Definition at line 119 of file testmithread.h.

Referenced by generate(), setAmplitudeBits(), and setIFactor().

◆ m_amplitudeBitsQ

int32_t TestMIThread::m_amplitudeBitsQ
private

Definition at line 120 of file testmithread.h.

Referenced by generate(), setAmplitudeBits(), and setQFactor().

◆ m_bitShift

uint32_t TestMIThread::m_bitShift
private

Definition at line 112 of file testmithread.h.

Referenced by setBitSize().

◆ m_bitSizeIndex

uint32_t TestMIThread::m_bitSizeIndex
private

Definition at line 111 of file testmithread.h.

Referenced by callback(), and setBitSize().

◆ m_buf

qint16* TestMIThread::m_buf
private

Definition at line 88 of file testmithread.h.

Referenced by generate(), and setBuffers().

◆ m_bufsize

quint32 TestMIThread::m_bufsize
private

Definition at line 89 of file testmithread.h.

Referenced by setBuffers().

◆ m_chunksize

quint32 TestMIThread::m_chunksize
private

Definition at line 90 of file testmithread.h.

Referenced by setSamplerate(), and tick().

◆ m_convertBuffer

SampleVector TestMIThread::m_convertBuffer
private

Definition at line 91 of file testmithread.h.

Referenced by callback(), and setBuffers().

◆ m_dcBias

float TestMIThread::m_dcBias
private

Definition at line 114 of file testmithread.h.

Referenced by setAmplitudeBits(), and setDCFactor().

◆ m_decimators_12

Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12> TestMIThread::m_decimators_12
private

Definition at line 134 of file testmithread.h.

◆ m_decimators_16

Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 16> TestMIThread::m_decimators_16
private

Definition at line 135 of file testmithread.h.

◆ m_decimators_8

Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 8> TestMIThread::m_decimators_8
private

Definition at line 133 of file testmithread.h.

◆ m_elapsedTimer

QElapsedTimer TestMIThread::m_elapsedTimer
private

Definition at line 127 of file testmithread.h.

Referenced by startWork(), and tick().

◆ m_fcPos

int TestMIThread::m_fcPos
private

Definition at line 110 of file testmithread.h.

Referenced by setFcPos().

◆ m_fcPosShift

int TestMIThread::m_fcPosShift
private

Definition at line 123 of file testmithread.h.

◆ m_fmDeviationUnit

float TestMIThread::m_fmDeviationUnit
private

Definition at line 100 of file testmithread.h.

Referenced by generate(), and setFMDeviation().

◆ m_fmPhasor

float TestMIThread::m_fmPhasor
private

Definition at line 101 of file testmithread.h.

Referenced by generate().

◆ m_frequency

uint64_t TestMIThread::m_frequency
private

Definition at line 122 of file testmithread.h.

◆ m_frequencyShift

int TestMIThread::m_frequencyShift
private

Definition at line 96 of file testmithread.h.

Referenced by setSamplerate().

◆ m_iBias

float TestMIThread::m_iBias
private

Definition at line 115 of file testmithread.h.

Referenced by setAmplitudeBits(), and setIFactor().

◆ m_inputMessageQueue

MessageQueue TestMIThread::m_inputMessageQueue
private

Definition at line 131 of file testmithread.h.

Referenced by handleInputMessages(), and startStop().

◆ m_log2Decim

unsigned int TestMIThread::m_log2Decim
private

Definition at line 109 of file testmithread.h.

Referenced by setLog2Decimation().

◆ m_modulation

TestMIStreamSettings::Modulation TestMIThread::m_modulation
private

Definition at line 98 of file testmithread.h.

Referenced by generate(), and setModulation().

◆ m_mutex

QMutex TestMIThread::m_mutex
private

Definition at line 129 of file testmithread.h.

Referenced by setSamplerate(), and tick().

◆ m_nco

NCOF TestMIThread::m_nco
private

Definition at line 94 of file testmithread.h.

Referenced by generate(), setFrequencyShift(), and setSamplerate().

◆ m_phaseImbalance

float TestMIThread::m_phaseImbalance
private

Definition at line 117 of file testmithread.h.

Referenced by generate(), and setPhaseImbalance().

◆ m_pulsePatternCount

uint32_t TestMIThread::m_pulsePatternCount
private

Definition at line 104 of file testmithread.h.

Referenced by generate(), and setPattern0().

◆ m_pulsePatternCycle

uint32_t TestMIThread::m_pulsePatternCycle
private

Definition at line 105 of file testmithread.h.

Referenced by generate(), and setPattern0().

◆ m_pulsePatternPlaces

uint32_t TestMIThread::m_pulsePatternPlaces
private

Definition at line 106 of file testmithread.h.

Referenced by generate(), and setPattern0().

◆ m_pulseSampleCount

uint32_t TestMIThread::m_pulseSampleCount
private

Definition at line 103 of file testmithread.h.

Referenced by generate(), setPattern0(), setPattern1(), and setPattern2().

◆ m_pulseWidth

uint32_t TestMIThread::m_pulseWidth
private

pulse width in number of samples

Definition at line 102 of file testmithread.h.

Referenced by generate(), setPattern0(), setPattern1(), and setPattern2().

◆ m_qBias

float TestMIThread::m_qBias
private

Definition at line 116 of file testmithread.h.

Referenced by setAmplitudeBits(), and setQFactor().

◆ m_running

volatile bool TestMIThread::m_running
private

Definition at line 86 of file testmithread.h.

Referenced by run(), startWork(), stopWork(), and tick().

◆ m_sampleFifo

SampleSinkFifo* TestMIThread::m_sampleFifo
private

Definition at line 92 of file testmithread.h.

Referenced by callback().

◆ m_samplerate

int TestMIThread::m_samplerate
private

◆ m_startWaiter

QWaitCondition TestMIThread::m_startWaiter
private

Definition at line 85 of file testmithread.h.

Referenced by run(), and startWork().

◆ m_startWaitMutex

QMutex TestMIThread::m_startWaitMutex
private

Definition at line 84 of file testmithread.h.

Referenced by startWork().

◆ m_streamIndex

int TestMIThread::m_streamIndex
private

Definition at line 93 of file testmithread.h.

◆ m_throttlems

int TestMIThread::m_throttlems
private

Definition at line 125 of file testmithread.h.

Referenced by setSamplerate(), and tick().

◆ m_throttleToggle

bool TestMIThread::m_throttleToggle
private

Definition at line 128 of file testmithread.h.

Referenced by setSamplerate(), and tick().

◆ m_timer

QTimer TestMIThread::m_timer
private

Definition at line 126 of file testmithread.h.

Referenced by startWork(), and stopWork().

◆ m_toneFrequency

int TestMIThread::m_toneFrequency
private

Definition at line 97 of file testmithread.h.

Referenced by setSamplerate().

◆ m_toneNco

NCOF TestMIThread::m_toneNco
private

Definition at line 95 of file testmithread.h.

Referenced by pullAF(), setSamplerate(), and setToneFrequency().


The documentation for this class was generated from the following files: