Documentation
¶
Overview ¶
Package decimate wraps an sdr.Device with a systemwide pre-decimation stage: the hardware runs at a high NATIVE rate while every downstream consumer — the per-channel down-converter bank, the demodulators, the recording taps, the auto-IQ capture and the spectrum/diagnostic scopes — sees a lower, integer- decimated rate. This is the config knob sdr.input_sample_rate: run the front end faster than you decode (an Airspy pinned to 10 MS/s, or a wide capture whose useful signal is a narrow slice) without paying the native rate through the whole pipeline, and without recording multi-gigabyte native-rate files that don't match the decode rate.
The decimation is applied at the Device boundary, below every other wrapper (baseband recorder, iqtap broker) and below the pool's Reacquire, so a single insertion covers all of them: whatever streams out of Device.StreamIQ, and the rate Device.ActualSampleRate reports, is already decimated. The pre-combine diversity_capture tap lives inside the soapyremote driver, below this wrapper, so it still records the native branches (which is what a diversity A/B needs).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Device ¶
Device wraps an inner sdr.Device, presenting a stream and an ActualSampleRate() decimated by a fixed integer factor M. All non-overridden Device methods (Info, SetCenterFreq, SetGain, SetPPM, SetBiasTee, Close) are forwarded to the inner device via the embedded interface; SetSampleRate, StreamIQ, ActualSampleRate and FreqRange are overridden below.
func New ¶
New wraps inner with an integer-decimation stage of factor m. m <= 1 is a programming error (callers gate on M > 1 before wrapping); it panics so the mistake surfaces immediately rather than silently streaming at native rate.
func (*Device) ActualSampleRate ¶
ActualSampleRate reports the rate this wrapper actually DELIVERS downstream — the inner device's real (post-quantization) native rate divided by M, or the programmed output rate when the inner device does not expose an actual rate. This is what the daemon's effectiveStreamRate reads to size the down-converter bank, so it must be the decimated rate, never the native one.
func (*Device) FreqRange ¶
FreqRange forwards the inner device's tuning range when it exposes one (sdr.FreqRanger) so the whole-device hunt sweep still works through the wrapper; otherwise it reports (0,0) and callers fall back to an explicit band.
func (*Device) SetSampleRate ¶
SetSampleRate programs the inner (hardware) device at outHz * M — the native rate — and remembers outHz as the output rate this wrapper presents. Callers (the pool) pass the DECODE rate they want downstream; the hardware runs M times faster and StreamIQ decimates back down.
func (*Device) StreamIQ ¶
StreamIQ starts the inner device's native-rate stream and returns a channel of integer-decimated chunks: each native chunk is passed through a polyphase anti-alias FIR (dsp.Resampler with L=1, M=d.m) and the M:1 output is forwarded. A fresh resampler is built per stream so its filter history starts clean.