SpeechSynthesizer.SetOutputToDefaultAudioDevice Methode

Definition

Konfiguriert das SpeechSynthesizer-Objekt, um die Ausgabe zum Audiogerät zu senden.

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

Beispiele

Im folgenden Beispiel wird der Synthesizer verwendet, um einen Ausdruck für die standardmäßige Audioausgabe zu sprechen.

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

Hinweise

Sie können das Sound Fenster in der Windows- Systemsteuerung verwenden, um das Standardaudiogerät für den Computer zu konfigurieren.

Informationen zu anderen Ausgabe Konfigurationsoptionen finden Sie in den SetOutputToAudioStream SetOutputToNull Methoden,, SetOutputToWaveFile und SetOutputToWaveStream .

Gilt für