Exemplo n.º 1
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            speechManager = new SpeechManager(ConfigUtil.VoiceDB);

            if (ConfigUtil.VoiceDB.ToLower().IndexOf("acapela") >= 0)
            {
                var path = Helpers.FindAcaTTS();
                Helpers.AcaTTSPath = path.Length > 0 ? path : Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + @"\Acapela Group\Acapela TTS for Windows\acatts.dll";

                tts = new BabTTS();

                var langPair = ConfigUtil.VoiceDB.Split(',');
                for (var i = 0; i < langPair.Length; i += 2)
                {
                    if (langPair[i + 1].ToLower() == "acapela")
                    {
                        var err = tts.Open(langPair[i], BabTtsOpenModes.BABTTS_USEDEFDICT);
                        speechManager.TTS = tts;
                    }
                }
            }

            speechManager.SpeechStarted += OnSpeechStarted;
            speechManager.SpeechEnded   += OnSpeechEnded;
            speechManager.VisemeUpdated += OnVisemeUpdated;
            speechManager.SpeechOpened  += OnSpeechOpened;
            speechManager.ProgramClosed += speechManager_ProgramClosed;

            host = new ServiceHost(speechManager, new Uri("net.pipe://localhost/FuroWare/SpeechService"));
            host.AddServiceEndpoint(typeof(ISpeech), new NetNamedPipeBinding(), string.Empty);

            host.Open();
        }
Exemplo n.º 2
0
 void OnSpeechOpened(object sender, StringMessageEventArgs e)
 {
     if (tts != null)
     {
         tts.Close();
         tts = new BabTTS();
         var err = tts.Open(e.Message, BabTtsOpenModes.BABTTS_USEDEFDICT);
         speechManager.TTS = tts;
     }
 }