Exemplo n.º 1
0
 private void FunnyText_OnLostFocus(object sender, RoutedEventArgs e)
 {
     if (this.m_oldText == this.funnyText.Text)
     {
         return;
     }
     SpeechUtil.TextToSpeech(this.funnyText.Text);
     this.m_oldText = this.funnyText.Text;
 }
 public void TestMakeProjectNameSpeechFriendly()
 {
     Assert.AreEqual("expected", SpeechUtil.makeProjectNameMoreSpeechFriendly("expected"));
     Assert.AreEqual("the One True Project", SpeechUtil.makeProjectNameMoreSpeechFriendly("theOneTrueProject"));
     Assert.AreEqual("Project 1", SpeechUtil.makeProjectNameMoreSpeechFriendly("Project_1"));
     Assert.AreEqual("A Project With First Word A Single Letter", SpeechUtil.makeProjectNameMoreSpeechFriendly("AProjectWithFirstWordASingleLetter"));
     Assert.AreEqual("a Project With First Word A Single Letter", SpeechUtil.makeProjectNameMoreSpeechFriendly("aProjectWithFirstWordASingleLetter"));
     Assert.AreEqual("A Project With Some Underscores", SpeechUtil.makeProjectNameMoreSpeechFriendly("AProjectWith_Some_Underscores"));
     Assert.AreEqual("A Project With some dashes", SpeechUtil.makeProjectNameMoreSpeechFriendly("AProjectWith-some-dashes"));
     Assert.AreEqual("", SpeechUtil.makeProjectNameMoreSpeechFriendly(""));
 }
Exemplo n.º 3
0
 private void PlaybackVoice_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (e.AddedItems == null || e.AddedItems.Count == 0)
     {
         return;
     }
     if (e.AddedItems[0] is string s && string.CompareOrdinal(s, this.m_selectedVoice) != 0)
     {
         this.m_selectedVoice = s;
         SpeechUtil.ChangeVoice(this.m_selectedVoice);
         SimpleLogger.Log(nameof(MainWindow), $"Selected Voice: {s}");
     }
 }
Exemplo n.º 4
0
 private void Initialize()
 {
     if (this.m_isInitialzed)
     {
         return;
     }
     this.m_isInitialzed   = true;
     this.m_textBuffer     = new BlockingTextBuffer(200);
     this.ApiKeyInput.Text = Configuration.ApiKey;
     this.OutputTs3StatusMessage("Initializing Ts3 Service...");
     TS3ClientQuery.SetApiKey(Configuration.ApiKey);
     TS3ClientQuery.OnStatusMessageUpdate += this.OutputTs3StatusMessage;
     TS3ClientQuery.StartQueryClientAsync();
     foreach (var name in SpeechUtil.GetPlaybackDeviceNames())
     {
         this.PlaybackDevice.Items.Add(name);
         if (this.m_selectedDevice == null)
         {
             this.m_selectedDevice = name;
         }
     }
     if (this.PlaybackDevice.Items.Count != 0)
     {
         this.PlaybackDevice.SelectedIndex = 0;
     }
     foreach (var name in SpeechUtil.GetVoiceNames())
     {
         this.PlaybackVoice.Items.Add(name);
         if (this.m_selectedVoice == null)
         {
             this.m_selectedVoice = name;
         }
     }
     if (this.PlaybackVoice.Items.Count != 0)
     {
         this.PlaybackVoice.SelectedIndex = 0;
     }
     SpeechUtil.Initialize();
 }
        public void TestWhetherWeShouldSpeak()
        {
            Assert.IsTrue(SpeechUtil.shouldSpeak(BuildTransition.StillSuccessful, true, false));
            Assert.IsTrue(SpeechUtil.shouldSpeak(BuildTransition.Fixed, true, false));
            Assert.IsTrue(SpeechUtil.shouldSpeak(BuildTransition.StillSuccessful, true, true));
            Assert.IsTrue(SpeechUtil.shouldSpeak(BuildTransition.Fixed, true, true));

            Assert.IsTrue(SpeechUtil.shouldSpeak(BuildTransition.Broken, false, true));
            Assert.IsTrue(SpeechUtil.shouldSpeak(BuildTransition.StillFailing, false, true));
            Assert.IsTrue(SpeechUtil.shouldSpeak(BuildTransition.Broken, true, true));
            Assert.IsTrue(SpeechUtil.shouldSpeak(BuildTransition.StillFailing, true, true));

            Assert.IsFalse(SpeechUtil.shouldSpeak(BuildTransition.Broken, true, false));
            Assert.IsFalse(SpeechUtil.shouldSpeak(BuildTransition.StillFailing, true, false));
            Assert.IsFalse(SpeechUtil.shouldSpeak(BuildTransition.Broken, false, false));
            Assert.IsFalse(SpeechUtil.shouldSpeak(BuildTransition.StillFailing, false, false));

            Assert.IsFalse(SpeechUtil.shouldSpeak(BuildTransition.StillSuccessful, false, true));
            Assert.IsFalse(SpeechUtil.shouldSpeak(BuildTransition.Fixed, false, true));
            Assert.IsFalse(SpeechUtil.shouldSpeak(BuildTransition.StillSuccessful, false, false));
            Assert.IsFalse(SpeechUtil.shouldSpeak(BuildTransition.Fixed, false, false));
        }