Struct sameold::SameReceiver
source · [−]pub struct SameReceiver { /* private fields */ }Expand description
A complete SAME/EAS receiver chain
The receive chain takes f32 audio samples and
performs the following operations:
- Automatic gain control
- Demodulation and down-sampling to two samples per symbol, governed by a zero-crossing detector timing recovery loop.
- Access code correlation and squelch. The code correlator also synchronizes to byte boundaries.
- (Optional) Adaptive decision feedback equalization
- Framing and message decoding
To create the receiver, first create its Builder:
use sameold::SameReceiverBuilder;
let mut builder = SameReceiverBuilder::default();
let receiver = builder.build();
assert_eq!(receiver.input_rate(), 22050);Once created, use the
iter_messages()
method to obtain decoded messages.
See module documentation for details.
Implementations
sourceimpl SameReceiver
impl SameReceiver
sourcepub fn iter_frames<'rx, I, T>(
&'rx mut self,
input: I
) -> SourceIterFrames<'rx, T>ⓘNotable traits for SourceIterFrames<'rx, I>impl<'rx, 'data, I> Iterator for SourceIterFrames<'rx, I> where
I: Iterator<Item = f32>, type Item = FrameOut; where
I: IntoIterator<Item = f32> + IntoIterator<IntoIter = T>,
T: Iterator<Item = f32>,
pub fn iter_frames<'rx, I, T>(
&'rx mut self,
input: I
) -> SourceIterFrames<'rx, T>ⓘNotable traits for SourceIterFrames<'rx, I>impl<'rx, 'data, I> Iterator for SourceIterFrames<'rx, I> where
I: Iterator<Item = f32>, type Item = FrameOut; where
I: IntoIterator<Item = f32> + IntoIterator<IntoIter = T>,
T: Iterator<Item = f32>,
I: Iterator<Item = f32>, type Item = FrameOut;
Decode events and messages from a source of audio
Bind an iterator which will consume the input and
produce SAME FrameOut events, which include:
- notifications about acquired and dropped carrier,
- attempts to frame messages; and
- successful framed messages
The input must be f32 PCM mono audio at
the input_rate() for this
receiver. Sound cards commonly output audio samples
in i16 format. You must perform the conversion to
floating-point yourself, if needed. It is unnecessary
to scale the converted values; our AGC algorithm will
take care of that.
The iterator will consume as many samples of input
that are required to produce the next event. It will
return None if the input is exhausted and there
are no new events.
You can use iter_messages()
instead if you are only interested in successful
decodes.
sourcepub fn iter_messages<'rx, I, T>(
&'rx mut self,
input: I
) -> SourceIterMsg<'rx, T> where
I: IntoIterator<Item = f32> + IntoIterator<IntoIter = T>,
T: Iterator<Item = f32>,
pub fn iter_messages<'rx, I, T>(
&'rx mut self,
input: I
) -> SourceIterMsg<'rx, T> where
I: IntoIterator<Item = f32> + IntoIterator<IntoIter = T>,
T: Iterator<Item = f32>,
Receive SAME messages from a source of audio
Bind an iterator which will consume the input and
produce SAME Message events. Only
successfully-decoded messages are reported. Other
events, such as acquisition of signal or decoding
failures, are not reported. If you are interested in
these events, use
iter_frames() instead.
The input must be f32 PCM mono audio at
the input_rate() for this
receiver. Sound cards commonly output audio samples
in i16 format. You must perform the conversion to
floating-point yourself, if needed. It is unnecessary
to scale the converted values; our AGC algorithm will
take care of that.
The iterator will consume as many samples of input
that are required to produce the next message. It will
return None if the input is exhausted and there
are no new messages.
sourcepub fn input_rate(&self) -> u32
pub fn input_rate(&self) -> u32
Input sampling rate
Returns sampling rate expected by the
process() method.
sourcepub fn input_sample_counter(&self) -> u64
pub fn input_sample_counter(&self) -> u64
Lifetime total input sample counter
Reports the lifetime total of input samples which have been processed.
sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Clear all DSP states and reset to zero initial conditions
All buffers and states are cleared.
sourcepub fn flush(&mut self) -> Option<Message>
pub fn flush(&mut self) -> Option<Message>
Flush the DSP buffers and emit any leftover messages
The DSP algorithms impose delay on the input. When
processing recorded audio that has been “close cut”
to the extents of a message, the SameReceiver might
not emit the message. This is because not all of the
data samples from the file have made their way through
the entire system.
This method flushes the input with an adequate number
of zeros to ensure all buffered samples have been
processed. Returns the last Message generated, if
any.
You probably want to reset() after
calling this method.
Trait Implementations
sourceimpl Clone for SameReceiver
impl Clone for SameReceiver
sourcefn clone(&self) -> SameReceiver
fn clone(&self) -> SameReceiver
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for SameReceiver
impl Debug for SameReceiver
sourceimpl From<&'_ SameReceiverBuilder> for SameReceiver
impl From<&'_ SameReceiverBuilder> for SameReceiver
sourcefn from(cfg: &SameReceiverBuilder) -> Self
fn from(cfg: &SameReceiverBuilder) -> Self
Create the SAME Receiver from its Builder
Auto Trait Implementations
impl RefUnwindSafe for SameReceiver
impl Send for SameReceiver
impl Sync for SameReceiver
impl Unpin for SameReceiver
impl UnwindSafe for SameReceiver
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct self from the equivalent element of its
superset. Read more
fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if self is actually part of its subset T (and can be converted to it).
fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset but without any property checks. Always succeeds.
fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts self to the equivalent element of its superset.