diff --git a/plugins/samplemimo/testmi/CMakeLists.txt b/plugins/samplemimo/testmi/CMakeLists.txt index 2da1dfa95..a2a052c76 100644 --- a/plugins/samplemimo/testmi/CMakeLists.txt +++ b/plugins/samplemimo/testmi/CMakeLists.txt @@ -3,7 +3,7 @@ project(testmi) set(testmi_SOURCES testmi.cpp testmiplugin.cpp - testmithread.cpp + testmiworker.cpp testmisettings.cpp testmiwebapiadapter.cpp ) @@ -11,7 +11,7 @@ set(testmi_SOURCES set(testmi_HEADERS testmi.h testmiplugin.h - testmithread.h + testmiworker.h testmisettings.h testmiwebapiadapter.h ) diff --git a/plugins/samplemimo/testmi/testmi.cpp b/plugins/samplemimo/testmi/testmi.cpp index c4a1e79cb..edf3ec091 100644 --- a/plugins/samplemimo/testmi/testmi.cpp +++ b/plugins/samplemimo/testmi/testmi.cpp @@ -34,7 +34,7 @@ #include "dsp/devicesamplesource.h" #include "dsp/filerecord.h" -#include "testmithread.h" +#include "testmiworker.h" #include "testmi.h" MESSAGE_CLASS_DEFINITION(TestMI::MsgConfigureTestSource, Message) @@ -84,14 +84,17 @@ bool TestMI::startRx() stopRx(); } - m_testSourceThreads.push_back(new TestMIThread(&m_sampleMIFifo, 0)); - m_testSourceThreads.back()->setSamplerate(m_settings.m_streams[0].m_sampleRate); - m_testSourceThreads.back()->startStop(true); + m_testSourceWorkers.push_back(new TestMIWorker(&m_sampleMIFifo, 0)); + m_testSourceWorkerThreads.push_back(new QThread()); + m_testSourceWorkers.back()->moveToThread(m_testSourceWorkerThreads.back()); + m_testSourceWorkers.back()->setSamplerate(m_settings.m_streams[0].m_sampleRate); - m_testSourceThreads.push_back(new TestMIThread(&m_sampleMIFifo, 1)); - m_testSourceThreads.back()->setSamplerate(m_settings.m_streams[1].m_sampleRate); - m_testSourceThreads.back()->startStop(true); + m_testSourceWorkers.push_back(new TestMIWorker(&m_sampleMIFifo, 1)); + m_testSourceWorkerThreads.push_back(new QThread()); + m_testSourceWorkers.back()->moveToThread(m_testSourceWorkerThreads.back()); + m_testSourceWorkers.back()->setSamplerate(m_settings.m_streams[1].m_sampleRate); + startWorkers(); mutexLocker.unlock(); applySettings(m_settings, true); @@ -110,16 +113,19 @@ void TestMI::stopRx() { qDebug("TestMI::stopRx"); QMutexLocker mutexLocker(&m_mutex); + stopWorkers(); - std::vector::iterator it = m_testSourceThreads.begin(); + std::vector::iterator itW = m_testSourceWorkers.begin(); + std::vector::iterator itT = m_testSourceWorkerThreads.begin(); - for (; it != m_testSourceThreads.end(); ++it) + for (; (itW != m_testSourceWorkers.end()) && (itT != m_testSourceWorkerThreads.end()); ++itW, ++itT) { - (*it)->startStop(false); - (*it)->deleteLater(); + (*itW)->deleteLater(); + delete (*itT); } - m_testSourceThreads.clear(); + m_testSourceWorkers.clear(); + m_testSourceWorkerThreads.clear(); m_running = false; } @@ -128,6 +134,31 @@ void TestMI::stopTx() qDebug("TestMI::stopTx"); } +void TestMI::startWorkers() +{ + std::vector::iterator itW = m_testSourceWorkers.begin(); + std::vector::iterator itT = m_testSourceWorkerThreads.begin(); + + for (; (itW != m_testSourceWorkers.end()) && (itT != m_testSourceWorkerThreads.end()); ++itW, ++itT) + { + (*itW)->startWork(); + (*itT)->start(); + } +} + +void TestMI::stopWorkers() +{ + std::vector::iterator itW = m_testSourceWorkers.begin(); + std::vector::iterator itT = m_testSourceWorkerThreads.begin(); + + for (; (itW != m_testSourceWorkers.end()) && (itT != m_testSourceWorkerThreads.end()); ++itW, ++itT) + { + (*itW)->stopWork(); + (*itT)->quit(); + (*itT)->wait(); + } +} + QByteArray TestMI::serialize() const { return m_settings.serialize(); @@ -298,9 +329,9 @@ bool TestMI::applySettings(const TestMISettings& settings, bool force) { reverseAPIKeys.append("sampleRate"); - if ((istream < m_testSourceThreads.size()) && (m_testSourceThreads[istream])) + if ((istream < m_testSourceWorkers.size()) && (m_testSourceWorkers[istream])) { - m_testSourceThreads[istream]->setSamplerate(settings.m_streams[istream].m_sampleRate); + m_testSourceWorkers[istream]->setSamplerate(settings.m_streams[istream].m_sampleRate); qDebug("TestMI::applySettings: thread on stream: %u sample rate set to %d", istream, settings.m_streams[istream].m_sampleRate); } @@ -310,9 +341,9 @@ bool TestMI::applySettings(const TestMISettings& settings, bool force) { reverseAPIKeys.append("log2Decim"); - if ((istream < m_testSourceThreads.size()) && (m_testSourceThreads[istream])) + if ((istream < m_testSourceWorkers.size()) && (m_testSourceWorkers[istream])) { - m_testSourceThreads[istream]->setLog2Decimation(settings.m_streams[istream].m_log2Decim); + m_testSourceWorkers[istream]->setLog2Decimation(settings.m_streams[istream].m_log2Decim); qDebug("TestMI::applySettings: thread on stream: %u set decimation to %d", istream, (1<setFcPos((int) settings.m_streams[istream].m_fcPos); - m_testSourceThreads[istream]->setFrequencyShift(frequencyShift); + m_testSourceWorkers[istream]->setFcPos((int) settings.m_streams[istream].m_fcPos); + m_testSourceWorkers[istream]->setFrequencyShift(frequencyShift); qDebug() << "TestMI::applySettings:" << " thread on istream: " << istream << " center freq: " << settings.m_streams[istream].m_centerFrequency << " Hz" @@ -367,8 +398,8 @@ bool TestMI::applySettings(const TestMISettings& settings, bool force) { reverseAPIKeys.append("amplitudeBits"); - if ((istream < m_testSourceThreads.size()) && (m_testSourceThreads[istream])) { - m_testSourceThreads[istream]->setAmplitudeBits(settings.m_streams[istream].m_amplitudeBits); + if ((istream < m_testSourceWorkers.size()) && (m_testSourceWorkers[istream])) { + m_testSourceWorkers[istream]->setAmplitudeBits(settings.m_streams[istream].m_amplitudeBits); } } @@ -376,8 +407,8 @@ bool TestMI::applySettings(const TestMISettings& settings, bool force) { reverseAPIKeys.append("dcFactor"); - if ((istream < m_testSourceThreads.size()) && (m_testSourceThreads[istream])) { - m_testSourceThreads[istream]->setDCFactor(settings.m_streams[istream].m_dcFactor); + if ((istream < m_testSourceWorkers.size()) && (m_testSourceWorkers[istream])) { + m_testSourceWorkers[istream]->setDCFactor(settings.m_streams[istream].m_dcFactor); } } @@ -385,8 +416,8 @@ bool TestMI::applySettings(const TestMISettings& settings, bool force) { reverseAPIKeys.append("iFactor"); - if ((istream < m_testSourceThreads.size()) && (m_testSourceThreads[istream])) { - m_testSourceThreads[istream]->setIFactor(settings.m_streams[istream].m_iFactor); + if ((istream < m_testSourceWorkers.size()) && (m_testSourceWorkers[istream])) { + m_testSourceWorkers[istream]->setIFactor(settings.m_streams[istream].m_iFactor); } } @@ -394,8 +425,8 @@ bool TestMI::applySettings(const TestMISettings& settings, bool force) { reverseAPIKeys.append("qFactor"); - if ((istream < m_testSourceThreads.size()) && (m_testSourceThreads[istream])) { - m_testSourceThreads[istream]->setQFactor(settings.m_streams[istream].m_qFactor); + if ((istream < m_testSourceWorkers.size()) && (m_testSourceWorkers[istream])) { + m_testSourceWorkers[istream]->setQFactor(settings.m_streams[istream].m_qFactor); } } @@ -403,8 +434,8 @@ bool TestMI::applySettings(const TestMISettings& settings, bool force) { reverseAPIKeys.append("phaseImbalance"); - if ((istream < m_testSourceThreads.size()) && (m_testSourceThreads[istream])) { - m_testSourceThreads[istream]->setPhaseImbalance(settings.m_streams[istream].m_phaseImbalance); + if ((istream < m_testSourceWorkers.size()) && (m_testSourceWorkers[istream])) { + m_testSourceWorkers[istream]->setPhaseImbalance(settings.m_streams[istream].m_phaseImbalance); } } @@ -412,8 +443,8 @@ bool TestMI::applySettings(const TestMISettings& settings, bool force) { reverseAPIKeys.append("sampleSizeIndex"); - if ((istream < m_testSourceThreads.size()) && (m_testSourceThreads[istream])) { - m_testSourceThreads[istream]->setBitSize(settings.m_streams[istream].m_sampleSizeIndex); + if ((istream < m_testSourceWorkers.size()) && (m_testSourceWorkers[istream])) { + m_testSourceWorkers[istream]->setBitSize(settings.m_streams[istream].m_sampleSizeIndex); } } @@ -432,8 +463,8 @@ bool TestMI::applySettings(const TestMISettings& settings, bool force) { reverseAPIKeys.append("modulationTone"); - if ((istream < m_testSourceThreads.size()) && (m_testSourceThreads[istream])) { - m_testSourceThreads[istream]->setToneFrequency(settings.m_streams[istream].m_modulationTone * 10); + if ((istream < m_testSourceWorkers.size()) && (m_testSourceWorkers[istream])) { + m_testSourceWorkers[istream]->setToneFrequency(settings.m_streams[istream].m_modulationTone * 10); } } @@ -441,16 +472,16 @@ bool TestMI::applySettings(const TestMISettings& settings, bool force) { reverseAPIKeys.append("modulation"); - if ((istream < m_testSourceThreads.size()) && (m_testSourceThreads[istream])) + if ((istream < m_testSourceWorkers.size()) && (m_testSourceWorkers[istream])) { - m_testSourceThreads[istream]->setModulation(settings.m_streams[istream].m_modulation); + m_testSourceWorkers[istream]->setModulation(settings.m_streams[istream].m_modulation); if (settings.m_streams[istream].m_modulation == TestMIStreamSettings::ModulationPattern0) { - m_testSourceThreads[istream]->setPattern0(); + m_testSourceWorkers[istream]->setPattern0(); } else if (settings.m_streams[istream].m_modulation == TestMIStreamSettings::ModulationPattern1) { - m_testSourceThreads[istream]->setPattern1(); + m_testSourceWorkers[istream]->setPattern1(); } else if (settings.m_streams[istream].m_modulation == TestMIStreamSettings::ModulationPattern2) { - m_testSourceThreads[istream]->setPattern2(); + m_testSourceWorkers[istream]->setPattern2(); } } } @@ -459,8 +490,8 @@ bool TestMI::applySettings(const TestMISettings& settings, bool force) { reverseAPIKeys.append("amModulation"); - if ((istream < m_testSourceThreads.size()) && (m_testSourceThreads[istream])) { - m_testSourceThreads[istream]->setAMModulation(settings.m_streams[istream].m_amModulation / 100.0f); + if ((istream < m_testSourceWorkers.size()) && (m_testSourceWorkers[istream])) { + m_testSourceWorkers[istream]->setAMModulation(settings.m_streams[istream].m_amModulation / 100.0f); } } @@ -468,8 +499,8 @@ bool TestMI::applySettings(const TestMISettings& settings, bool force) { reverseAPIKeys.append("fmDeviation"); - if ((istream < m_testSourceThreads.size()) && (m_testSourceThreads[istream])) { - m_testSourceThreads[istream]->setFMDeviation(settings.m_streams[istream].m_fmDeviation * 100.0f); + if ((istream < m_testSourceWorkers.size()) && (m_testSourceWorkers[istream])) { + m_testSourceWorkers[istream]->setFMDeviation(settings.m_streams[istream].m_fmDeviation * 100.0f); } } } // for each stream index diff --git a/plugins/samplemimo/testmi/testmi.h b/plugins/samplemimo/testmi/testmi.h index 51bdcec49..d1ca78c7f 100644 --- a/plugins/samplemimo/testmi/testmi.h +++ b/plugins/samplemimo/testmi/testmi.h @@ -22,12 +22,13 @@ #include #include #include +#include #include "dsp/devicesamplemimo.h" #include "testmisettings.h" class DeviceAPI; -class TestMIThread; +class TestMIWorker; class FileRecord; class QNetworkAccessManager; class QNetworkReply; @@ -148,13 +149,16 @@ private: DeviceAPI *m_deviceAPI; QMutex m_mutex; TestMISettings m_settings; - std::vector m_testSourceThreads; + std::vector m_testSourceWorkers; + std::vector m_testSourceWorkerThreads; QString m_deviceDescription; bool m_running; const QTimer& m_masterTimer; QNetworkAccessManager *m_networkManager; QNetworkRequest m_networkRequest; + void startWorkers(); + void stopWorkers(); bool applySettings(const TestMISettings& settings, bool force); void webapiReverseSendSettings(const DeviceSettingsKeys& deviceSettingsKeys, const TestMISettings& settings, bool force); void webapiReverseSendStartStop(bool start); diff --git a/plugins/samplemimo/testmi/testmiplugin.cpp b/plugins/samplemimo/testmi/testmiplugin.cpp index 4570494c3..528093ccc 100644 --- a/plugins/samplemimo/testmi/testmiplugin.cpp +++ b/plugins/samplemimo/testmi/testmiplugin.cpp @@ -31,7 +31,7 @@ const PluginDescriptor TestMIPlugin::m_pluginDescriptor = { QString("TestMI"), QString("Test Multiple Input"), - QString("5.7.9"), + QString("5.7.10"), QString("(c) Edouard Griffiths, F4EXB"), QString("https://github.com/f4exb/sdrangel"), true, diff --git a/plugins/samplemimo/testmi/testmithread.cpp b/plugins/samplemimo/testmi/testmiworker.cpp similarity index 81% rename from plugins/samplemimo/testmi/testmithread.cpp rename to plugins/samplemimo/testmi/testmiworker.cpp index c56bca121..8911423a9 100644 --- a/plugins/samplemimo/testmi/testmithread.cpp +++ b/plugins/samplemimo/testmi/testmiworker.cpp @@ -22,14 +22,12 @@ #include "dsp/samplemififo.h" -#include "testmithread.h" +#include "testmiworker.h" #define TESTMI_BLOCKSIZE 16384 -MESSAGE_CLASS_DEFINITION(TestMIThread::MsgStartStop, Message) - -TestMIThread::TestMIThread(SampleMIFifo* sampleFifo, int streamIndex, QObject* parent) : - QThread(parent), +TestMIWorker::TestMIWorker(SampleMIFifo* sampleFifo, int streamIndex, QObject* parent) : + QObject(parent), m_running(false), m_buf(0), m_bufsize(0), @@ -70,32 +68,27 @@ TestMIThread::TestMIThread(SampleMIFifo* sampleFifo, int streamIndex, QObject* p connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection); } -TestMIThread::~TestMIThread() +TestMIWorker::~TestMIWorker() { } -void TestMIThread::startWork() +void TestMIWorker::startWork() { m_timer.setTimerType(Qt::PreciseTimer); connect(&m_timer, SIGNAL(timeout()), this, SLOT(tick())); m_timer.start(50); - m_startWaitMutex.lock(); m_elapsedTimer.start(); - start(); - while(!m_running) - m_startWaiter.wait(&m_startWaitMutex, 100); - m_startWaitMutex.unlock(); + m_running = true; } -void TestMIThread::stopWork() +void TestMIWorker::stopWork() { m_running = false; - wait(); m_timer.stop(); disconnect(&m_timer, SIGNAL(timeout()), this, SLOT(tick())); } -void TestMIThread::setSamplerate(int samplerate) +void TestMIWorker::setSamplerate(int samplerate) { QMutexLocker mutexLocker(&m_mutex); @@ -106,17 +99,17 @@ void TestMIThread::setSamplerate(int samplerate) m_toneNco.setFreq(m_toneFrequency, m_samplerate); } -void TestMIThread::setLog2Decimation(unsigned int log2_decim) +void TestMIWorker::setLog2Decimation(unsigned int log2_decim) { m_log2Decim = log2_decim; } -void TestMIThread::setFcPos(int fcPos) +void TestMIWorker::setFcPos(int fcPos) { m_fcPos = fcPos; } -void TestMIThread::setBitSize(quint32 bitSizeIndex) +void TestMIWorker::setBitSize(quint32 bitSizeIndex) { switch (bitSizeIndex) { @@ -136,7 +129,7 @@ void TestMIThread::setBitSize(quint32 bitSizeIndex) } } -void TestMIThread::setAmplitudeBits(int32_t amplitudeBits) +void TestMIWorker::setAmplitudeBits(int32_t amplitudeBits) { m_amplitudeBits = amplitudeBits; m_amplitudeBitsDC = m_dcBias * amplitudeBits; @@ -144,76 +137,57 @@ void TestMIThread::setAmplitudeBits(int32_t amplitudeBits) m_amplitudeBitsQ = (1.0f + m_qBias) * amplitudeBits; } -void TestMIThread::setDCFactor(float dcFactor) +void TestMIWorker::setDCFactor(float dcFactor) { m_dcBias = dcFactor; m_amplitudeBitsDC = m_dcBias * m_amplitudeBits; } -void TestMIThread::setIFactor(float iFactor) +void TestMIWorker::setIFactor(float iFactor) { m_iBias = iFactor; m_amplitudeBitsI = (1.0f + m_iBias) * m_amplitudeBits; } -void TestMIThread::setQFactor(float iFactor) +void TestMIWorker::setQFactor(float iFactor) { m_qBias = iFactor; m_amplitudeBitsQ = (1.0f + m_qBias) * m_amplitudeBits; } -void TestMIThread::setPhaseImbalance(float phaseImbalance) +void TestMIWorker::setPhaseImbalance(float phaseImbalance) { m_phaseImbalance = phaseImbalance; } -void TestMIThread::setFrequencyShift(int shift) +void TestMIWorker::setFrequencyShift(int shift) { m_nco.setFreq(shift, m_samplerate); } -void TestMIThread::setToneFrequency(int toneFrequency) +void TestMIWorker::setToneFrequency(int toneFrequency) { m_toneNco.setFreq(toneFrequency, m_samplerate); } -void TestMIThread::setModulation(TestMIStreamSettings::Modulation modulation) +void TestMIWorker::setModulation(TestMIStreamSettings::Modulation modulation) { m_modulation = modulation; } -void TestMIThread::setAMModulation(float amModulation) +void TestMIWorker::setAMModulation(float amModulation) { m_amModulation = amModulation < 0.0f ? 0.0f : amModulation > 1.0f ? 1.0f : amModulation; } -void TestMIThread::setFMDeviation(float deviation) +void TestMIWorker::setFMDeviation(float deviation) { float fmDeviationUnit = deviation / (float) m_samplerate; m_fmDeviationUnit = fmDeviationUnit < 0.0f ? 0.0f : fmDeviationUnit > 0.5f ? 0.5f : fmDeviationUnit; - qDebug("TestMIThread::setFMDeviation: m_fmDeviationUnit: %f", m_fmDeviationUnit); + qDebug("TestMIWorker::setFMDeviation: m_fmDeviationUnit: %f", m_fmDeviationUnit); } -void TestMIThread::startStop(bool start) -{ - MsgStartStop *msg = MsgStartStop::create(start); - m_inputMessageQueue.push(msg); -} - -void TestMIThread::run() -{ - m_running = true; - m_startWaiter.wakeAll(); - - while (m_running) // actual work is in the tick() function - { - sleep(1); - } - - m_running = false; -} - -void TestMIThread::setBuffers(quint32 chunksize) +void TestMIWorker::setBuffers(quint32 chunksize) { if (chunksize > m_bufsize) { @@ -221,14 +195,14 @@ void TestMIThread::setBuffers(quint32 chunksize) if (m_buf == 0) { - qDebug() << "TestMIThread::setBuffer: Allocate buffer: " + qDebug() << "TestMIWorker::setBuffer: Allocate buffer: " << " size: " << m_bufsize << " bytes" << " #samples: " << (m_bufsize/4); m_buf = (qint16*) malloc(m_bufsize); } else { - qDebug() << "TestMIThread::setBuffer: Re-allocate buffer: " + qDebug() << "TestMIWorker::setBuffer: Re-allocate buffer: " << " size: " << m_bufsize << " bytes" << " #samples: " << (m_bufsize/4); free(m_buf); @@ -239,7 +213,7 @@ void TestMIThread::setBuffers(quint32 chunksize) } } -void TestMIThread::generate(quint32 chunksize) +void TestMIWorker::generate(quint32 chunksize) { int n = chunksize / 2; setBuffers(chunksize); @@ -362,13 +336,13 @@ void TestMIThread::generate(quint32 chunksize) callback(m_buf, n); } -void TestMIThread::pullAF(Real& afSample) +void TestMIWorker::pullAF(Real& afSample) { afSample = m_toneNco.next(); } // call appropriate conversion (decimation) routine depending on the number of sample bits -void TestMIThread::callback(const qint16* buf, qint32 len) +void TestMIWorker::callback(const qint16* buf, qint32 len) { SampleVector::iterator it = m_convertBuffer.begin(); @@ -389,7 +363,7 @@ void TestMIThread::callback(const qint16* buf, qint32 len) m_sampleFifo->writeAsync(m_convertBuffer.begin(), it - m_convertBuffer.begin(), m_streamIndex); } -void TestMIThread::tick() +void TestMIWorker::tick() { if (m_running) { @@ -407,29 +381,11 @@ void TestMIThread::tick() } } -void TestMIThread::handleInputMessages() +void TestMIWorker::handleInputMessages() { - Message* message; - - while ((message = m_inputMessageQueue.pop()) != 0) - { - if (MsgStartStop::match(*message)) - { - MsgStartStop* notif = (MsgStartStop*) message; - qDebug("TestMIThread::handleInputMessages: MsgStartStop: %s", notif->getStartStop() ? "start" : "stop"); - - if (notif->getStartStop()) { - startWork(); - } else { - stopWork(); - } - - delete message; - } - } } -void TestMIThread::setPattern0() +void TestMIWorker::setPattern0() { m_pulseWidth = 150; m_pulseSampleCount = 0; @@ -438,13 +394,13 @@ void TestMIThread::setPattern0() m_pulsePatternPlaces = 3; } -void TestMIThread::setPattern1() +void TestMIWorker::setPattern1() { m_pulseWidth = 1000; m_pulseSampleCount = 0; } -void TestMIThread::setPattern2() +void TestMIWorker::setPattern2() { m_pulseWidth = 1000; m_pulseSampleCount = 0; diff --git a/plugins/samplemimo/testmi/testmithread.h b/plugins/samplemimo/testmi/testmiworker.h similarity index 93% rename from plugins/samplemimo/testmi/testmithread.h rename to plugins/samplemimo/testmi/testmiworker.h index 17defdb90..5680244b5 100644 --- a/plugins/samplemimo/testmi/testmithread.h +++ b/plugins/samplemimo/testmi/testmiworker.h @@ -15,12 +15,10 @@ // along with this program. If not, see . // /////////////////////////////////////////////////////////////////////////////////// -#ifndef _TESTMI_TESTMITHREAD_H_ -#define _TESTMI_TESTMITHREAD_H_ +#ifndef _TESTMI_TESTMIWORKER_H_ +#define _TESTMI_TESTMIWORKER_H_ -#include -#include -#include +#include #include #include #include @@ -36,33 +34,15 @@ class SampleMIFifo; -class TestMIThread : public QThread { +class TestMIWorker : public QObject { Q_OBJECT public: - class MsgStartStop : public Message { - MESSAGE_CLASS_DECLARATION + TestMIWorker(SampleMIFifo* sampleFifo, int streamIndex, QObject* parent = nullptr); + ~TestMIWorker(); - public: - bool getStartStop() const { return m_startStop; } - - static MsgStartStop* create(bool startStop) { - return new MsgStartStop(startStop); - } - - protected: - bool m_startStop; - - MsgStartStop(bool startStop) : - Message(), - m_startStop(startStop) - { } - }; - - TestMIThread(SampleMIFifo* sampleFifo, int streamIndex, QObject* parent = nullptr); - ~TestMIThread(); - - void startStop(bool start); + void startWork(); + void stopWork(); void setSamplerate(int samplerate); void setLog2Decimation(unsigned int log2_decim); void setFcPos(int fcPos); @@ -82,8 +62,6 @@ public: void setPattern2(); private: - QMutex m_startWaitMutex; - QWaitCondition m_startWaiter; volatile bool m_running; qint16 *m_buf; @@ -135,9 +113,6 @@ private: Decimators m_decimators_12; Decimators m_decimators_16; - void startWork(); - void stopWork(); - void run(); void callback(const qint16* buf, qint32 len); void setBuffers(quint32 chunksize); void generate(quint32 chunksize); @@ -384,4 +359,4 @@ private slots: void handleInputMessages(); }; -#endif // _TESTSOURCE_TESTSOURCETHREAD_H_ +#endif // _TESTMI_TESTMIWORKER_H_