36 :
FGVoice(mgr), _synthesizer( NULL), _seconds_to_run(0.0)
39 _sampleName = node->getStringValue(
"desc", node->getPath().c_str());
41 SGPath voice =
globals->get_fg_root() /
"ATC" /
42 node->getStringValue(
"htsvoice",
"cmu_us_arctic_slt.htsvoice");
46 auto smgr =
globals->get_subsystem<SGSoundMgr>();
47 _sgr = smgr->find(sampleGroupRefName,
true);
48 _sgr->tie_to_listener();
50 node->getNode(
"text",
true)->addChangeListener(
this);
52 SG_LOG(SG_SOUND, SG_DEBUG,
"FLITEVoice initialized for sample-group '" << sampleGroupRefName
53 <<
"'. Samples will be named '" << _sampleName <<
"' "
54 <<
"voice is '" << voice <<
"'");
73 _seconds_to_run -= dt;
75 if (_seconds_to_run < 0.0) {
76 SGSharedPtr<SGSoundSample> sample = _sampleQueue.pop();
78 _sgr->remove(_sampleName);
79 _sgr->add(sample, _sampleName);
81 _sgr->play(_sampleName,
false);
85 _seconds_to_run = 0.5 + ((float) sample->get_no_samples()) / ((float) sample->get_frequency());