The Open Master Hearing Aid (openMHA)
openMHA
Open community platform for hearing aid algorithm research
|
A delay-line class. More...
Public Member Functions | |
Delay (F samples, F f_design, F fs) | |
Create a signal delay object. More... | |
~Delay () | |
F | process (const F &in_sample) |
Apply delay to signal. More... | |
Private Attributes | |
unsigned | m_fullsamples |
Integer part of delay. More... | |
F | m_coeff |
coefficient for 1st order IIR lowpass filter which does the subsample delay More... | |
F | 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... | |
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.
ADM::Delay< F >::Delay | ( | F | samples, |
F | f_design, | ||
F | fs | ||
) |
Create a signal delay object.
samples | number of samples to delay (may be non-integer) |
f_design | design frequency (in Hz). Subsampledelay is exact for this frequency and approximate for different frequencies |
fs | sampling frequency (in Hz). |
ADM::Delay< F >::~Delay |
|
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).
in_sample | The current input signal sample |
|
private |
Integer part of delay.
|
private |
coefficient for 1st order IIR lowpass filter which does the subsample delay
|
private |
normalization for the IIR subsample delay filter
|
private |
Ringbuffer: Delayline.
|
private |
current position for inserting new samples into m_state ringbuffer