The Open Master Hearing Aid (openMHA)  openMHA
Open community platform for hearing aid algorithm research
MHAPlugin::plugin_t< runtime_cfg_t > Class Template Referenceabstract

The template class for C++ openMHA plugins. More...

Inheritance diagram for MHAPlugin::plugin_t< runtime_cfg_t >:
Inheritance graph

Public Member Functions

 plugin_t (const std::string &, MHA_AC::algo_comm_t &)
 Constructor of plugin template base class. More...
 
virtual ~plugin_t ()
 Destructor of plugin template base class. More...
 
virtual void prepare (mhaconfig_t &)=0
 
virtual void release ()
 
void prepare_ (mhaconfig_t &)
 
void release_ ()
 
bool is_prepared () const
 Flag, if the prepare method is successfully called (or currently evaluated) More...
 
mhaconfig_t input_cfg () const
 Current input channel configuration. More...
 
mhaconfig_t output_cfg () const
 Current output channel configuration. More...
 
- Public Member Functions inherited from MHAParser::parser_t
 parser_t (const std::string &help_text="")
 Construct detached node to be used in the configuration tree. More...
 
 ~parser_t ()
 
void insert_item (const std::string &, base_t *)
 Register a parser item into this sub-parser. More...
 
void remove_item (const std::string &)
 Remove an item by name. More...
 
void force_remove_item (const std::string &)
 Remove an item by name. More...
 
void remove_item (const base_t *)
 Remove an item by address. More...
 
- Public Member Functions inherited from MHAParser::base_t
 base_t (const std::string &)
 Constructor for base class of all parser nodes. More...
 
 base_t (const base_t &)
 Copy constructor for base_t. More...
 
base_toperator= (const base_t &)=default
 
 base_t (base_t &&)=delete
 
base_toperator= (base_t &&)=delete
 
virtual ~base_t ()
 
virtual std::string parse (const std::string &)
 Causes this node to process a command in the openMHA configuration language. More...
 
virtual void parse (const char *, char *, unsigned int)
 This function parses a command and writes the parsing result into a C character array. More...
 
virtual void parse (const std::vector< std::string > &, std::vector< std::string > &)
 
virtual std::string query_perm (const std::string &)
 
virtual std::string query_range (const std::string &)
 
std::string query_version (const std::string &)
 
std::string query_id (const std::string &)
 
std::string query_subst (const std::string &)
 
std::string query_addsubst (const std::string &)
 
std::string query_help (const std::string &)
 
std::string query_cmds (const std::string &)
 
void set_node_id (const std::string &)
 Set the identification string of this parser node. More...
 
void set_help (const std::string &)
 Set the help comment of a variable or parser. More...
 
void add_parent_on_insert (parser_t *, std::string)
 
void rm_parent_on_remove (parser_t *)
 
const std::string & fullname () const
 Return the full dot-separated path name of this parser node in the openMHA configuration tree. More...
 
- Public Member Functions inherited from MHAPlugin::config_t< runtime_cfg_t >
 config_t ()
 
 ~config_t ()
 

Protected Attributes

mhaconfig_t tftype
 Member for storage of plugin interface configuration. More...
 
MHA_AC::algo_comm_tac
 AC handle of the chain. More...
 
- Protected Attributes inherited from MHAParser::base_t
query_map_t queries
 
bool data_is_initialized
 
- Protected Attributes inherited from MHAPlugin::config_t< runtime_cfg_t >
runtime_cfg_t * cfg
 Pointer to the runtime configuration currently used by the signal processing thread. More...
 

Private Attributes

bool is_prepared_
 
mhaconfig_t input_cfg_
 
mhaconfig_t output_cfg_
 
MHAParser::mhaconfig_mon_t mhaconfig_in
 
MHAParser::mhaconfig_mon_t mhaconfig_out
 

Additional Inherited Members

- Public Attributes inherited from MHAParser::base_t
MHAEvents::emitter_t writeaccess
 Event emitted on write access. More...
 
MHAEvents::emitter_t valuechanged
 Event emitted if the value has changed. More...
 
MHAEvents::emitter_t readaccess
 Event emitted on read access. More...
 
MHAEvents::emitter_t prereadaccess
 Event emitted on read access, before the data field is accessed. More...
 
- Protected Member Functions inherited from MHAParser::parser_t
std::string op_subparse (expression_t &)
 
std::string op_setval (expression_t &)
 
std::string op_query (expression_t &)
 
std::string query_type (const std::string &)
 
std::string query_dump (const std::string &)
 
std::string query_entries (const std::string &)
 
std::string query_readfile (const std::string &)
 
std::string query_savefile (const std::string &)
 
std::string query_savefile_compact (const std::string &)
 
std::string query_savemons (const std::string &)
 
std::string query_val (const std::string &)
 
std::string query_listids (const std::string &)
 
void set_id_string (const std::string &)
 
bool has_entry (const std::string &)
 
- Protected Member Functions inherited from MHAParser::base_t
void activate_query (const std::string &, query_t)
 
void notify ()
 
- Protected Member Functions inherited from MHAPlugin::config_t< runtime_cfg_t >
runtime_cfg_t * poll_config ()
 Receive the latest run time configuration. More...
 
runtime_cfg_t * peek_config () const
 Receive the latest run time configuration without changing the configuration pointer. More...
 
void push_config (runtime_cfg_t *ncfg)
 Push a new run time configuration into the configuration fifo. More...
 
void cleanup_unused_cfg ()
 To be called by the push_config() for housekeeping. More...
 
void remove_all_cfg ()
 To be called on Plugin destruction, will delete all runtime configuration list nodes and objects regardless of their in_use flag. More...
 

Detailed Description

template<class runtime_cfg_t>
class MHAPlugin::plugin_t< runtime_cfg_t >

The template class for C++ openMHA plugins.

Template Parameters
runtime_cfg_trun-time configuration.

This template class provides thread safe configuration handling and standard methods to be compatible to the C++ openMHA plugin wrapper macro MHAPLUGIN_CALLBACKS.

The template parameter runtime_cfg_t should be the runtime configuration of the plugin.

See MHAPlugin::config_t for details on the thread safe communication update mechanism.

Constructor & Destructor Documentation

◆ plugin_t()

template<class runtime_cfg_t >
MHAPlugin::plugin_t< runtime_cfg_t >::plugin_t ( const std::string &  help,
MHA_AC::algo_comm_t iac 
)

Constructor of plugin template base class.

Plugin classes inherit from MHAPlugin::plugin_t<> and will call this base class constructor in their constructor's initialization list.

The constructor of a plugin is called each time a plugin is loaded into MHA: Multiple instances of the same plugin can be loaded and for each plugin instance, a new instance of the plugin class will be created.

Parameters
helpShort help text that provides some general information about the plugin. This text is returned in response to configuration language query command "?help".
iacAC space handle (will be stored into the member variable ac).

◆ ~plugin_t()

template<class runtime_cfg_t >
MHAPlugin::plugin_t< runtime_cfg_t >::~plugin_t
virtual

Destructor of plugin template base class.

Plugin class instances are deleted and the destructor of the instance is called when unloading a plugin instance from the MHA. Typically this happens just before the MHA process terminates, e.g. in response to cmd=quit, but some plugins also have the capability of replacing loaded plugins during runtime of the MHA, in which case the destructor of the active instances is called before the unloading.

In some exceptional cases, e.g. when an error occurs during initializing the MHA, the MHA process may terminate without ever calling the destructors of all existing plugin instances.

Member Function Documentation

◆ prepare()

template<class runtime_cfg_t >
virtual void MHAPlugin::plugin_t< runtime_cfg_t >::prepare ( mhaconfig_t )
pure virtual

Implemented in calibrator_t, save_wave_t, save_spec_t, fftfbpow::fftfbpow_interface_t, dc_simple::dc_if_t, dc::dc_if_t, ac2wave::ac2wave_if_t, wave2spec_if_t, windnoise::if_t, attenuate20_t, Set_rms, matlab_wrapper::matlab_wrapper_t, Get_rms, gcfsnet_mono_t, gcfsnet_bin_t, example4_t, example3_t, example2_t, example1_t, droptect_t, Ci_simulation_cis, Ci_simulation_ace, Ci_auralization_cis, Ci_auralization_ace, bmfwf_t, rmslevel::rmslevel_if_t, mconv::MConv, gtfb_simple_t, wavrec_t, trigger2lsl::trigger2lsl_if_t, plingploing::if_t, altconfig_t, plugins::hoertech::acrec::acrec_t, wave2lsl::wave2lsl_t, us_t, bbcalib_interface_t, testplugin::if_t, steerbf, spec2wave_if_t, softclip_t, smoothgains_bridge::overlapadd_if_t, smooth_cepstrum::smooth_cepstrum_if_t, sine_t, shadowfilter_end::shadowfilter_end_t, shadowfilter_begin::shadowfilter_begin_t, route::interface_t, rohBeam::rohBeam, MHAPlugin_Resampling::resampling_if_t, prediction_error, overlapadd::overlapadd_if_t, osc2ac_t, noise_psd_estimator::noise_psd_estimator_if_t, noise_t, nlms_t, multibandcompressor::interface_t, mhachain::chain_base_t, matrixmixer::matmix_t, lsl2ac::lsl2ac_t, lpc_burglattice, lpc_bl_predictor, lpc, levelmeter_t, level_matching::level_matching_t, identity_t, gtfb_simd_t, gtfb_analyzer::gtfb_analyzer_t, gsc_adaptive_stage::gsc_adaptive_stage_if, gain::gain_if_t, fshift_hilbert::frequency_translator_t, fshift::fshift_t, fftfilterbank::fftfb_interface_t, fftfilter::interface_t, fader_wave::fader_wave_if_t, fader_if_t, example7_t, example6_t, plugin_interface_t, equalize::freqgains_t, dropgen_t, ds_t, doasvm_feature_extraction, doasvm_classification, delaysum::delaysum_wave_if_t, delaysum_spec::delaysum_spec_if_t, delay::interface_t, dbasync_native::db_if_t, db_if_t, cpuload::cpuload_if_t, complex_scale_channel_t, combc_if_t, coherence::cohflt_if_t, audiometerbackend::audiometer_if_t, analysispath_if_t, altplugs_t, adm_if_t, addsndfile::addsndfile_if_t, adaptive_feedback_canceller, acTransform_wave, acSteer, acsave::acsave_t, acPooling_wave, acmon::acmon_t, acConcat_wave, ac_proc::interface_t, ac2xdf::ac2xdf_if_t, ac2osc_t, and ac2lsl::ac2lsl_t.

◆ release()

template<class runtime_cfg_t >
void MHAPlugin::plugin_t< runtime_cfg_t >::release
virtual

Reimplemented in windnoise::if_t, attenuate20_t, steerbf, smooth_cepstrum::smooth_cepstrum_if_t, rohBeam::rohBeam, prediction_error, lpc_burglattice, lpc_bl_predictor, lpc, level_matching::level_matching_t, gsc_adaptive_stage::gsc_adaptive_stage_if, gcfsnet_mono_t, gcfsnet_bin_t, fshift::fshift_t, example7_t, example4_t, example3_t, example2_t, example1_t, droptect_t, doasvm_feature_extraction, doasvm_classification, bmfwf_t, acTransform_wave, acSteer, acPooling_wave, acConcat_wave, rmslevel::rmslevel_if_t, wavrec_t, wave2spec_if_t, wave2lsl::wave2lsl_t, us_t, trigger2lsl::trigger2lsl_if_t, bbcalib_interface_t, calibrator_t, spec2wave_if_t, smoothgains_bridge::overlapadd_if_t, sine_t, Set_rms, route::interface_t, MHAPlugin_Resampling::resampling_if_t, overlapadd::overlapadd_if_t, osc2ac_t, nlms_t, multibandcompressor::interface_t, mhachain::chain_base_t, mconv::MConv, matlab_wrapper::matlab_wrapper_t, lsl2ac::lsl2ac_t, identity_t, gtfb_simple_t, gtfb_analyzer::gtfb_analyzer_t, Get_rms, gain::gain_if_t, fshift_hilbert::frequency_translator_t, fftfilterbank::fftfb_interface_t, fader_wave::fader_wave_if_t, dropgen_t, ds_t, delaysum::delaysum_wave_if_t, dc_simple::dc_if_t, dc::dc_if_t, dbasync_native::db_if_t, db_if_t, coherence::cohflt_if_t, Ci_simulation_cis, Ci_simulation_ace, Ci_auralization_cis, Ci_auralization_ace, analysispath_if_t, altplugs_t, altconfig_t, adm_if_t, addsndfile::addsndfile_if_t, adaptive_feedback_canceller, acsave::acsave_t, plugins::hoertech::acrec::acrec_t, acmon::acmon_t, ac_proc::interface_t, ac2xdf::ac2xdf_if_t, ac2wave::ac2wave_if_t, ac2osc_t, and ac2lsl::ac2lsl_t.

◆ prepare_()

template<class runtime_cfg_t >
void MHAPlugin::plugin_t< runtime_cfg_t >::prepare_ ( mhaconfig_t cf)

◆ release_()

template<class runtime_cfg_t >
void MHAPlugin::plugin_t< runtime_cfg_t >::release_

◆ is_prepared()

template<class runtime_cfg_t >
bool MHAPlugin::plugin_t< runtime_cfg_t >::is_prepared ( ) const
inline

Flag, if the prepare method is successfully called (or currently evaluated)

◆ input_cfg()

template<class runtime_cfg_t >
mhaconfig_t MHAPlugin::plugin_t< runtime_cfg_t >::input_cfg ( ) const
inline

Current input channel configuration.

◆ output_cfg()

template<class runtime_cfg_t >
mhaconfig_t MHAPlugin::plugin_t< runtime_cfg_t >::output_cfg ( ) const
inline

Current output channel configuration.

Member Data Documentation

◆ tftype

template<class runtime_cfg_t >
mhaconfig_t MHAPlugin::plugin_t< runtime_cfg_t >::tftype
protected

Member for storage of plugin interface configuration.

This member is defined for convenience of the developer. Typically, the actual contents of mhaconfig_t are stored in this member in the prepare() method.

Note
This member is likely to be removed in later versions, use input_cfg() and output_cfg() instead.

◆ ac

template<class runtime_cfg_t >
MHA_AC::algo_comm_t& MHAPlugin::plugin_t< runtime_cfg_t >::ac
protected

AC handle of the chain.

This variable is initialized in the constructor and can be used by derived plugins to access the AC space. Its contents should not be modified.

◆ is_prepared_

template<class runtime_cfg_t >
bool MHAPlugin::plugin_t< runtime_cfg_t >::is_prepared_
private

◆ input_cfg_

template<class runtime_cfg_t >
mhaconfig_t MHAPlugin::plugin_t< runtime_cfg_t >::input_cfg_
private

◆ output_cfg_

template<class runtime_cfg_t >
mhaconfig_t MHAPlugin::plugin_t< runtime_cfg_t >::output_cfg_
private

◆ mhaconfig_in

template<class runtime_cfg_t >
MHAParser::mhaconfig_mon_t MHAPlugin::plugin_t< runtime_cfg_t >::mhaconfig_in
private

◆ mhaconfig_out

template<class runtime_cfg_t >
MHAParser::mhaconfig_mon_t MHAPlugin::plugin_t< runtime_cfg_t >::mhaconfig_out
private

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