Browse Source

nco : Initialize oscillator state

Initialize the NCO phase, increment, LFSR, and dithering state so the
oscillator begins from defined values before generating samples. This
avoids undefined behavior from reading uninitialized member variables.

Found by cppcheck (uninitMemberVar).

Signed-off-by: Robin Getz <rgetz503@gmail.com>
chirpmodem-v8.0.0
Robin Getz 2 months ago
parent
commit
6004191d11
No known key found for this signature in database
GPG Key ID: 51C7231FFED0E060
  1. 7
      sdrbase/dsp/nco.cpp

7
sdrbase/dsp/nco.cpp

@ -38,7 +38,12 @@ void NCO::initTable() @@ -38,7 +38,12 @@ void NCO::initTable()
m_tableInitialized = true;
}
NCO::NCO()
NCO::NCO() :
m_phaseIncrement(0),
m_phase(0),
m_phaseDithered(0),
m_lfsr(0),
m_ditherMask(0)
{
initTable();
m_phase = 0;

Loading…
Cancel
Save