Explicitly delete the copy constructor and copy assignment operator for
FilterStage to prevent accidental duplication of its filter state.
Copying a filter stage could duplicate internal processing state and
resource references, potentially causing incorrect channelization behavior
or resource-management problems.
Since FilterStage is not intended to be copied or assigned, prohibit
both operations at compile time.
cppcheck identified the missing copy constructor and assignment operator
with its noCopyConstructor and noOperatorEq warnings.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Explicitly delete the copy constructor and copy assignment operator for
IIRFilter to prevent accidental duplication of filter state.
Copying an IIRFilter instance could duplicate internal filter state and
coefficient references, potentially causing incorrect processing or
resource-management problems.
Since IIRFilter is not intended to be copied or assigned, prohibit both
operations at compile time.
cppcheck identified the missing copy constructor and assignment operator
with its noCopyConstructor and noOperatorEq warnings.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Explicitly delete the copy constructor and copy assignment operator for
FFTNoiseReduction to prevent accidental duplication of its noise-reduction
state.
Copying an FFTNoiseReduction instance could duplicate internal processing
state or resource references, potentially causing incorrect behavior or
resource-management problems.
Since FFTNoiseReduction is not intended to be copied or assigned,
prohibit both operations at compile time.
cppcheck identified the missing copy constructor and assignment operator
with its noCopyConstructor and noOperatorEq warnings.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Explicitly delete the copy constructor and copy assignment operator for
sfft to prevent accidental duplication of FFT processing state.
Copying an FFT instance could duplicate internal state or resource
references, potentially causing incorrect processing or resource-management
problems.
Since sfft is not intended to be copied or assigned, prohibit both
operations at compile time.
cppcheck identified the missing copy constructor and assignment operator
with its noCopyConstructor and noOperatorEq warnings.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Explicitly delete the copy constructor and copy assignment operator for
FilterStage to prevent accidental duplication of its filter state.
Copying a filter stage could duplicate internal processing state and
resources, potentially causing incorrect channelization behavior or
resource-management problems.
Since FilterStage is not intended to be copied or assigned, prohibit
both operations at compile time.
cppcheck identified the missing copy constructor and assignment operator
with its noCopyConstructor and noOperatorEq warnings.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Explicitly delete the copy constructor and copy assignment operator for
CTCSSDetector to prevent accidental duplication of its detector state.
Copying could duplicate internal detection state and coefficients, leading
to unintended behavior if instances are expected to maintain independent
processing state.
Since CTCSSDetector is not intended to be copied or assigned, prohibit
both operations at compile time.
cppcheck identified the missing copy constructor and assignment operator
with its noCopyConstructor and noOperatorEq warnings.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Explicitly delete the copy constructor and copy assignment operator for
AFSquelch to prevent accidental duplication of its DSP state.
The implicitly generated copy operations could duplicate internal filter
state and coefficients, potentially causing unintended behavior if the
instances are expected to maintain independent processing state.
Since AFSquelch is not intended to be copied or assigned, prohibit both
operations at compile time.
cppcheck identified the missing copy constructor and assignment operator
with its noCopyConstructor and noOperatorEq warnings.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
MessageQueue::pop() transfers ownership of the popped message to the
caller, but many handleInputMessages() implementations only deleted
the message when handleMessage() returned true. When a message was not
handled, ownership had already been transferred from the queue and the
message was leaked.
This was identified while investigating an ASAN leak in the audio
subsystem.
Update the applicable handleInputMessages() implementations to always
delete messages after handleMessage() returns. Unhandled messages are
also logged with the component and message identifier so unexpected
message routing is visible during debugging.
This change:
- Ensures every message popped from a queue has its ownership resolved.
- Prevents leaks when handleMessage() returns false.
- Makes unhandled messages visible instead of silently discarding them.
- Preserves the existing message handling logic and does not require
components to handle message types that are legitimately irrelevant
to them.
The changes are intentionally mechanical and limited to the common
message queue ownership and diagnostic pattern.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the MIMO type so DeviceSampleMIMO starts with a defined mode
before a derived device configures its specific synchronization behavior.
Found by Coverity (UNINIT_CTOR).
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the noise reduction configuration members in all fftfilt
constructors so they have defined values before noise reduction processing
uses them. This prevents undefined behavior and ensures consistent default
configuration regardless of which constructor is used.
Found by cppcheck (uninitMemberVar).
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize FFTNoiseReduction magnitude state and ExponentialFilter previous
value so noise reduction calculations start from defined values. This
prevents undefined behavior from using uninitialized state during filtering.
Found by cppcheck (uninitMemberVar).
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the sample shift member so file recording starts with a defined
shift value before it is used. This prevents undefined behavior from
accessing an uninitialized member.
Found by cppcheck (uninitMemberVar).
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the GUI message queue pointer so FileRecordInterface starts with
a defined value before the GUI queue is assigned.
Found by Coverity (UNINIT_CTOR).
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the default kissfft constructor members so a default-constructed
instance has a defined FFT size and direction before they are accessed.
This prevents undefined behavior from using uninitialized member variables.
Found by cppcheck (uninitMemberVar).
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize MorseDemod state and message queue members so a newly constructed
demodulator has defined values before identification and bit timing
processing begins. This prevents undefined behavior from accessing
uninitialized member variables.
Found by cppcheck (uninitMemberVar).
Signed-off-by: Robin Getz <rgetz503@gmail.com>
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>
Initialize the previous projected value so the first calculation has a
defined starting state rather than depending on whatever value happens to
be in the member.
Found by cppcheck (uninitMemberVar).
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the replay loop flag so a newly created buffer has a defined
playback mode before the buffer is used. This avoids undefined behavior
from evaluating an uninitialized member.
Found by cppcheck (uninitMemberVar).
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the FIFO sizing, guard, position, and read/write tracking members
so the default constructor establishes a complete and predictable state.
This avoids undefined behavior if the FIFO is accessed before being fully
configured.
Found by cppcheck (uninitMemberVar).
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the FIFO sizing, guard, midpoint, and read/write tracking
members so the default constructor leaves the object in a defined state.
This ensures FIFO state is valid even if the object is accessed before
explicit configuration.
Found by cppcheck (uninitMemberVar).
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the conversion buffer size so a default-constructed
ConvertBuffers instance has a defined size before the value is used.
This avoids undefined behavior from reading an uninitialized member.
Found by cppcheck (uninitMemberVar).
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Add parentheses around the nested ternary expressions used when clamping
histogram and waterfall marker counts. This makes the intended evaluation
order explicit and avoids ambiguity in static analysis of the conditional
expressions.
Found by cppcheck.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the sample shift member so WAV recording starts with a defined
shift value before it is used. This avoids undefined behavior from reading
an uninitialized member.
Found by cppcheck (uninitMemberVar).
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Support WAV recordings larger than 4 GiB by using the RF64 format and
storing 64-bit RIFF and data sizes in the ds64 chunk. Reserve space for
the ds64 chunk in the initial header and convert the file to RF64 when
the RIFF or data chunk exceeds the 32-bit WAV size limit.
Update header parsing to handle RF64, ds64, JUNK, variable-size fmt and
auxi chunks, and unknown chunks. Generate standard RF64 headers that
can be read by other RF64-compatible audio applications.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Removing a channel's sink or source from a device engine was a queued
message, so a channel could be deleted while the engine thread was
still feeding it. When the caller is deleting, the removal now runs on
the engine thread and is waited for, provided that thread is running
and is not the caller. The MIMO engine gains the same deleting flag and
does the same for its MIMO channels.
ScopeVis and GLScope now attach and detach under the vis mutex and each
clears the other on destruction, as SpectrumVis and GLSpectrum already
do, so a scope window closing while its channel is still running no
longer leaves a dangling pointer on either side.
Also drops an unused variable in GLSpectrumView::paintGL.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
GET .../spectrum/history reads the history the spectrum display keeps
for scrolling and reports, over the last seconds and a frequency range
reduced to bins, the per bin maximum, mean and occupancy against a
floor taken as the median of the per bin means, and the signals: each
run of bins above the threshold with its frequency, width, peak, duty
cycle and first and last seen. GET .../spectrum/history/image renders
the same history as a greyscale PNG with its extents in headers.
GLSpectrumInterface gains getSpectrumHistory, which GLSpectrumView
answers from its scroll buffer under its mutex, folding consecutive
rows together by maximum so that at most the rows asked for span the
whole period, since every FFT is a row. Rows taken at another centre or
rate are skipped and counted.
SpectrumVis reads the display while holding its mutex, so the display
is now attached and detached under it, and each side clears the other
on destruction.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Server side for the spectrum paths added to the spec: GET spectrum/report
returns whichever measurement is switched on, POST spectrum/actions
carries autoscale, clearSpectrum, resetMeasurements, freeze and
gotoMarker, and GET spectrum/data returns the power values reduced to a
number of bins. The display actions reach the spectrum through new
GLSpectrumInterface methods that default to doing nothing, so an instance
without a GUI ignores them rather than every caller having to know.
The measurement results are kept as plain values behind a lock and
published once per displayed frame, so a report costs nothing until one is
asked for, and the figures match what is on screen.
Also completes the main spectrum settings, which were only partly carried
over the API, and adds reports that had no way to be read at all: vessels
for AIS, stations for APRS, sondes for Radiosonde, the programme list for
DAB, the RDS programme service name for BFM, and validity flags for the
ADS-B aircraft report so a caller can tell a missing position from one at
zero. Map settings are exposed through their generated setters.
Two fixes found while testing: the frequency scanner dropped the frequency
list because the API calls it "frequencies" and everything downstream
keys it as "frequencySettings", and the spectrum adapters bound a
reference to the error message before init() had allocated one, so every
error path returned no response at all.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
DSPDeviceSinkEngine::setState() updates m_state while state() and
external users of the engine read the same variable. These accesses can
occur from different threads without atomic synchronization.
Make m_state an atomic State to eliminate the data race identified by
ThreadSanitizer.
This prevents callers from observing an unsynchronized DSP device sink
engine state while the engine transitions between states.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
FIFO overflows can occur repeatedly when a consumer cannot keep up with
the incoming data rate. Logging every overflow can flood the application
logs and obscure other messages, while providing little additional
information about the underlying problem.
Rate-limit overflow messages from DataFifo and SampleSinkFifo while
continuing to report every overflow through the SampleSinkFifo signal.
Accumulate the number of dropped samples and overflow events during the
suppression interval and report them as a single aggregate message.
After reporting the aggregate, require a quiet recovery interval before
resuming immediate overflow reporting. This limits log volume while
retaining useful information about the severity and duration of FIFO
overruns.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
The DataFifo and SampleSinkFifo write() overloads contained nearly identical
overflow handling code. This made the behavior harder to maintain and meant
changes to overflow reporting would need to be made in multiple places.
Move the common overflow logging and rate-limiting behavior into dedicated
helper functions so both write() paths use the same implementation.
Also include the FIFO size in all DataFifo overflow messages to provide more
useful diagnostics and make the messages consistent between the two write()
overloads.
No functional changes to FIFO handling, suppression, or overflow signaling;
the only observable change is the overflow message format.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Add DSPAcquisitionError and DSPGenerationError messages to provide a
standard mechanism for SDRangel devices to report asynchronous errors
to their DSP device engines.
These errors occur after normal device initialization or startup and are
not the result of a synchronous start or configuration operation. They
cover conditions such as a device being unplugged or disconnected, a
device becoming unavailable, or an error occurring while acquiring or
generating samples.
Handle DSPAcquisitionError in the DSPDeviceSourceEngine and the
acquisition side of DSPDeviceMIMOEngine, and handle DSPGenerationError
in the DSPDeviceSinkEngine and the generation side of
DSPDeviceMIMOEngine. Transition the affected device engine to the error
state and propagate the device-provided error message.
This allows asynchronous failures in a sample source, sample sink, or
MIMO device to be propagated through the SDRangel device engine state
machine instead of leaving the device engine running after the device
has become unavailable or encountered an unrecoverable error.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Move the existing empty-trigger check ahead of the access to the
current trigger condition. The previous code indexed
m_triggerConditions before verifying that the container was non-empty,
which could result in an out-of-bounds access.
No functional behavior is changed for the non-empty case.
noticed by cppcheck : Access out of bounds
Signed-off-by: Robin Getz <rgetz503@gmail.com>
cppcheck reported that GLScopeSettings::operator=() did not assign the
m_freerun member variable.
m_freerun is part of the GLScope configuration state: it is initialized
in resetToDefaults(), and is persisted through serialize()/deserialize().
However, when a GLScopeSettings object was copied using the assignment
operator, the freerun state was not transferred from the source object.
This could result in two GLScopeSettings instances having different
freerun values after assignment, with the destination object retaining
its previous value instead of matching the source object.
Add the missing m_freerun assignment to ensure operator=() performs a
complete copy of the settings state and matches the existing
serialization behavior.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Added optional scrollbar to be able to scroll back through waterfall.
When scrolling is enabled:
Can adjust power scale for complete waterfall, not just future spectra.
Waterfall time axis can use local time or UTC.
Waterfall not lost when resizing window.
Can now zoom when device is stopped.
Added Min averaging type.
Added button to load spectrum from .csv file.
Add button to save spectrum/waterfall to .png or jpg.
Changed show all controls button to a combobox with choices of Min/Std/All (Minimum/Standard/All).
Changed some buttons in spectrum GUI from QPushButton to QToolButton so their size matches the others.
Fix spectrum from displaying a mixture of old and new spectrums (m_currentSpectrum was a pointer to SpectrumVis buffer).
Added M1 and M2 memories to allow display of reference spectra.
Added math operations to allow spectrum to be difference of current spectrum and either memory or a moving average.
Fixed measurement counts, so they are performed once per spectrum, not on displayed spectra.
Added spectrum mask measurement, to check when a spectrum exceeds mask held in M1 or M2.
Optionally display power/frequency under cursor in status line.
Optionally display peak power/frequency in status line.
Fix incorrect nyquist sample replication, when zoom used.
Fix cursor not changing from resize to pointer when moving over spectrum measurements window.
Add spectrum colour setting.