SpeechSynthesizer.SetOutputToDefaultAudioDevice Méthode

Définition

Configure l’objet pour envoyer la SpeechSynthesizer sortie à l’appareil audio par défaut.

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

Exemples

L’exemple suivant utilise le synthétiseur pour parler une expression à la sortie audio par défaut.

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

Remarques

Vous pouvez utiliser la fenêtre Sound dans la fenêtre Windows Panneau de configuration pour configurer l’appareil audio par défaut pour l’ordinateur.

Pour obtenir d’autres options de configuration de sortie, consultez les méthodes et les SetOutputToAudioStreamméthodesSetOutputToNullSetOutputToWaveFileSetOutputToWaveStream.

S’applique à