InstalledVoice InstalledVoice InstalledVoice InstalledVoice Class

Definición

Contiene información sobre una voz de síntesis de voz instalada en Windows.Contains information about a speech synthesis voice installed in Windows.

public ref class InstalledVoice
public class InstalledVoice
type InstalledVoice = class
Public Class InstalledVoice
Herencia
InstalledVoiceInstalledVoiceInstalledVoiceInstalledVoice

Ejemplos

El siguiente ejemplo forma parte de una aplicación de consola que inicializa un SpeechSynthesizer objeto y envía a la consola una lista de las voces instaladas (motores para la síntesis de voz) y muestra la información que está disponible para cada voz.The following example is part of a console application that initializes a SpeechSynthesizer object and outputs to the console a list of the installed voices (engines for speech synthesis) and demonstrates the information that is available for each voice.

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();  
    }  
  }  
}  

Comentarios

Utilice esta clase para obtener información acerca de una voz instalada, incluida su referencia cultural, el nombre, el sexo, la edad y si está habilitada.Use this class to get information about an installed voice, including its culture, name, gender, age, and whether it is enabled.

Para realizar una conversión de texto a voz mediante el idioma especificado en Culture la propiedad, debe instalarse un motor de síntesis de voz que admita ese código de país de idioma.To perform text-to-speech using the language specified in the Culture property, a speech synthesis engine that supports that language-country code must be installed. Los motores de síntesis de voz que se incluyen con Microsoft Windows 7 funcionan con los siguientes códigos de país de idioma:The speech synthesis engines that shipped with Microsoft Windows 7 work with the following language-country codes:

  • en-US.en-US. Inglés (Estados Unidos)English (United States)

  • zh-CN.zh-CN. Chino (China)Chinese (China)

  • zh-TW.zh-TW. Chino (Taiwán)Chinese (Taiwan)

También se permiten códigos de idioma de dos letras, como "en".Two-letter language codes such as "en" are also permitted.

Propiedades

Enabled Enabled Enabled Enabled

Obtiene o establece si se puede usar una voz para generar la voz.Gets or sets whether a voice can be used to generate speech.

VoiceInfo VoiceInfo VoiceInfo VoiceInfo

Obtiene información sobre una voz, como la referencia cultural, el nombre, el sexo y la edad.Gets information about a voice, such as culture, name, gender, and age.

Métodos

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determina si un objeto determinado es una instancia de InstalledVoice igual a la instancia actual de InstalledVoice.Determines if a given object is an instance of InstalledVoice and equal to the current instance of InstalledVoice.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Proporciona un código hash para un objeto InstalledVoice.Provides a hash code for an InstalledVoice object.

GetType() GetType() GetType() GetType()

Obtiene el Type de la instancia actual.Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Crea una copia superficial del objeto Object actual.Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

Devuelve una cadena que representa el objeto actual.Returns a string that represents the current object.

(Inherited from Object)

Se aplica a