A class that does polyphase resampling and takes into account block processing.
More...
A class that does polyphase resampling and takes into account block processing.
◆ blockprocessing_polyphase_resampling_t()
MHAFilter::blockprocessing_polyphase_resampling_t::blockprocessing_polyphase_resampling_t |
( |
float |
source_srate, |
|
|
unsigned |
source_fragsize, |
|
|
float |
target_srate, |
|
|
unsigned |
target_fragsize, |
|
|
float |
nyquist_ratio, |
|
|
float |
irslen, |
|
|
unsigned |
nchannels, |
|
|
bool |
add_delay |
|
) |
| |
Contructs a polyphase resampling filter that can be used for blockprocessing with the given parameters.
- Parameters
-
source_srate | Source sampling rate / Hz |
source_fragsize | Fragment size of incoming audio blocks / frames at source_srate |
target_srate | Target sampling rate / Hz |
target_fragsize | Fragment size of produced audio blocks / frames at target_srate |
nyquist_ratio | Low pass filter cutoff frequency relative to the nyquist frequency of the smaller of the two sampling rates. Example values: 0.8, 0.9 |
irslen | Impulse response length used for low pass filtering / s |
nchannels | Number of audio channels |
add_delay | To avoid underruns, a delay is generally necessary for round trip block size adaptations. It is only necessary to add this delay to one of the two resampling chains. Set this parameter to true for the first resampling object of a round trip pair. It will add the necessary delay, and calculate the size of the ring buffer appropriately, When set to false, only the ringbuffer size will be set sufficiently. |
◆ ~blockprocessing_polyphase_resampling_t()
virtual MHAFilter::blockprocessing_polyphase_resampling_t::~blockprocessing_polyphase_resampling_t |
( |
| ) |
|
|
inlinevirtual |
◆ write()
void MHAFilter::blockprocessing_polyphase_resampling_t::write |
( |
mha_wave_t & |
signal | ) |
|
Write signal to the ringbuffer.
- Parameters
-
signal | input signal in original sampling rate |
- Exceptions
-
MHA_Error | Raises exception if there is not enough room, if the number of channels does not match, or if the number of frames is not equal to the number specified in the constructor |
◆ read()
void MHAFilter::blockprocessing_polyphase_resampling_t::read |
( |
mha_wave_t & |
signal | ) |
|
Read resampled signal.
Will perform the resampling and remove no longer needed samples from the input buffer.
- Parameters
-
signal | buffer to write the resampled signal to. |
- Exceptions
-
MHA_Error | Raises exception if there is not enough input signal, if the number of channels of frames does not match. |
◆ can_read()
bool MHAFilter::blockprocessing_polyphase_resampling_t::can_read |
( |
| ) |
const |
|
inline |
Checks if the resampling ring buffer can produce another output signal block.
◆ resampling
◆ fragsize_in
unsigned MHAFilter::blockprocessing_polyphase_resampling_t::fragsize_in |
|
private |
◆ fragsize_out
unsigned MHAFilter::blockprocessing_polyphase_resampling_t::fragsize_out |
|
private |
◆ num_channels
unsigned MHAFilter::blockprocessing_polyphase_resampling_t::num_channels |
|
private |
The documentation for this class was generated from the following files: