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

The tcp sound io library. More...

Public Member Functions

 io_asterisk_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_asterisk_t ()
 

Private Attributes

io_asterisk_parser_t parser
 
io_asterisk_sound_t sound
 
io_asterisk_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_asterisk_t()

io_asterisk_t::io_asterisk_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_asterisk_t()

virtual io_asterisk_t::~io_asterisk_t ( )
inlinevirtual

Member Function Documentation

◆ prepare()

void io_asterisk_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_asterisk_t::start ( )

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

◆ stop()

void io_asterisk_t::stop ( )

Close the current connection if there is one.

stop IO thread

◆ release()

void io_asterisk_t::release ( void  )

Close the current connection and close the server socket.

Stop IO thread and close server socket.

◆ accept_loop()

void io_asterisk_t::accept_loop ( )
virtual

IO thread executes this method.

◆ connection_loop()

void io_asterisk_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_asterisk_t::parse ( const char *  cmd,
char *  retval,
unsigned int  len 
)
inlinevirtual

Parser interface.

Member Data Documentation

◆ parser

io_asterisk_parser_t io_asterisk_t::parser
private

◆ sound

io_asterisk_sound_t io_asterisk_t::sound
private

◆ fwcb

io_asterisk_fwcb_t io_asterisk_t::fwcb
private

◆ server

MHA_TCP::Server* io_asterisk_t::server
private

◆ thread

MHA_TCP::Thread* io_asterisk_t::thread
private

◆ notify_start

MHA_TCP::Async_Notify io_asterisk_t::notify_start
private

◆ notify_stop

MHA_TCP::Async_Notify io_asterisk_t::notify_stop
private

◆ notify_release

MHA_TCP::Async_Notify io_asterisk_t::notify_release
private

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