PromptStyle 建構函式

定義

初始化 PromptStyle 類別的新執行個體。

多載

PromptStyle()

初始化 PromptStyle 類別的新執行個體。

PromptStyle(PromptEmphasis)

初始化 PromptStyle 類別的新執行個體,並指定樣式強調設定。

PromptStyle(PromptRate)

初始化 PromptStyle 類別的新執行個體,並指定樣式的說話速率設定。

PromptStyle(PromptVolume)

初始化 PromptStyle 類別的新執行個體,並指定樣式的說話音量設定。

PromptStyle()

來源:
PromptStyle.cs
來源:
PromptStyle.cs
來源:
PromptStyle.cs

初始化 PromptStyle 類別的新執行個體。

public:
 PromptStyle();
public PromptStyle ();
Public Sub New ()

適用於

PromptStyle(PromptEmphasis)

來源:
PromptStyle.cs
來源:
PromptStyle.cs
來源:
PromptStyle.cs

初始化 PromptStyle 類別的新執行個體,並指定樣式強調設定。

public:
 PromptStyle(System::Speech::Synthesis::PromptEmphasis emphasis);
public PromptStyle (System.Speech.Synthesis.PromptEmphasis emphasis);
new System.Speech.Synthesis.PromptStyle : System.Speech.Synthesis.PromptEmphasis -> System.Speech.Synthesis.PromptStyle
Public Sub New (emphasis As PromptEmphasis)

參數

emphasis
PromptEmphasis

樣式的強調設定。

備註

Windows 中的語音合成引擎目前不支援語音輸出的強調變化。 使用列舉成員 PromptEmphasis 設定強調的值,在合成語音輸出中不會產生任何可聽見的變更。

適用於

PromptStyle(PromptRate)

來源:
PromptStyle.cs
來源:
PromptStyle.cs
來源:
PromptStyle.cs

初始化 PromptStyle 類別的新執行個體,並指定樣式的說話速率設定。

public:
 PromptStyle(System::Speech::Synthesis::PromptRate rate);
public PromptStyle (System.Speech.Synthesis.PromptRate rate);
new System.Speech.Synthesis.PromptStyle : System.Speech.Synthesis.PromptRate -> System.Speech.Synthesis.PromptStyle
Public Sub New (rate As PromptRate)

參數

rate
PromptRate

樣式的讀出速率設定。

範例

下列範例會 PromptBuilder 建立 物件並附加文字字串。 此範例會使用 建 PromptStyle 構函式做為 方法的引數 StartStyle ,來指定所新增字串的慢速說話速率,以列舉順序的內容。

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 PromptBuilder object and add content.  
        PromptBuilder style = new PromptBuilder();  
        style.AppendText("Your order for");  
        style.StartStyle(new PromptStyle(PromptRate.Slow));  
        style.AppendText("one kitchen sink and one faucet");  
        style.EndStyle();  
        style.AppendText("has been confirmed.");  

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

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

適用於

PromptStyle(PromptVolume)

來源:
PromptStyle.cs
來源:
PromptStyle.cs
來源:
PromptStyle.cs

初始化 PromptStyle 類別的新執行個體,並指定樣式的說話音量設定。

public:
 PromptStyle(System::Speech::Synthesis::PromptVolume volume);
public PromptStyle (System.Speech.Synthesis.PromptVolume volume);
new System.Speech.Synthesis.PromptStyle : System.Speech.Synthesis.PromptVolume -> System.Speech.Synthesis.PromptStyle
Public Sub New (volume As PromptVolume)

參數

volume
PromptVolume

樣式的音量 (大小聲) 設定。

範例

下列範例會使用 建 PromptStyle 構函式來指定 應套用至語音輸出的磁片區設定 SpeechSynthesizer

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 a prompt that applies different volume settings.  
        PromptBuilder builder = new PromptBuilder();  
        builder.StartStyle(new PromptStyle(PromptVolume.Default));  
        builder.AppendText("This is the default speaking volume.");  
        builder.EndStyle();  
        builder.AppendBreak();  
        builder.StartStyle(new PromptStyle(PromptVolume.ExtraLoud));  
        builder.AppendText("This is the extra-loud speaking volume.");  
        builder.EndStyle();  
        builder.AppendBreak();  
        builder.StartStyle(new PromptStyle(PromptVolume.Medium));  
        builder.AppendText("This is the medium speaking volume.");  
        builder.EndStyle();  

        // Speak the prompt.  
        synth.Speak(builder);  
      }  

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

備註

DefaultPromptVolume 設定為完整磁片區,與 相同 ExtraLoud 。 其他設定會減少相對於完整音量的語音輸出量。

另請參閱

適用於