The Open Master Hearing Aid (openMHA)  openMHA
Open community platform for hearing aid algorithm research
ac2lsl::save_var_t< mha_complex_t > Class Reference

Template specialization of the ac2lsl bridge to take care of complex numbers. More...

Inheritance diagram for ac2lsl::save_var_t< mha_complex_t >:
Inheritance graph

Public Member Functions

 save_var_t (const std::string &name_, const std::string &type_, unsigned num_channels_, const mha_real_t rate_, const lsl::channel_format_t format_, const std::string &source_id_, void *data_)
 C'tor of specialization for complex types. More...
 
virtual void * get_buf_address () const noexcept override
 
virtual void set_buf_address (void *data) override
 
virtual lsl::stream_info info () const noexcept override
 Get buffer address as void pointer. More...
 
virtual unsigned data_type () const noexcept override
 Cast the input pointer to the appropriate type and set the buffer address. More...
 
virtual ~save_var_t ()=default
 
virtual void send_frame (unsigned num_entries) override
 Send a frame of complex types. More...
 
- Public Member Functions inherited from ac2lsl::save_var_base_t
virtual ~save_var_base_t ()=default
 

Private Attributes

lsl::stream_outlet stream
 LSL stream outlet. More...
 
mha_complex_tbuf
 Pointer to data buffer of the ac variable. More...
 

Detailed Description

Template specialization of the ac2lsl bridge to take care of complex numbers.

This specialization is needed because lsl does not support complex numbers. Order is [re(0), im(0), re(1), im(1), ....]

Constructor & Destructor Documentation

◆ save_var_t()

ac2lsl::save_var_t< mha_complex_t >::save_var_t ( const std::string &  name_,
const std::string &  type_,
unsigned  num_channels_,
const mha_real_t  rate_,
const lsl::channel_format_t  format_,
const std::string &  source_id_,
void *  data_ 
)
inline

C'tor of specialization for complex types.

See generic c'tor for details.

◆ ~save_var_t()

virtual ac2lsl::save_var_t< mha_complex_t >::~save_var_t ( )
virtualdefault

Member Function Documentation

◆ get_buf_address()

virtual void* ac2lsl::save_var_t< mha_complex_t >::get_buf_address ( ) const
inlineoverridevirtualnoexcept

◆ set_buf_address()

virtual void ac2lsl::save_var_t< mha_complex_t >::set_buf_address ( void *  data)
inlineoverridevirtual

◆ info()

virtual lsl::stream_info ac2lsl::save_var_t< mha_complex_t >::info ( ) const
inlineoverridevirtualnoexcept

Get buffer address as void pointer.

Returns
Adress of the data buffer

Implements ac2lsl::save_var_base_t.

◆ data_type()

virtual unsigned ac2lsl::save_var_t< mha_complex_t >::data_type ( ) const
inlineoverridevirtualnoexcept

Cast the input pointer to the appropriate type and set the buffer address.

Parameters
dataNew buffer address

Implements ac2lsl::save_var_base_t.

◆ send_frame()

virtual void ac2lsl::save_var_t< mha_complex_t >::send_frame ( unsigned  num_entries)
inlineoverridevirtual

Send a frame of complex types.

Complex numbers are stored as alternating real and imaginary parts. An array of complex numbers in memory can be reinterpreted as a vector of real numbers that correspond to real and imaginary parts. LSL does not support complex types directly. Send one vector containing {buf[0].re,buf[0].im,buf[1].re,buf[1].im,...} instead.

Implements ac2lsl::save_var_base_t.

Member Data Documentation

◆ stream

lsl::stream_outlet ac2lsl::save_var_t< mha_complex_t >::stream
private

LSL stream outlet.

Interface to lsl

◆ buf

Pointer to data buffer of the ac variable.


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