The Open Master Hearing Aid (openMHA)
openMHA
Open community platform for hearing aid algorithm research
|
Generic asynchronous JACK client. More...
Public Member Functions | |
client_t (IOProcessEvent_t proc_event, void *proc_handle=NULL, IOStartedEvent_t start_event=NULL, void *start_handle=NULL, IOStoppedEvent_t stop_event=NULL, void *stop_handle=NULL, bool use_jack_transport=false) | |
void | prepare (const std::string &client_name, const unsigned int &nchannels_in, const unsigned int &nchannels_out) |
Allocate buffers, activate JACK client and install internal ports. More... | |
void | prepare (const std::string &server_name, const std::string &client_name, const unsigned int &nchannels_in, const unsigned int &nchannels_out) |
Allocate buffers, ports, and activates JACK client. More... | |
void | release () |
Remove JACK client and deallocate internal ports and buffers. More... | |
void | start (bool fail_on_async_jack_error=true) |
void | stop () |
void | connect_input (const std::vector< std::string > &) |
Connect the input ports when connection variable is accessed. More... | |
void | connect_output (const std::vector< std::string > &) |
Connect the output ports when connection variable is accessed. More... | |
unsigned int | get_fragsize () const |
float | get_srate () const |
unsigned long | get_xruns () |
unsigned long | get_xruns_reset () |
std::string | str_error (int err) |
void | get_ports (std::vector< std::string > &, unsigned long jack_flags) |
Get a list of Jack ports. More... | |
std::vector< std::string > | get_my_input_ports () |
std::vector< std::string > | get_my_output_ports () |
void | set_input_portnames (const std::vector< std::string > &) |
void | set_output_portnames (const std::vector< std::string > &) |
float | get_cpu_load () |
void | set_use_jack_transport (bool ut) |
bool | is_prepared () const |
Protected Attributes | |
jack_client_t * | jc |
Private Member Functions | |
void | prepare_impl (const char *server_name, const char *client_name, const unsigned int &nchannels_in, const unsigned int &nchannels_out) |
Allocate buffers, activate JACK client and allocates jack ports Registers the jack client with the given server and activates it. More... | |
void | internal_start () |
void | internal_stop () |
void | stopped (int, int) |
int | jack_proc_cb (jack_nframes_t) |
This is the main processing callback. More... | |
int | jack_xrun_cb () |
Static Private Member Functions | |
static int | jack_proc_cb (jack_nframes_t, void *) |
static int | jack_xrun_cb (void *) |
Private Attributes | |
unsigned long | num_xruns |
unsigned int | fragsize |
float | samplerate |
unsigned int | nchannels_in |
unsigned int | nchannels_out |
IOProcessEvent_t | proc_event |
void * | proc_handle |
IOStartedEvent_t | start_event |
void * | start_handle |
IOStoppedEvent_t | stop_event |
void * | stop_handle |
MHASignal::waveform_t * | s_in |
mha_wave_t * | s_out |
MHAJack::port_t ** | inch |
MHAJack::port_t ** | outch |
unsigned int | flags |
bool | b_prepared |
bool | use_jack_transport |
jack_transport_state_t | jstate_prev |
std::vector< std::string > | input_portnames |
std::vector< std::string > | output_portnames |
bool | fail_on_async_jackerror |
Generic asynchronous JACK client.
MHAJack::client_t::client_t | ( | IOProcessEvent_t | proc_event, |
void * | proc_handle = NULL , |
||
IOStartedEvent_t | start_event = NULL , |
||
void * | start_handle = NULL , |
||
IOStoppedEvent_t | stop_event = NULL , |
||
void * | stop_handle = NULL , |
||
bool | use_jack_transport = false |
||
) |
void MHAJack::client_t::prepare | ( | const std::string & | client_name, |
const unsigned int & | nch_in, | ||
const unsigned int & | nch_out | ||
) |
Allocate buffers, activate JACK client and install internal ports.
Registers the jack client with the default jack server and activates it.
client_name | Name of this jack client |
nch_in | Input ports to register |
nch_out | Output ports to register |
void MHAJack::client_t::prepare | ( | const std::string & | server_name, |
const std::string & | client_name, | ||
const unsigned int & | nch_in, | ||
const unsigned int & | nch_out | ||
) |
Allocate buffers, ports, and activates JACK client.
Registers the jack client with specified jack server and activates it.
server_name | Name of the jack server to register with |
client_name | Name of this jack client |
nch_in | Input ports to register |
nch_out | Output ports to register |
void MHAJack::client_t::release | ( | void | ) |
Remove JACK client and deallocate internal ports and buffers.
void MHAJack::client_t::start | ( | bool | fail_on_async_jack_error = true | ) |
void MHAJack::client_t::stop | ( | ) |
void MHAJack::client_t::connect_input | ( | const std::vector< std::string > & | con | ) |
Connect the input ports when connection variable is accessed.
void MHAJack::client_t::connect_output | ( | const std::vector< std::string > & | con | ) |
Connect the output ports when connection variable is accessed.
|
inline |
|
inline |
|
inline |
unsigned long MHAJack::client_t::get_xruns_reset | ( | ) |
std::string MHAJack::client_t::str_error | ( | int | err | ) |
void MHAJack::client_t::get_ports | ( | std::vector< std::string > & | res, |
unsigned long | jack_flags | ||
) |
Get a list of Jack ports.
res | Result string vector |
jack_flags | Jack port flags (JackPortInput etc.) |
std::vector< std::string > MHAJack::client_t::get_my_input_ports | ( | ) |
std::vector< std::string > MHAJack::client_t::get_my_output_ports | ( | ) |
void MHAJack::client_t::set_input_portnames | ( | const std::vector< std::string > & | names | ) |
void MHAJack::client_t::set_output_portnames | ( | const std::vector< std::string > & | names | ) |
float MHAJack::client_t::get_cpu_load | ( | ) |
|
inline |
|
inline |
|
private |
Allocate buffers, activate JACK client and allocates jack ports Registers the jack client with the given server and activates it.
server_name | Name of the jack server to register with |
client_name | Name of this jack client |
nch_in | Input ports to register |
nch_out | Output ports to register |
|
private |
|
private |
|
private |
|
staticprivate |
|
private |
This is the main processing callback.
Here happens double buffering and downsampling.
|
staticprivate |
|
inlineprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
protected |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |