Prompt Constructeurs

Définition

Crée une instance de la classe Prompt.

Surcharges

Prompt(PromptBuilder)

Crée une instance de la classe Prompt à partir d’un objet PromptBuilder.

Prompt(String)

Crée une instance de la classe Prompt et spécifie le texte à énoncer.

Prompt(String, SynthesisTextFormat)

Crée une instance de la classe Prompt, spécifie le texte à énoncer et indique si celui-ci se présente sous la forme de texte brut ou de langage de balisage.

Prompt(PromptBuilder)

Source:
Prompt.cs
Source:
Prompt.cs
Source:
Prompt.cs

Crée une instance de la classe Prompt à partir d’un objet PromptBuilder.

public:
 Prompt(System::Speech::Synthesis::PromptBuilder ^ promptBuilder);
public Prompt (System.Speech.Synthesis.PromptBuilder promptBuilder);
new System.Speech.Synthesis.Prompt : System.Speech.Synthesis.PromptBuilder -> System.Speech.Synthesis.Prompt
Public Sub New (promptBuilder As PromptBuilder)

Paramètres

promptBuilder
PromptBuilder

Contenu à énoncer.

S’applique à

Prompt(String)

Source:
Prompt.cs
Source:
Prompt.cs
Source:
Prompt.cs

Crée une instance de la classe Prompt et spécifie le texte à énoncer.

public:
 Prompt(System::String ^ textToSpeak);
public Prompt (string textToSpeak);
new System.Speech.Synthesis.Prompt : string -> System.Speech.Synthesis.Prompt
Public Sub New (textToSpeak As String)

Paramètres

textToSpeak
String

Le texte à énoncer.

Exemples

L’exemple suivant crée un Prompt objet à partir d’une chaîne et transmet l’objet en tant qu’argument à la Speak méthode .

using System;  
using System.Speech.Synthesis;  

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

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

        // Configure the audio output.   
        synth.SetOutputToDefaultAudioDevice();  

        // Create a prompt from a string.  
        Prompt color = new Prompt("What is your favorite color?");  

        // Speak the contents of the prompt synchronously.  
        synth.Speak(color);  
      }  

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

S’applique à

Prompt(String, SynthesisTextFormat)

Source:
Prompt.cs
Source:
Prompt.cs
Source:
Prompt.cs

Crée une instance de la classe Prompt, spécifie le texte à énoncer et indique si celui-ci se présente sous la forme de texte brut ou de langage de balisage.

public:
 Prompt(System::String ^ textToSpeak, System::Speech::Synthesis::SynthesisTextFormat media);
public Prompt (string textToSpeak, System.Speech.Synthesis.SynthesisTextFormat media);
new System.Speech.Synthesis.Prompt : string * System.Speech.Synthesis.SynthesisTextFormat -> System.Speech.Synthesis.Prompt
Public Sub New (textToSpeak As String, media As SynthesisTextFormat)

Paramètres

textToSpeak
String

Le texte à énoncer.

media
SynthesisTextFormat

Valeur qui spécifie le format du texte.

Exemples

L’exemple suivant génère une chaîne qui contient le balisage SSML, crée un Prompt objet à partir de la chaîne et prononce l’invite.

using System;  
using System.Speech.Synthesis;  

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

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

        // Configure the audio output.   
        synth.SetOutputToDefaultAudioDevice();  

        // Build an SSML prompt in a string.  
        string fileName = "<speak version=\"1.0\" ";  
        fileName += "xmlns=\"http://www.w3.org/2001/10/synthesis\" ";  
        fileName += "xml:lang=\"en-US\">";  
        fileName += "Say a name for the new file <mark name=\"fileName\" />.";  
        fileName += "</speak>";  

        // Create a Prompt object from the string.  
        Prompt ssmlFile = new Prompt(fileName, SynthesisTextFormat.Ssml);  

        // Speak the contents of the SSML prompt.  
        synth.Speak(ssmlFile);  
      }  

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

Remarques

Le contenu du textToSpeak paramètre doit inclure un speak élément et doit être conforme à SSML (Speech Synthesis Markup Language) version 1.0. Pour plus d’informations, consultez Informations de référence sur le langage de balisage de synthèse vocale.

S’applique à