18 #define _USE_MATH_DEFINES 26 #define TESTSOURCE_BLOCKSIZE 16384 37 m_sampleFifo(sampleFifo),
42 m_fmDeviationUnit(0.0f),
45 m_pulseSampleCount(0),
46 m_pulsePatternCount(0),
47 m_pulsePatternCycle(8),
48 m_pulsePatternPlaces(3),
58 m_phaseImbalance(0.0f),
60 m_amplitudeBitsI(127),
61 m_amplitudeBitsQ(127),
62 m_frequency(435*1000),
65 m_throttleToggle(false),
66 m_mutex(QMutex::Recursive),
69 connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()),
this, SLOT(handleInputMessages()), Qt::QueuedConnection);
78 m_timer.setTimerType(Qt::PreciseTimer);
79 connect(&
m_timer, SIGNAL(timeout()),
this, SLOT(
tick()));
94 disconnect(&
m_timer, SIGNAL(timeout()),
this, SLOT(
tick()));
99 QMutexLocker mutexLocker(&
m_mutex);
120 switch (bitSizeIndex)
186 m_amModulation = amModulation < 0.0f ? 0.0f : amModulation > 1.0f ? 1.0f : amModulation;
191 float fmDeviationUnit = deviation / (float)
m_samplerate;
192 m_fmDeviationUnit = fmDeviationUnit < 0.0f ? 0.0f : fmDeviationUnit > 0.5f ? 0.5f : fmDeviationUnit;
193 qDebug(
"TestSourceThread::setFMDeviation: m_fmDeviationUnit: %f",
m_fmDeviationUnit);
223 qDebug() <<
"TestSourceThread::setBuffer: Allocate buffer: " 230 qDebug() <<
"TestSourceThread::setBuffer: Re-allocate buffer: " 243 int n = chunksize / 2;
246 for (
int i = 0;
i < n-1;)
397 std::map<int,int>::iterator it;
409 qDebug(
"TestSourceThread::tick: -----------");
411 qDebug(
"TestSourceThread::tick: %d: %d", it->first, it->second);
416 if ((throttlems > 45) && (throttlems < 55) && (throttlems !=
m_throttlems))
418 QMutexLocker mutexLocker(&
m_mutex);
437 qDebug(
"TestSourceThread::handleInputMessages: MsgStartStop: %s", notif->
getStartStop() ?
"start" :
"stop");
uint32_t m_pulsePatternPlaces
Message * pop()
Pop message from queue.
void push(Message *message, bool emitSignal=true)
Push message onto queue.
Fixed< IntType, IntBits > cos(Fixed< IntType, IntBits > const &x)
int32_t m_amplitudeBitsDC
static MsgStartStop * create(bool startStop)
uint32_t m_pulseWidth
pulse width in number of samples
uint32_t m_pulsePatternCount
void setPhaseImbalance(float phaseImbalance)
void setSamplerate(int samplerate)
uint32_t m_pulseSampleCount
void setIFactor(float iFactor)
uint write(const quint8 *data, uint count)
void setLog2Decimation(unsigned int log2_decim)
void startStop(bool start)
void setAMModulation(float amModulation)
void setBitSize(uint32_t bitSizeIndex)
bool getStartStop() const
void convert_12(SampleVector::iterator *it, const qint16 *buf, qint32 len)
SampleVector m_convertBuffer
void setModulation(TestSourceSettings::Modulation modulation)
void convert_8(SampleVector::iterator *it, const qint16 *buf, qint32 len)
SampleSinkFifo * m_sampleFifo
#define TESTSOURCE_THROTTLE_MS
Complex nextIQ()
Return next complex sample.
QWaitCondition m_startWaiter
void setToneFrequency(int toneFrequency)
void handleInputMessages()
void setFrequencyShift(int shift)
#define MESSAGE_CLASS_DEFINITION(Name, BaseClass)
uint32_t m_pulsePatternCycle
Fixed< IntType, IntBits > sin(Fixed< IntType, IntBits > const &x)
void generate(quint32 chunksize)
void setAmplitudeBits(int32_t amplitudeBits)
static bool match(const Message *message)
void callback(const qint16 *buf, qint32 len)
void setFMDeviation(float deviation)
void pullAF(Real &afSample)
void setDCFactor(float iFactor)
void setBuffers(quint32 chunksize)
void convert_16(SampleVector::iterator *it, const qint16 *buf, qint32 len)
void setFreq(Real freq, Real sampleRate)
TestSourceSettings::Modulation m_modulation
MessageQueue m_inputMessageQueue
std::map< int, int > m_timerHistogram
void setQFactor(float qFactor)
Real next()
Return next real sample.
std::complex< Real > Complex
#define TESTSOURCE_BLOCKSIZE
QElapsedTimer m_elapsedTimer