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

Public Member Functions

 wavwriter_t (bool active, const mhaconfig_t &cf, unsigned int fifosize, unsigned int minwrite, const std::string &prefix, bool use_date, const std::string &format_name_)
 
 ~wavwriter_t ()
 
void process (mha_wave_t *)
 
void exit_request ()
 

Private Member Functions

void write_thread ()
 
void create_soundfile (const std::string &prefix, bool use_date)
 
void set_format (SF_INFO &sf_info)
 Converts the format_name string to the corresponding int according to libsndfile and writes it into the format field of sf_info throws if no format of this name is available. More...
 

Static Private Member Functions

static void * write_thread (void *this_)
 

Private Attributes

std::atomic< bool > close_session
 
bool act_
 
mhaconfig_t cf_
 
SNDFILE * sf
 
mha_fifo_lf_t< mha_real_tfifo
 
unsigned int minw_
 
pthread_t writethread
 
float * data
 
std::string format_name
 

Constructor & Destructor Documentation

◆ wavwriter_t()

wavwriter_t::wavwriter_t ( bool  active,
const mhaconfig_t cf,
unsigned int  fifosize,
unsigned int  minwrite,
const std::string &  prefix,
bool  use_date,
const std::string &  format_name_ 
)

◆ ~wavwriter_t()

wavwriter_t::~wavwriter_t ( )

Member Function Documentation

◆ process()

void wavwriter_t::process ( mha_wave_t s)

◆ exit_request()

void wavwriter_t::exit_request ( )

◆ write_thread() [1/2]

static void* wavwriter_t::write_thread ( void *  this_)
inlinestaticprivate

◆ write_thread() [2/2]

void wavwriter_t::write_thread ( )
private

◆ create_soundfile()

void wavwriter_t::create_soundfile ( const std::string &  prefix,
bool  use_date 
)
private

◆ set_format()

void wavwriter_t::set_format ( SF_INFO &  sf_info)
private

Converts the format_name string to the corresponding int according to libsndfile and writes it into the format field of sf_info throws if no format of this name is available.

Parameters
sf_infoDestination sf_info struct for the format
Exceptions
MHA_ErrorIf no sample format of name format_name is offered by libsndfile

Member Data Documentation

◆ close_session

std::atomic<bool> wavwriter_t::close_session
private

◆ act_

bool wavwriter_t::act_
private

◆ cf_

mhaconfig_t wavwriter_t::cf_
private

◆ sf

SNDFILE* wavwriter_t::sf
private

◆ fifo

mha_fifo_lf_t<mha_real_t> wavwriter_t::fifo
private

◆ minw_

unsigned int wavwriter_t::minw_
private

◆ writethread

pthread_t wavwriter_t::writethread
private

◆ data

float* wavwriter_t::data
private

◆ format_name

std::string wavwriter_t::format_name
private

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