The Open Master Hearing Aid (openMHA)
openMHA
Open community platform for hearing aid algorithm research
|
The doublebuffer adapts blocksizes between an outer process, which provides input data and takes output data, and an inner process, which processes the input signal and generates output data using a different block size than the outer process. More...
Public Types | |
typedef FIFO::value_type | value_type |
The datatype exchanged by the FIFO and this doublebuffer. More... | |
Public Member Functions | |
virtual unsigned | get_inner_size () const |
virtual unsigned | get_outer_size () const |
virtual unsigned | get_delay () const |
virtual unsigned | get_fifo_size () const |
virtual unsigned | get_input_channels () const |
virtual unsigned | get_output_channels () const |
virtual unsigned | get_input_fifo_fill_count () const |
virtual unsigned | get_output_fifo_fill_count () const |
virtual unsigned | get_input_fifo_space () const |
virtual unsigned | get_output_fifo_space () const |
virtual MHA_Error * | get_inner_error () const |
virtual void | provoke_inner_error (const MHA_Error &) |
virtual void | provoke_outer_error (const MHA_Error &) |
mha_dblbuf_t (unsigned outer_size, unsigned inner_size, unsigned delay, unsigned input_channels, unsigned output_channels, const value_type &delay_data) | |
Constructor creates FIFOs with specified delay. More... | |
virtual | ~mha_dblbuf_t () |
virtual void | process (const value_type *input_signal, value_type *output_signal, unsigned count) |
The outer process has to call this method to propagate the input signal to the inner process, and receives back the output signal. More... | |
virtual void | input (value_type *input_signal) |
The inner process has to call this method to receive its input signal. More... | |
virtual void | output (const value_type *output_signal) |
The outer process has to call this method to deliver its output signal. More... | |
Private Attributes | |
unsigned | outer_size |
The block size used by the outer process. More... | |
unsigned | inner_size |
The block size used by the inner process. More... | |
unsigned | delay |
The delay introduced by bidirectional buffer size adaptation. More... | |
unsigned | fifo_size |
The size of each of the FIFOs. More... | |
unsigned | input_channels |
The number of input channels. More... | |
unsigned | output_channels |
The number of output channels. More... | |
FIFO | input_fifo |
The FIFO for transporting the input signal from the outer process to the inner process. More... | |
FIFO | output_fifo |
The FIFO for transporting the output signal from the inner process to the outer process. More... | |
MHA_Error * | inner_error |
Owned copy of exception to be thrown in inner thread. More... | |
MHA_Error * | outer_error |
Owned copy of exception to be thrown in outer thread. More... | |
The doublebuffer adapts blocksizes between an outer process, which provides input data and takes output data, and an inner process, which processes the input signal and generates output data using a different block size than the outer process.
This class introduces the channels concept. Input and output may have different channel counts.
typedef FIFO::value_type mha_dblbuf_t< FIFO >::value_type |
The datatype exchanged by the FIFO and this doublebuffer.
mha_dblbuf_t< FIFO >::mha_dblbuf_t | ( | unsigned | outer_size, |
unsigned | inner_size, | ||
unsigned | delay, | ||
unsigned | input_channels, | ||
unsigned | output_channels, | ||
const value_type & | delay_data | ||
) |
Constructor creates FIFOs with specified delay.
.
outer_size | The block size used by the outer process. |
inner_size | The block size used by the inner process. |
delay | The total delay |
input_channels | Number of input channels |
output_channels | Number of output channels |
delay_data | The delay consists of copies of this value. |
|
virtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
virtual |
|
virtual |
|
virtual |
The outer process has to call this method to propagate the input signal to the inner process, and receives back the output signal.
input_signal | Pointer to the input signal array. |
output_signal | Pointer to the output signal array. |
count | The number of data instances provided and expected, lower or equal to inner_size given to constructor. |
MHA_Error | When count is > outer_size as given to constructor or the underlying fifo implementation detects an error. |
|
virtual |
The inner process has to call this method to receive its input signal.
input_signal | Array where the doublebuffer can store the signal. |
MHA_Error | When the underlying fifo implementation detects an error. |
|
virtual |
The outer process has to call this method to deliver its output signal.
output_signal | Array from which doublebuffer reads outputsignal. |
MHA_Error | When the underlying fifo implementation detects an error. |
|
private |
The block size used by the outer process.
|
private |
The block size used by the inner process.
|
private |
The delay introduced by bidirectional buffer size adaptation.
|
private |
The size of each of the FIFOs.
|
private |
The number of input channels.
|
private |
The number of output channels.
|
private |
The FIFO for transporting the input signal from the outer process to the inner process.
|
private |
The FIFO for transporting the output signal from the inner process to the outer process.
|
private |
Owned copy of exception to be thrown in inner thread.
|
private |
Owned copy of exception to be thrown in outer thread.