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

real-time configuration class for trigger2lsl plugin More...

Public Member Functions

 trigger2lsl_rt_t (const std::string &stream_name_, const std::string &rising_edge_, const std::string &falling_edge_, mha_real_t threshold_, int channel_, mha_real_t sampling_rate_, bool use_edge_position_, int min_debounce_)
 C'tor of rt configuration. More...
 
void process (mha_wave_t *wave)
 

Private Attributes

lsl::stream_outlet stream
 Outlet stream. More...
 
const std::string rising_edge
 String to be sent when a rising edge is detected. More...
 
const std::string falling_edge
 String to be sent when a falling edge is detected. More...
 
const mha_real_t threshold
 Threshold for state transition. More...
 
const int channel
 Channel number where to look for threshold crossings. More...
 
bool state =false
 Current state. More...
 
const mha_real_t sampling_rate
 Sampling rate of the input signal. More...
 
const bool use_edge_position =true
 Flag wether to use the position of the edge within the signal block to correct the timestamp of the output marker. More...
 
const int min_debounce
 Minimum number of consecutive samples that need to cross the threshold to initiate a state transition. More...
 
int debounce_counter =0
 Debounce counter. More...
 

Detailed Description

real-time configuration class for trigger2lsl plugin

Constructor & Destructor Documentation

◆ trigger2lsl_rt_t()

trigger2lsl_rt_t::trigger2lsl_rt_t ( const std::string &  stream_name_,
const std::string &  rising_edge_,
const std::string &  falling_edge_,
mha_real_t  threshold_,
int  channel_,
mha_real_t  sampling_rate_,
bool  use_edge_position_,
int  min_debounce_ 
)

C'tor of rt configuration.

Parameters
stream_name_Name of the output stream
rising_edge_String to be sent on detection of a rising edge
falling_edge_String to be sent on detection of a falling edge
threshold_Threshold for state transition
channel_Channel index where to look for threshold crossings
sampling_rate_Sampling rate of the input signal. Needed for timestamp offeset correction
use_edge_position_Flag wether to use the position of the edge within the signal block to correct the timestamp of the output marker
min_debounce_Minimum number of consecutive samples that need to cross the threshold to initiate a state transition

Member Function Documentation

◆ process()

void trigger2lsl_rt_t::process ( mha_wave_t wave)

Member Data Documentation

◆ stream

lsl::stream_outlet trigger2lsl::trigger2lsl_rt_t::stream
private

Outlet stream.

◆ rising_edge

const std::string trigger2lsl::trigger2lsl_rt_t::rising_edge
private

String to be sent when a rising edge is detected.

◆ falling_edge

const std::string trigger2lsl::trigger2lsl_rt_t::falling_edge
private

String to be sent when a falling edge is detected.

◆ threshold

const mha_real_t trigger2lsl::trigger2lsl_rt_t::threshold
private

Threshold for state transition.

◆ channel

const int trigger2lsl::trigger2lsl_rt_t::channel
private

Channel number where to look for threshold crossings.

◆ state

bool trigger2lsl::trigger2lsl_rt_t::state =false
private

Current state.

false means HIGH and true means LOW. LOW state means we are below the threshold, looking for rising edges, HIGH state means we are above, looking for falling edges.

◆ sampling_rate

const mha_real_t trigger2lsl::trigger2lsl_rt_t::sampling_rate
private

Sampling rate of the input signal.

Needed for timestamp offeset correction

◆ use_edge_position

const bool trigger2lsl::trigger2lsl_rt_t::use_edge_position =true
private

Flag wether to use the position of the edge within the signal block to correct the timestamp of the output marker.

◆ min_debounce

const int trigger2lsl::trigger2lsl_rt_t::min_debounce
private

Minimum number of consecutive samples that need to cross the threshold to initiate a state transition.

◆ debounce_counter

int trigger2lsl::trigger2lsl_rt_t::debounce_counter =0
private

Debounce counter.


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