語言

PromptBuilder.StartStyle(PromptStyle) 方法

定義

指定物件中 PromptBuilder 樣式的起始。

public:
 void StartStyle(System::Speech::Synthesis::PromptStyle ^ style);
public void StartStyle(System.Speech.Synthesis.PromptStyle style);
member this.StartStyle : System.Speech.Synthesis.PromptStyle -> unit
Public Sub StartStyle (style As PromptStyle)

參數

style
PromptStyle

從風格開始。

範例

以下範例建立物件 PromptBuilder 並附加文字字串。 範例中使用此 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();
    }
  }
}

備註

此 StartStyle 方法以 PromptStyle 物件為參數。 你可以利用物件的 PromptStyle 屬性設定強調、說話速度和音量(響度),在風格生效時套用到語音輸出上。 要停止使用目前的樣式,請呼叫該 EndStyle 方法。

Note

  • Windows 中的語音合成引擎目前不支援強調參數。 設定強調參數的值不會對合成語音輸出產生可聽見的變化。
  • Default的PromptVolume設定是 Full volume,這和 ExtraLoud。 其他設定則是將語音輸出音量相較於最大音量降低。

適用於