18 #define _USE_MATH_DEFINES 27 #define TESTMI_BLOCKSIZE 16384 38 m_sampleFifo(sampleFifo),
39 m_streamIndex(streamIndex),
44 m_fmDeviationUnit(0.0f),
47 m_pulseSampleCount(0),
48 m_pulsePatternCount(0),
49 m_pulsePatternCycle(8),
50 m_pulsePatternPlaces(3),
60 m_phaseImbalance(0.0f),
62 m_amplitudeBitsI(127),
63 m_amplitudeBitsQ(127),
64 m_frequency(435*1000),
67 m_throttleToggle(false),
68 m_mutex(QMutex::Recursive)
70 connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()),
this, SLOT(handleInputMessages()), Qt::QueuedConnection);
79 m_timer.setTimerType(Qt::PreciseTimer);
80 connect(&
m_timer, SIGNAL(timeout()),
this, SLOT(
tick()));
95 disconnect(&
m_timer, SIGNAL(timeout()),
this, SLOT(
tick()));
100 QMutexLocker mutexLocker(&
m_mutex);
121 switch (bitSizeIndex)
187 m_amModulation = amModulation < 0.0f ? 0.0f : amModulation > 1.0f ? 1.0f : amModulation;
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);
224 qDebug() <<
"TestMIThread::setBuffer: Allocate buffer: " 231 qDebug() <<
"TestMIThread::setBuffer: Re-allocate buffer: " 244 int n = chunksize / 2;
247 for (
int i = 0;
i < n-1;)
398 if ((throttlems > 45) && (throttlems < 55) && (throttlems !=
m_throttlems))
400 QMutexLocker mutexLocker(&
m_mutex);
419 qDebug(
"TestMIThread::handleInputMessages: MsgStartStop: %s", notif->
getStartStop() ?
"start" :
"stop");
void setQFactor(float qFactor)
void setSamplerate(int samplerate)
SampleSinkFifo * m_sampleFifo
void convert_16(SampleVector::iterator *it, const qint16 *buf, qint32 len)
Message * pop()
Pop message from queue.
QElapsedTimer m_elapsedTimer
void push(Message *message, bool emitSignal=true)
Push message onto queue.
Fixed< IntType, IntBits > cos(Fixed< IntType, IntBits > const &x)
int32_t m_amplitudeBitsDC
uint write(const quint8 *data, uint count)
TestMIStreamSettings::Modulation m_modulation
QWaitCondition m_startWaiter
static MsgStartStop * create(bool startStop)
uint32_t m_pulseSampleCount
void setFMDeviation(float deviation)
void setIFactor(float iFactor)
void setDCFactor(float iFactor)
void generate(quint32 chunksize)
uint32_t m_pulsePatternCycle
uint32_t m_pulsePatternPlaces
SampleVector m_convertBuffer
Complex nextIQ()
Return next complex sample.
#define TESTMI_THROTTLE_MS
uint32_t m_pulsePatternCount
bool getStartStop() const
MessageQueue m_inputMessageQueue
#define MESSAGE_CLASS_DEFINITION(Name, BaseClass)
void handleInputMessages()
void convert_8(SampleVector::iterator *it, const qint16 *buf, qint32 len)
void setBuffers(quint32 chunksize)
Fixed< IntType, IntBits > sin(Fixed< IntType, IntBits > const &x)
void setBitSize(uint32_t bitSizeIndex)
static bool match(const Message *message)
void pullAF(Real &afSample)
void callback(const qint16 *buf, qint32 len)
void setModulation(TestMIStreamSettings::Modulation modulation)
void setToneFrequency(int toneFrequency)
void setFreq(Real freq, Real sampleRate)
uint32_t m_pulseWidth
pulse width in number of samples
void setAmplitudeBits(int32_t amplitudeBits)
void startStop(bool start)
Real next()
Return next real sample.
void setLog2Decimation(unsigned int log2_decim)
std::complex< Real > Complex
void convert_12(SampleVector::iterator *it, const qint16 *buf, qint32 len)
void setPhaseImbalance(float phaseImbalance)
void setAMModulation(float amModulation)
void setFrequencyShift(int shift)