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 方法。

注意

  • Windows 中的語音合成引擎目前不支援強調參數。 在合成語音輸出中,設定強調參數的值不會產生任何可聽見的變更。
  • Default 設定 PromptVolume 為完整磁片區,其與 相同 ExtraLoud 。 其他設定會減少相對於完整音量的語音輸出量。

適用於