libsdr  0.1.0
A simple SDR library
Public Member Functions | Protected Attributes | List of all members
sdr::InpolSubSampler< iScalar, oScalar > Class Template Reference

An interpolating sub-sampler. More...

#include <subsample.hh>

Inheritance diagram for sdr::InpolSubSampler< iScalar, oScalar >:
sdr::Sink< iScalar > sdr::Source sdr::SinkBase

Public Member Functions

 InpolSubSampler (float frac)
 Constructor. More...
 
virtual ~InpolSubSampler ()
 Destructor. More...
 
virtual void config (const Config &src_cfg)
 Configures the sub-sampling node. More...
 
virtual void process (const Buffer< iScalar > &buffer, bool allow_overwrite)
 Performs the sub-sampling. More...
 
- Public Member Functions inherited from sdr::Sink< iScalar >
 Sink ()
 Constructor. More...
 
virtual ~Sink ()
 Drestructor. More...
 
virtual void handleBuffer (const RawBuffer &buffer, bool allow_overwrite)
 Re-implemented from SinkBase. More...
 
- Public Member Functions inherited from sdr::SinkBase
 SinkBase ()
 Constructor. More...
 
virtual ~SinkBase ()
 Destructor. More...
 
- Public Member Functions inherited from sdr::Source
 Source ()
 Constructor. More...
 
virtual ~Source ()
 Destructor. More...
 
virtual void send (const RawBuffer &buffer, bool allow_overwrite=false)
 Sends the given buffer to all connected sinks. More...
 
void connect (SinkBase *sink, bool direct=false)
 Connect this source to a sink. More...
 
void disconnect (SinkBase *sink)
 Disconnect a sink again. More...
 
virtual void setConfig (const Config &config)
 Stores the configuration and propergates it if the configuration has been changed. More...
 
virtual double sampleRate () const
 Returns the configured sample rate or 0 otherwise. More...
 
virtual Config::Type type () const
 Returns the configured source type or Config::Type_UNDEFINED otherwise. More...
 
template<class T >
void addEOS (T *instance, void(T::*function)())
 Adds a callback to the end-of-stream signal of the source. More...
 

Protected Attributes

float _frac
 The sub-sampling fraction. More...
 
float _mu
 The current (fractional) sample count. More...
 
Buffer< oScalar > _dl
 A delay-line (buffer) for the interpolation. More...
 
size_t _dl_idx
 Index of the delay-line. More...
 
Buffer< oScalar > _buffer
 The output buffer. More...
 
- Protected Attributes inherited from sdr::Source
Config _config
 Holds the source configuration, this can be updated by calling setConfig. More...
 
std::map< SinkBase *, bool > _sinks
 The connected sinks. More...
 
std::list< DelegateInterface * > _eos
 The connected EOS singal handlers. More...
 

Additional Inherited Members

- Protected Member Functions inherited from sdr::Source
void signalEOS ()
 Signals the EOS. More...
 
void propagateConfig (const Config &config)
 Propagates the given configuration to all connected sinks. More...
 

Detailed Description

template<class iScalar, class oScalar = iScalar>
class sdr::InpolSubSampler< iScalar, oScalar >

An interpolating sub-sampler.

This node uses an 8-tap FIR filter to interpolate between two values (given 8). Please do not use this node to subsample by a factor grater than 8, as this may result into artifacts unless the signal was filtered accordingly before subsampling it.

Constructor & Destructor Documentation

template<class iScalar , class oScalar = iScalar>
sdr::InpolSubSampler< iScalar, oScalar >::InpolSubSampler ( float  frac)
inline

Constructor.

Parameters
fracSpecifies the sub-sampling fraction. I.e. frac=2 will result into half the input sample-rate.
template<class iScalar , class oScalar = iScalar>
virtual sdr::InpolSubSampler< iScalar, oScalar >::~InpolSubSampler ( )
inlinevirtual

Destructor.

Member Function Documentation

template<class iScalar , class oScalar = iScalar>
virtual void sdr::InpolSubSampler< iScalar, oScalar >::config ( const Config src_cfg)
inlinevirtual

Configures the sub-sampling node.

Implements sdr::SinkBase.

template<class iScalar , class oScalar = iScalar>
virtual void sdr::InpolSubSampler< iScalar, oScalar >::process ( const Buffer< iScalar > &  buffer,
bool  allow_overwrite 
)
inlinevirtual

Performs the sub-sampling.

Implements sdr::Sink< iScalar >.

Member Data Documentation

template<class iScalar , class oScalar = iScalar>
Buffer<oScalar> sdr::InpolSubSampler< iScalar, oScalar >::_buffer
protected

The output buffer.

template<class iScalar , class oScalar = iScalar>
Buffer<oScalar> sdr::InpolSubSampler< iScalar, oScalar >::_dl
protected

A delay-line (buffer) for the interpolation.

template<class iScalar , class oScalar = iScalar>
size_t sdr::InpolSubSampler< iScalar, oScalar >::_dl_idx
protected

Index of the delay-line.

template<class iScalar , class oScalar = iScalar>
float sdr::InpolSubSampler< iScalar, oScalar >::_frac
protected

The sub-sampling fraction.

template<class iScalar , class oScalar = iScalar>
float sdr::InpolSubSampler< iScalar, oScalar >::_mu
protected

The current (fractional) sample count.


The documentation for this class was generated from the following file: