言語

Prompt コンストラクター

定義

Prompt クラスの新しいインスタンスを作成します。

オーバーロード

名前 説明
Prompt(PromptBuilder)

Prompt オブジェクトからPromptBuilder クラスの新しいインスタンスを作成します。

Prompt(String)

Prompt クラスの新しいインスタンスを作成し、読み上げるテキストを指定します。

Prompt(String, SynthesisTextFormat)

Prompt クラスの新しいインスタンスを作成し、読み上げるテキストと、その形式がプレーン テキスト言語かマークアップ言語かを指定します。

Prompt(PromptBuilder)

ソース:
Prompt.cs
ソース:
Prompt.cs
ソース:
Prompt.cs
ソース:
Prompt.cs

Prompt オブジェクトから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)

パラメーター

promptBuilder
PromptBuilder

読み上げるコンテンツ。

適用対象

Prompt(String)

ソース:
Prompt.cs
ソース:
Prompt.cs
ソース:
Prompt.cs
ソース:
Prompt.cs

Prompt クラスの新しいインスタンスを作成し、読み上げるテキストを指定します。

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)

パラメーター

textToSpeak
String

再生するテキスト。

次の例では、文字列から Prompt オブジェクトを作成し、そのオブジェクトを引数として Speak メソッドに渡します。

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

適用対象

Prompt(String, SynthesisTextFormat)

ソース:
Prompt.cs
ソース:
Prompt.cs
ソース:
Prompt.cs
ソース:
Prompt.cs

Prompt クラスの新しいインスタンスを作成し、読み上げるテキストと、その形式がプレーン テキスト言語かマークアップ言語かを指定します。

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)

パラメーター

textToSpeak
String

再生するテキスト。

media
SynthesisTextFormat

テキストの形式を指定する値。

次の例では、SSML マークアップを含む文字列を作成し、文字列から Prompt オブジェクトを作成し、プロンプトを読み上けます。

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

注釈

textToSpeak パラメーターの内容には、speak要素を含める必要があり、音声合成マークアップ言語 (SSML) バージョン 1.0 に準拠している必要があります。 詳細については、「 音声合成マークアップ言語リファレンス」を参照してください

適用対象