SpeechSynthesizer.SetOutputToDefaultAudioDevice Método

Definição

Configura o objeto SpeechSynthesizer para enviar a saída para o dispositivo de áudio padrão.Configures the SpeechSynthesizer object to send output to the default audio device.

public:
 void SetOutputToDefaultAudioDevice();
public void SetOutputToDefaultAudioDevice ();
member this.SetOutputToDefaultAudioDevice : unit -> unit
Public Sub SetOutputToDefaultAudioDevice ()

Exemplos

O exemplo a seguir usa o sintetizador para falar uma frase para a saída de áudio padrão.The following example uses the synthesizer to speak a phrase to the default audio output.

using System;  
using System.Speech.Synthesis;  

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

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

        // Configure the synthesizer to send output to the default audio device.  
        synth.SetOutputToDefaultAudioDevice();  

        // Speak a phrase.  
        synth.Speak("This is sample text-to-speech output.");  
      }  

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

Comentários

Você pode usar a janela de som no painel de controle do Windows para configurar o dispositivo de áudio padrão para o computador.You can use the Sound window in the Windows Control Panel to configure the default audio device for the computer.

Para obter outras opções de configuração de saída, consulte os SetOutputToAudioStream métodos,, SetOutputToNull SetOutputToWaveFile e SetOutputToWaveStream .For other output configuration options, see the SetOutputToAudioStream, SetOutputToNull, SetOutputToWaveFile, and SetOutputToWaveStream methods.

Aplica-se a