From faf428ed3d628c35598b6e5d581b4da7fc8b4cae Mon Sep 17 00:00:00 2001 From: f4exb Date: Wed, 24 Oct 2018 00:10:12 +0200 Subject: [PATCH] Test source: added sawtooth pattern --- .../samplesource/testsource/testsourcegui.ui | 7 +++- .../testsource/testsourceinput.cpp | 9 ++++- .../testsource/testsourcesettings.h | 3 +- .../testsource/testsourcethread.cpp | 34 +++++++++++++++++-- .../testsource/testsourcethread.h | 2 ++ 5 files changed, 50 insertions(+), 5 deletions(-) diff --git a/plugins/samplesource/testsource/testsourcegui.ui b/plugins/samplesource/testsource/testsourcegui.ui index 90fb1f795..2abaa5717 100644 --- a/plugins/samplesource/testsource/testsourcegui.ui +++ b/plugins/samplesource/testsource/testsourcegui.ui @@ -482,7 +482,12 @@ - Pul + P0 + + + + + P1 diff --git a/plugins/samplesource/testsource/testsourceinput.cpp b/plugins/samplesource/testsource/testsourceinput.cpp index 94efed087..6a5509481 100644 --- a/plugins/samplesource/testsource/testsourceinput.cpp +++ b/plugins/samplesource/testsource/testsourceinput.cpp @@ -354,8 +354,15 @@ bool TestSourceInput::applySettings(const TestSourceSettings& settings, bool for if ((m_settings.m_modulation != settings.m_modulation) || force) { - if (m_testSourceThread != 0) { + if (m_testSourceThread != 0) + { m_testSourceThread->setModulation(settings.m_modulation); + + if (settings.m_modulation == TestSourceSettings::ModulationPattern0) { + m_testSourceThread->setPattern0(); + } else if (settings.m_modulation == TestSourceSettings::ModulationPattern1) { + m_testSourceThread->setPattern1(); + } } } diff --git a/plugins/samplesource/testsource/testsourcesettings.h b/plugins/samplesource/testsource/testsourcesettings.h index 37dd52797..9c1c8f3fe 100644 --- a/plugins/samplesource/testsource/testsourcesettings.h +++ b/plugins/samplesource/testsource/testsourcesettings.h @@ -37,7 +37,8 @@ struct TestSourceSettings { ModulationNone, ModulationAM, ModulationFM, - ModulationPulse, + ModulationPattern0, + ModulationPattern1, ModulationLast } Modulation; diff --git a/plugins/samplesource/testsource/testsourcethread.cpp b/plugins/samplesource/testsource/testsourcethread.cpp index 432a5aa12..5f37d726f 100644 --- a/plugins/samplesource/testsource/testsourcethread.cpp +++ b/plugins/samplesource/testsource/testsourcethread.cpp @@ -267,7 +267,7 @@ void TestSourceThread::generate(quint32 chunksize) m_buf[i++] = (int16_t) (im * (float) m_amplitudeBitsQ); } break; - case TestSourceSettings::ModulationPulse: + case TestSourceSettings::ModulationPattern0: // binary pattern { if (m_pulseSampleCount < m_pulseWidth) // sync pattern: 0 { @@ -288,7 +288,7 @@ void TestSourceThread::generate(quint32 chunksize) { uint32_t patPulseSampleCount = m_pulseSampleCount - 3*m_pulseWidth; uint32_t patPulseIndex = patPulseSampleCount / m_pulseWidth; - float patFigure = (m_pulsePatternCount & (1<