mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-09-27 15:26:33 -04:00
Test source: added a square pattern
This commit is contained in:
parent
acbaa14dbd
commit
f43c07b9e5
@ -89,6 +89,9 @@ This controls the generator sample rate in samples per second.
|
||||
- **P1**: Pattern 1 is a sawtooth pattern
|
||||
- Pulse width: 1000 samples
|
||||
- Starts at full amplitude then amplitude decreases linearly down to zero
|
||||
- **P2**: Pattern 2 is a 50% duty cycle square pattern
|
||||
- Pulse width: 1000 samples
|
||||
- Starts with a full amplitude pulse then down to zero for the duration of one pulse
|
||||
|
||||
<h3>5: Modulating tone frequency</h3>
|
||||
|
||||
|
@ -490,6 +490,11 @@
|
||||
<string>P1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>P2</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -362,6 +362,8 @@ bool TestSourceInput::applySettings(const TestSourceSettings& settings, bool for
|
||||
m_testSourceThread->setPattern0();
|
||||
} else if (settings.m_modulation == TestSourceSettings::ModulationPattern1) {
|
||||
m_testSourceThread->setPattern1();
|
||||
} else if (settings.m_modulation == TestSourceSettings::ModulationPattern2) {
|
||||
m_testSourceThread->setPattern2();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ struct TestSourceSettings {
|
||||
ModulationFM,
|
||||
ModulationPattern0,
|
||||
ModulationPattern1,
|
||||
ModulationPattern2,
|
||||
ModulationLast
|
||||
} Modulation;
|
||||
|
||||
|
@ -324,6 +324,24 @@ void TestSourceThread::generate(quint32 chunksize)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TestSourceSettings::ModulationPattern2: // 50% duty cycle square pattern
|
||||
{
|
||||
if (m_pulseSampleCount < m_pulseWidth) // 1
|
||||
{
|
||||
m_buf[i++] = (int16_t) (m_amplitudeBitsI + m_amplitudeBitsDC);
|
||||
m_buf[i++] = (int16_t) (m_phaseImbalance * (float) m_amplitudeBitsQ);
|
||||
} else { // 0
|
||||
m_buf[i++] = m_amplitudeBitsDC;
|
||||
m_buf[i++] = 0;
|
||||
}
|
||||
|
||||
if (m_pulseSampleCount < 2*m_pulseWidth - 1) {
|
||||
m_pulseSampleCount++;
|
||||
} else {
|
||||
m_pulseSampleCount = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TestSourceSettings::ModulationNone:
|
||||
default:
|
||||
{
|
||||
@ -419,3 +437,9 @@ void TestSourceThread::setPattern1()
|
||||
m_pulseWidth = 1000;
|
||||
m_pulseSampleCount = 0;
|
||||
}
|
||||
|
||||
void TestSourceThread::setPattern2()
|
||||
{
|
||||
m_pulseWidth = 1000;
|
||||
m_pulseSampleCount = 0;
|
||||
}
|
||||
|
@ -77,6 +77,7 @@ public:
|
||||
void setFMDeviation(float deviation);
|
||||
void setPattern0();
|
||||
void setPattern1();
|
||||
void setPattern2();
|
||||
|
||||
private:
|
||||
QMutex m_startWaitMutex;
|
||||
|
Loading…
Reference in New Issue
Block a user