Afsk1200Decoder class final
#include <pr/afsk/decoder.hpp>
Streaming AFSK1200 decoder for PCM16 mono input.
Input samples are consumed incrementally. The decoder:
- accumulates startup samples to lock symbol phase,
- performs fixed-point Goertzel tone-energy comparison per recovered symbol,
- emits raw channel level bits (pre-NRZI, pre-HDLC deframing).
Output bits intentionally preserve modem-level information so higher layers can perform NRZI decode, flag hunting and bit destuffing without re-reading audio.
Constructors, destructors, conversion operators
- Afsk1200Decoder()
- Construct decoder with default mode (
AFSK1200) and 48 kHz setup.
Public functions
- auto mode() const -> PacketRadioMode
- Return currently configured runtime mode.
- auto pending_bits() const -> std::size_t
- Return number of queued recovered bits.
- auto pop_bit(bool* out_bit) -> bool
- Pop one recovered raw channel bit.
- void process_block(std::span<const std::int16_t> samples)
- Feed a contiguous block of PCM16 samples.
- void process_sample(std::int16_t sample)
- Feed one PCM16 sample into the streaming decode pipeline.
- auto quality_stats() const -> RxQualityStats
- Return current RX quality snapshot.
- void reset()
- Reset all runtime state and clear pending output bits.
- auto sample_rate() const -> std::uint32_t
- Return currently configured sample rate.
- auto set_mode(PacketRadioMode mode) -> bool
- Select runtime modem mode.
- auto set_sample_rate(std::uint32_t sample_rate_hz) -> bool
- Select input sample rate.
Function documentation
bool prf:: pr:: Afsk1200Decoder:: pop_bit(bool* out_bit)
Pop one recovered raw channel bit.
| Parameters | |
|---|---|
| out_bit out | Destination for popped bit. |
| Returns | true if a bit was available. |
void prf:: pr:: Afsk1200Decoder:: reset()
Reset all runtime state and clear pending output bits.
Configuration (selected mode and sample rate) is preserved.
bool prf:: pr:: Afsk1200Decoder:: set_mode(PacketRadioMode mode)
Select runtime modem mode.
| Parameters | |
|---|---|
| mode | Requested mode. |
| Returns | true if mode is supported by this decoder instance. |
Unsupported modes disable decode processing until a supported mode is set.
bool prf:: pr:: Afsk1200Decoder:: set_sample_rate(std::uint32_t sample_rate_hz)
Select input sample rate.
| Parameters | |
|---|---|
| sample_rate_hz | PCM sample rate in Hz. |
| Returns | true when supported tone coefficients are available. |
The decoder currently supports a fixed set of rates with precomputed coefficients for deterministic integer DSP.