SpeechSynthesizer.SetOutputToDefaultAudioDevice Método

Definição

Configura o SpeechSynthesizer objeto para enviar saída para o dispositivo de áudio predefinido.

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

Exemplos

O exemplo seguinte usa o sintetizador para pronunciar uma frase na saída de áudio padrão.

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

Observações

Pode usar a janela Sound no Windows Painel de Controlo para configurar o dispositivo de áudio padrão do computador.

Para outras opções de configuração de saída, veja os SetOutputToAudioStreammétodos , SetOutputToNull, SetOutputToWaveFile, e SetOutputToWaveStream .

Aplica-se a