VoiceInfo Klasa

Definicja

Reprezentuje zainstalowany aparat syntezy mowy.

public ref class VoiceInfo
[System.Serializable]
public class VoiceInfo
[<System.Serializable>]
type VoiceInfo = class
Public Class VoiceInfo
Dziedziczenie
VoiceInfo
Atrybuty

Przykłady

Poniższy przykład jest częścią aplikacji konsolowej, która inicjuje obiekt i wyprowadza do konsoli listę zainstalowanych głosów (aparatów syntezy mowy) i demonstruje informacje dostępne dla każdego SpeechSynthesizer głosu.

using System;  
using System.Speech.Synthesis;  
using System.Speech.AudioFormat;  

namespace SampleSynthesis  
{  
  class Program  
  {  
    static void Main(string[] args)  
    {  

      // Initialize a new instance of the SpeechSynthesizer.  
      using (SpeechSynthesizer synth = new SpeechSynthesizer())  
      {  

        // Output information about all of the installed voices.   
        Console.WriteLine("Installed voices -");  
        foreach (InstalledVoice voice in synth.GetInstalledVoices())  
        {  
          VoiceInfo info = voice.VoiceInfo;  
          string AudioFormats = "";  
          foreach (SpeechAudioFormatInfo fmt in info.SupportedAudioFormats)  
          {  
            AudioFormats += String.Format("{0}\n",  
            fmt.EncodingFormat.ToString());  
          }  

          Console.WriteLine(" Name:          " + info.Name);  
          Console.WriteLine(" Culture:       " + info.Culture);  
          Console.WriteLine(" Age:           " + info.Age);  
          Console.WriteLine(" Gender:        " + info.Gender);  
          Console.WriteLine(" Description:   " + info.Description);  
          Console.WriteLine(" ID:            " + info.Id);  
          Console.WriteLine(" Enabled:       " + voice.Enabled);  
          if (info.SupportedAudioFormats.Count != 0)  
          {  
            Console.WriteLine( " Audio formats: " + AudioFormats);  
          }  
          else  
          {  
            Console.WriteLine(" No supported audio formats found");  
          }  

          string AdditionalInfo = "";  
          foreach (string key in info.AdditionalInfo.Keys)  
          {  
            AdditionalInfo += String.Format("  {0}: {1}\n", key, info.AdditionalInfo[key]);  
          }  

          Console.WriteLine(" Additional Info - " + AdditionalInfo);  
          Console.WriteLine();  
        }  
      }  
      Console.WriteLine("Press any key to exit...");  
      Console.ReadKey();  
    }  
  }  
}  

Uwagi

Głos to zainstalowany aparat syntezy mowy, który jest również nazywany aparatem funkcji tekstu na mowę lub aparatem TTS. Obiekt generuje mowę z tekstu SpeechSynthesizer za pomocą głosu. Właściwości obiektu identyfikują VoiceInfo głos i opisują jego właściwości. Najbardziej definiującą cechą głosu jest jego , która definiuje pojedynczy Culture język, który głos może mówić.

Właściwość Voice zwraca obiekt zawierający informacje o bieżącym VoiceInfo głosie, który jest w użyciu przez obiekt SpeechSynthesizer . Można również użyć obiektu , aby uzyskać informacje o dowolnym głosie zainstalowanym w systemie, jak VoiceInfo zwraca metoda GetInstalledVoices() . Aby uzyskać więcej informacji, zobacz InstalledVoice.

Właściwości

AdditionalInfo

Pobiera dodatkowe informacje o głosie.

Age

Pobiera wiek głosu.

Culture

Pobiera kulturę głosu.

Description

Pobiera opis głosu.

Gender

Pobiera płeć głosu.

Id

Pobiera identyfikator głosu.

Name

Pobiera nazwę głosu.

SupportedAudioFormats

Pobiera kolekcję formatów audio obsługiwanych przez głos.

Metody

Equals(Object)

Porównuje pola głosu z określonym obiektem, aby VoiceInfo określić, czy zawierają one te same wartości.

GetHashCode()

Udostępnia kod skrótu dla obiektu VoiceInfo.

GetType()

Type Pobiera wartość bieżącego wystąpienia.

(Odziedziczone po Object)
MemberwiseClone()

Tworzy płytkią kopię bieżącego Objectelementu .

(Odziedziczone po Object)
ToString()

Zwraca ciąg reprezentujący bieżący obiekt.

(Odziedziczone po Object)

Dotyczy

Zobacz też