mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 09:48:45 -05:00
Test source: basic pulse test pattern
This commit is contained in:
parent
f813c0134e
commit
30e36157a8
@ -480,6 +480,11 @@
|
||||
<string>FM</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Pul</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
const PluginDescriptor TestSourcePlugin::m_pluginDescriptor = {
|
||||
QString("Test Source input"),
|
||||
QString("4.1.0"),
|
||||
QString("4.2.4"),
|
||||
QString("(c) Edouard Griffiths, F4EXB"),
|
||||
QString("https://github.com/f4exb/sdrangel"),
|
||||
true,
|
||||
|
@ -37,6 +37,7 @@ struct TestSourceSettings {
|
||||
ModulationNone,
|
||||
ModulationAM,
|
||||
ModulationFM,
|
||||
ModulationPulse,
|
||||
ModulationLast
|
||||
} Modulation;
|
||||
|
||||
|
@ -38,6 +38,11 @@ TestSourceThread::TestSourceThread(SampleSinkFifo* sampleFifo, QObject* parent)
|
||||
m_amModulation(0.5f),
|
||||
m_fmDeviationUnit(0.0f),
|
||||
m_fmPhasor(0.0f),
|
||||
m_pulseWidth(150),
|
||||
m_pulseSampleCount(0),
|
||||
m_pulsePatternCount(0),
|
||||
m_pulsePatternCycle(8),
|
||||
m_pulsePatternPlaces(3),
|
||||
m_samplerate(48000),
|
||||
m_log2Decim(4),
|
||||
m_fcPos(0),
|
||||
@ -262,6 +267,48 @@ void TestSourceThread::generate(quint32 chunksize)
|
||||
m_buf[i++] = (int16_t) (im * (float) m_amplitudeBitsQ);
|
||||
}
|
||||
break;
|
||||
case TestSourceSettings::ModulationPulse:
|
||||
{
|
||||
if (m_pulseSampleCount < m_pulseWidth) // sync pattern: 0
|
||||
{
|
||||
m_buf[i++] = m_amplitudeBitsDC;
|
||||
m_buf[i++] = 0;
|
||||
}
|
||||
else if (m_pulseSampleCount < 2*m_pulseWidth) // sync pattern: 1
|
||||
{
|
||||
m_buf[i++] = (int16_t) (m_amplitudeBitsI + m_amplitudeBitsDC);
|
||||
m_buf[i++] = (int16_t) (m_phaseImbalance * (float) m_amplitudeBitsQ);
|
||||
}
|
||||
else if (m_pulseSampleCount < 3*m_pulseWidth) // sync pattern: 0
|
||||
{
|
||||
m_buf[i++] = m_amplitudeBitsDC;
|
||||
m_buf[i++] = 0;
|
||||
}
|
||||
else if (m_pulseSampleCount < (3+m_pulsePatternPlaces)*m_pulseWidth) // binary pattern
|
||||
{
|
||||
uint32_t patPulseSampleCount = m_pulseSampleCount - 3*m_pulseWidth;
|
||||
uint32_t patPulseIndex = patPulseSampleCount / m_pulseWidth;
|
||||
float patFigure = (m_pulsePatternCount & (1<<patPulseIndex)) != 0 ? 0.1 : 0.0; // make binary pattern -20dB vs sync pattern
|
||||
m_buf[i++] = (int16_t) (patFigure * (float) m_amplitudeBitsI) + m_amplitudeBitsDC;
|
||||
m_buf[i++] = (int16_t) (patFigure * (float) m_phaseImbalance * m_amplitudeBitsQ);
|
||||
}
|
||||
|
||||
if (m_pulseSampleCount < (4+m_pulsePatternPlaces)*m_pulseWidth - 1)
|
||||
{
|
||||
m_pulseSampleCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_pulsePatternCount < m_pulsePatternCycle - 1) {
|
||||
m_pulsePatternCount++;
|
||||
} else {
|
||||
m_pulsePatternCount = 0;
|
||||
}
|
||||
|
||||
m_pulseSampleCount = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TestSourceSettings::ModulationNone:
|
||||
default:
|
||||
{
|
||||
|
@ -94,6 +94,11 @@ private:
|
||||
float m_amModulation;
|
||||
float m_fmDeviationUnit;
|
||||
float m_fmPhasor;
|
||||
uint32_t m_pulseWidth; //!< pulse width in number of samples
|
||||
uint32_t m_pulseSampleCount;
|
||||
uint32_t m_pulsePatternCount;
|
||||
uint32_t m_pulsePatternCycle;
|
||||
uint32_t m_pulsePatternPlaces;
|
||||
|
||||
int m_samplerate;
|
||||
unsigned int m_log2Decim;
|
||||
|
Loading…
Reference in New Issue
Block a user