Share via


SpeechSynthesizer.GetInstalledVoices 메서드

정의

현재 시스템에 설치 된 합성 (텍스트 음성 변환) 음성 음성의 컬렉션을 반환 합니다.

오버로드

GetInstalledVoices()

설치된 음성의 모든 설치된 합성 음성(텍스트 음성 변환)을 반환합니다.

GetInstalledVoices(CultureInfo)

설치된 음성의 모든 특정 로케일 지원 (텍스트 음성 변환) 합성 음성을 반환합니다.

설명

애플리케이션을 호출 하면 GetInstalledVoices, 메서드는 음성 (음성 텍스트 변환 엔진)의 각에서 찾으면 레지스트리 충족 최소 특정 조건을 확인 합니다. 확인 하지 못한 모든 음성 GetInstalledVoices 설정 하는 해당 Enabled 속성을 False입니다. 애플리케이션에 음성으로 선택할 수 없습니다입니다 Enabled 속성은 False합니다. 일반적으로 애플리케이션을 음성 설정 하지 것입니다 Enabled 속성입니다.

GetInstalledVoices()

설치된 음성의 모든 설치된 합성 음성(텍스트 음성 변환)을 반환합니다.

public:
 System::Collections::ObjectModel::ReadOnlyCollection<System::Speech::Synthesis::InstalledVoice ^> ^ GetInstalledVoices();
public System.Collections.ObjectModel.ReadOnlyCollection<System.Speech.Synthesis.InstalledVoice> GetInstalledVoices ();
member this.GetInstalledVoices : unit -> System.Collections.ObjectModel.ReadOnlyCollection<System.Speech.Synthesis.InstalledVoice>
Public Function GetInstalledVoices () As ReadOnlyCollection(Of InstalledVoice)

반환

ReadOnlyCollection<InstalledVoice>

시스템에 현재 설치된 음성의 읽기 전용 컬렉션을 반환합니다.

예제

다음 예제는 초기화 하는 콘솔 애플리케이션의 일부를 SpeechSynthesizer 개체 설치 된 음성 (음성 합성 엔진)의 목록을 콘솔에 출력 하 고 각 음성에 사용할 수 있는 정보를 보여 줍니다.

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

설명

음성은 시스템에 설치 된 음성 합성 (텍스트-음성 또는 TTS)의 엔진입니다.

추가 정보

적용 대상

GetInstalledVoices(CultureInfo)

설치된 음성의 모든 특정 로케일 지원 (텍스트 음성 변환) 합성 음성을 반환합니다.

public:
 System::Collections::ObjectModel::ReadOnlyCollection<System::Speech::Synthesis::InstalledVoice ^> ^ GetInstalledVoices(System::Globalization::CultureInfo ^ culture);
public System.Collections.ObjectModel.ReadOnlyCollection<System.Speech.Synthesis.InstalledVoice> GetInstalledVoices (System.Globalization.CultureInfo culture);
member this.GetInstalledVoices : System.Globalization.CultureInfo -> System.Collections.ObjectModel.ReadOnlyCollection<System.Speech.Synthesis.InstalledVoice>
Public Function GetInstalledVoices (culture As CultureInfo) As ReadOnlyCollection(Of InstalledVoice)

매개 변수

culture
CultureInfo

음성을 지원해야 하는 로캘입니다.

반환

ReadOnlyCollection<InstalledVoice>

지정된 로캘을 지원하는 시스템에 현재 설치된 음성의 읽기 전용 컬렉션을 반환합니다.

예제

다음 예제는 초기화 하는 콘솔 애플리케이션의 일부를 SpeechSynthesizer 개체 및 EN-US 로캘을 지 원하는 설치 된 음성의 목록을 콘솔에 출력 합니다.

using System;  
using System.Globalization;  
using System.Speech.Synthesis;  

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

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

        // Output information about all of the installed voices that  
        // support the en-US locale.   
        Console.WriteLine("Installed voices for the en-US locale:");  
        foreach (InstalledVoice voice in  
          synthesizer.GetInstalledVoices(new CultureInfo("en-US")))  
        {  
          VoiceInfo info = voice.VoiceInfo;  
          OutputVoiceInfo(info);  
        }  

        // Output information about the current voice.  
        Console.WriteLine();  
        Console.WriteLine("Current voice:");  
        OutputVoiceInfo(synthesizer.Voice);  
      }  

      Console.WriteLine();  
      Console.WriteLine("Press any key to exit...");  
      Console.ReadKey();  
    }  

    // Display information about a synthesizer voice.  
    private static void OutputVoiceInfo(VoiceInfo info)  
    {  
      Console.WriteLine("  Name: {0}, culture: {1}, gender: {2}, age: {3}.",  
        info.Name, info.Culture, info.Gender, info.Age);  
      Console.WriteLine("    Description: {0}", info.Description);  
    }  
  }  
}  

설명

설치 된 음성이 지정 된 로캘을 지원 하지 않을 경우이 메서드는 빈 컬렉션을 반환 합니다.

Microsoft Windows와 System.Speech API는 모든 유효한 언어-국가 코드를 받습니다. Culture 속성에 지정 된 언어를 사용 하 여 텍스트 음성 변환을 수행 하려면 해당 언어 국가 코드를 지 원하는 음성 합성 엔진을 설치 해야 합니다. Microsoft Windows 7과 함께 제공 되는 음성 합성 엔진은 다음 언어-국가 코드를 사용 하 여 작동 합니다.

  • EN-US입니다. 영어(미국)

  • zh-CN. 중국어(중국)

  • zh-TW. 중국어(대만)

"En"와 같은 두 문자 언어 코드도 허용 됩니다.

추가 정보

적용 대상