The Open Master Hearing Aid (openMHA)  openMHA
Open community platform for hearing aid algorithm research
ADM::Delay< F > Class Template Reference

A delay-line class. More...

Public Member Functions

 Delay (F samples, F f_design, F fs)
 Create a signal delay object. More...
 
 ~Delay ()
 
process (const F &in_sample)
 Apply delay to signal. More...
 

Private Attributes

unsigned m_fullsamples
 Integer part of delay. More...
 
m_coeff
 coefficient for 1st order IIR lowpass filter which does the subsample delay More...
 
m_norm
 normalization for the IIR subsample delay filter More...
 
F * m_state
 Ringbuffer: Delayline. More...
 
unsigned m_now_in
 current position for inserting new samples into m_state ringbuffer More...
 

Detailed Description

template<class F>
class ADM::Delay< F >

A delay-line class.

It can delay samples in a single audio channel. It stores samples while they are delayed until they have reached their target delay. It can also do subsample-delays for a limited frequency range below fs/4.

Constructor & Destructor Documentation

◆ Delay()

template<class F >
ADM::Delay< F >::Delay ( samples,
f_design,
fs 
)

Create a signal delay object.

Parameters
samplesnumber of samples to delay (may be non-integer)
f_designdesign frequency (in Hz). Subsampledelay is exact for this frequency and approximate for different frequencies
fssampling frequency (in Hz).

◆ ~Delay()

template<class F >
ADM::Delay< F >::~Delay

Member Function Documentation

◆ process()

template<class F >
F ADM::Delay< F >::process ( const F &  in_sample)
inline

Apply delay to signal.

Whenever a new audio sample enters the delay line, a previous audio sample, now delayed, is returned by this method. Sub-sample-delays are implemented by applying a first-order recursive lowpass filter. This method needs to be called repeatedly, once for each incoming audio sample in correct order for a block of audio with multiple samples (oldest first, newest last).

Parameters
in_sampleThe current input signal sample
Returns
The output sample, which is one of the previously received input samples except for the sub-sample delay.

Member Data Documentation

◆ m_fullsamples

template<class F >
unsigned ADM::Delay< F >::m_fullsamples
private

Integer part of delay.

◆ m_coeff

template<class F >
F ADM::Delay< F >::m_coeff
private

coefficient for 1st order IIR lowpass filter which does the subsample delay

◆ m_norm

template<class F >
F ADM::Delay< F >::m_norm
private

normalization for the IIR subsample delay filter

◆ m_state

template<class F >
F* ADM::Delay< F >::m_state
private

Ringbuffer: Delayline.

◆ m_now_in

template<class F >
unsigned ADM::Delay< F >::m_now_in
private

current position for inserting new samples into m_state ringbuffer


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