PromptBuilder.StartStyle(PromptStyle) 方法

定義

指定 PromptBuilder 物件中的樣式開頭。Specifies the start of a style in the PromptBuilder object.

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

要啟動的樣式。The style to start.

範例

下列範例會建立PromptBuilder物件, 並附加文字字串。The following example creates a PromptBuilder object and appends text strings. 此範例會使用StartStyle方法來指定所要加入字串的緩慢說話速率, 以列舉訂單的內容。The example uses the StartStyle method to specify a slow speaking rate for the string being added, which enumerates the contents of an order.

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為其引數。The StartStyle method takes a PromptStyle object as its argument. 您可以使用PromptStyle物件的屬性, 在樣式生效時, 設定要套用至語音輸出的強調、說話速率和音量 (音量)。You can use the properties of the PromptStyle object to set the emphasis, speaking rate, and volume (loudness) to apply to speech output while the style is in effect. 若要停止使用目前的樣式, 請EndStyle呼叫方法。To stop using the current style, call the EndStyle method.

注意

  • Windows 中的語音合成引擎目前不支援強調參數。The speech synthesis engines in Windows do not support the emphasis parameter at this time. 設定強調參數的值將不會在合成的語音輸出中產生任何可聽見的變更。Setting values for the emphasis parameter will produce no audible change in the synthesized speech output.
  • Default ExtraLoud設定是[完整磁片區],PromptVolume這與相同。The Default setting for PromptVolume is full volume, which is the same as ExtraLoud. 其他設定會減少相對於完整磁片區的語音輸出量。The other settings decrease the volume of speech output relative to full volume.

適用於