SpeechSynthesizer.Volume 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置 SpeechSynthesizer 对象的输出量。
public:
property int Volume { int get(); void set(int value); };
public int Volume { get; set; }
member this.Volume : int with get, set
Public Property Volume As Integer
属性值
返回 SpeechSynthesizer 的量(0 到 100)。
示例
下面的示例设置 SpeechSynthesizer 合成声音和 WAV 文件的音频输出量。
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();
// Set the volume of the SpeechSynthesizer's ouput.
synth.Volume = 60;
// Build a prompt containing recorded audio and synthesized speech.
PromptBuilder builder = new PromptBuilder(
new System.Globalization.CultureInfo("en-US"));
builder.AppendAudio("C:\\Test\\WelcomeToContosoRadio.wav");
builder.AppendText(
"The weather forecast for today is partly cloudy with some sun breaks.");
// Speak the prompt.
synth.Speak(builder);
}
Console.WriteLine();
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}
}
}