From 4c406324f4576dde9bbf866fa124279298b46a66 Mon Sep 17 00:00:00 2001 From: zhongjin Date: Thu, 10 Nov 2022 14:57:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'src/Sound/flitevoice.cxx'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Sound/flitevoice.cxx | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/Sound/flitevoice.cxx b/src/Sound/flitevoice.cxx index 9766293..96c08ea 100644 --- a/src/Sound/flitevoice.cxx +++ b/src/Sound/flitevoice.cxx @@ -23,6 +23,9 @@ # include "config.h" #endif +#include + + #include "flitevoice.hxx" #include
#include @@ -64,7 +67,22 @@ void FGFLITEVoice::speak(const string & msg) // this is called from voice.cxx:FGVoiceMgr::FGVoiceThread::run string s = simgear::strutils::strip(msg); if (!s.empty()) { - _sampleQueue.push(_synthesizer->synthesize(msg, 1.0, 0.5, 0.5)); + + //zhonjin + //_sampleQueue.push(_synthesizer->synthesize(msg, 1.0, 0.5, 0.5)); + auto serverurl = fgGetString("/sim/sound/ttsurl"); + if (!serverurl.empty() && fgGetBool("/sim/sound/voices/enabled",true)) { + + SG_LOG(SG_SOUND, SG_INFO, "TTS Play '" << s << "'" ); + + string urlcmd = "ffplay -nodisp -autoexit -loglevel quiet -i "; + urlcmd.append("\""); + urlcmd.append(serverurl); + urlcmd.append("/speech/?str="); + urlcmd.append(msg); + urlcmd.append("\""); + system(urlcmd.c_str()); + } } }