The Open Master Hearing Aid (openMHA)  openMHA
Open community platform for hearing aid algorithm research
io_tcp_t Class Reference

The tcp sound io library. More...

Public Member Functions

 io_tcp_t (int fragsize, float samplerate, IOProcessEvent_t proc_event, void *proc_handle, IOStartedEvent_t start_event, void *start_handle, IOStoppedEvent_t stop_event, void *stop_handle)
 
void prepare (int num_inchannels, int num_outchannels)
 Allocate server socket and start thread waiting for sound data exchange. More...
 
void start ()
 Call frameworks start callback if there is a sound data connection at the moment. More...
 
void stop ()
 Close the current connection if there is one. More...
 
void release ()
 Close the current connection and close the server socket. More...
 
virtual void accept_loop ()
 IO thread executes this method. More...
 
virtual void connection_loop (MHA_TCP::Connection *c)
 IO thread executes this method for each connection. More...
 
virtual void parse (const char *cmd, char *retval, unsigned int len)
 Parser interface. More...
 
virtual ~io_tcp_t ()
 

Private Attributes

io_tcp_parser_t parser
 
io_tcp_sound_t sound
 
io_tcp_fwcb_t fwcb
 
MHA_TCP::Serverserver
 
MHA_TCP::Threadthread
 
MHA_TCP::Async_Notify notify_start
 
MHA_TCP::Async_Notify notify_stop
 
MHA_TCP::Async_Notify notify_release
 

Detailed Description

The tcp sound io library.

Constructor & Destructor Documentation

◆ io_tcp_t()

io_tcp_t::io_tcp_t ( int  fragsize,
float  samplerate,
IOProcessEvent_t  proc_event,
void *  proc_handle,
IOStartedEvent_t  start_event,
void *  start_handle,
IOStoppedEvent_t  stop_event,
void *  stop_handle 
)

◆ ~io_tcp_t()

virtual io_tcp_t::~io_tcp_t ( )
inlinevirtual

Member Function Documentation

◆ prepare()

void io_tcp_t::prepare ( int  num_inchannels,
int  num_outchannels 
)

Allocate server socket and start thread waiting for sound data exchange.

prepare opens the tcp server socket and starts the io thread that listens for audio data on the tcp socket after doing some sanity checks

◆ start()

void io_tcp_t::start ( )

Call frameworks start callback if there is a sound data connection at the moment.

◆ stop()

void io_tcp_t::stop ( )

Close the current connection if there is one.

stop IO thread

◆ release()

void io_tcp_t::release ( void  )

Close the current connection and close the server socket.

Stop IO thread and close server socket.

◆ accept_loop()

void io_tcp_t::accept_loop ( )
virtual

IO thread executes this method.

◆ connection_loop()

void io_tcp_t::connection_loop ( MHA_TCP::Connection c)
virtual

IO thread executes this method for each connection.

Parameters
cpointer to connection. connection_loop deletes connection before exiting.

◆ parse()

virtual void io_tcp_t::parse ( const char *  cmd,
char *  retval,
unsigned int  len 
)
inlinevirtual

Parser interface.

Member Data Documentation

◆ parser

io_tcp_parser_t io_tcp_t::parser
private

◆ sound

io_tcp_sound_t io_tcp_t::sound
private

◆ fwcb

io_tcp_fwcb_t io_tcp_t::fwcb
private

◆ server

MHA_TCP::Server* io_tcp_t::server
private

◆ thread

MHA_TCP::Thread* io_tcp_t::thread
private

◆ notify_start

MHA_TCP::Async_Notify io_tcp_t::notify_start
private

◆ notify_stop

MHA_TCP::Async_Notify io_tcp_t::notify_stop
private

◆ notify_release

MHA_TCP::Async_Notify io_tcp_t::notify_release
private

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