The Open Master Hearing Aid (openMHA)
openMHA
Open community platform for hearing aid algorithm research
|
Sound data handling of io tcp library. More...
Classes | |
union | float_union |
This union helps in conversion of floats from host byte order to network byte order and back again. More... | |
Public Member Functions | |
io_tcp_sound_t (int fragsize, float samplerate) | |
Initialize sound data handling. More... | |
virtual | ~io_tcp_sound_t () |
Do-nothing destructor. More... | |
virtual void | prepare (int num_inchannels, int num_outchannels) |
Called during prepare, sets number of audio channels and allocates sound data storage. More... | |
virtual void | release () |
Called during release. More... | |
virtual int | chunkbytes_in () const |
Number of bytes that constitute one input sound chunk. More... | |
virtual std::string | header () const |
Create the tcp sound header lines. More... | |
virtual mha_wave_t * | ntoh (const std::string &data) |
Copy data received from tcp into mha_wave_t structure. More... | |
virtual std::string | hton (const mha_wave_t *s_out) |
Copy sound data from the output sound structure to a string. More... | |
Static Private Member Functions | |
static void | check_sound_data_type () |
Check if mha_real_t is a usable 32-bit floating point type. More... | |
Private Attributes | |
int | fragsize |
Number of sound samples in each channel expected and returned from processing callback. More... | |
float | samplerate |
Sampling rate. More... | |
int | num_inchannels |
Number of input channels. More... | |
int | num_outchannels |
MHASignal::waveform_t * | s_in |
Storage for input signal. More... | |
Sound data handling of io tcp library.
io_tcp_sound_t::io_tcp_sound_t | ( | int | fragsize, |
float | samplerate | ||
) |
Initialize sound data handling.
Checks sound data type by calling
fragsize | Number of sound samples in each channel expected and returned from processing callback. |
samplerate | Number of samples per second in each channel. |
|
inlinevirtual |
Do-nothing destructor.
|
staticprivate |
Check if mha_real_t is a usable 32-bit floating point type.
MHA_Error | if mha_real_t is not compatible to 32-bit float. |
|
virtual |
Called during prepare, sets number of audio channels and allocates sound data storage.
num_inchannels | Number of input audio channels. |
num_outchannels | Number of output audio channels. |
|
virtual |
Called during release.
Deletes sound data storage.
|
virtual |
Number of bytes that constitute one input sound chunk.
|
virtual |
Create the tcp sound header lines.
|
virtual |
Copy data received from tcp into mha_wave_t structure.
Doing network-to-host byte order swapping in the process.
data | One chunk ( |
|
virtual |
Copy sound data from the output sound structure to a string.
Doing host-to-network byte order swapping while at it.
s_out | Pointer to the storage of the sound to put out. |
|
private |
Number of sound samples in each channel expected and returned from processing callback.
|
private |
Sampling rate.
Number of samples per second in each channel.
|
private |
Number of input channels.
Number of channels expected from and returned by signal processing callback.
|
private |
|
private |
Storage for input signal.