void std_hts_engine_impl::do_initialize() { engine.reset(new HTS_Engine); HTS_Engine_initialize(engine.get()); engine->audio.audio_interface=this; std::string voice_path(path::join(data_path,"voice.data")); char* c_voice_path=const_cast<char*>(voice_path.c_str()); if(!HTS_Engine_load(engine.get(),&c_voice_path,1)) { HTS_Engine_clear(engine.get()); throw initialization_error(); } HTS_Engine_set_beta(engine.get(),beta); HTS_Engine_set_audio_buff_size(engine.get(),HTS_Engine_get_fperiod(engine.get())); }
void std_hts_engine_impl::set_time_info() { int fperiod=HTS_Engine_get_fperiod(engine.get()); int n=HTS_Engine_get_nstate(engine.get()); int time=0; int dur=0; int i=0; for(label_sequence::iterator lab_iter=input->lbegin();lab_iter!=input->lend();++lab_iter,++i) { lab_iter->set_time(time); dur=0; for(int j=0;j<n;++j) dur+=HTS_Engine_get_state_duration(engine.get(),i*n+j)*fperiod; lab_iter->set_duration(dur); time+=dur; } }