共用方式為


FilePrompt 建構函式

定義

建立 FilePrompt 類別的新執行個體。

多載

FilePrompt(String, SynthesisMediaType)

建立 FilePrompt 類別的新執行個體,並指定檔案的路徑及其媒體類型。

FilePrompt(Uri, SynthesisMediaType)

建立 FilePrompt 類別的新執行個體,並指定檔案的位置及其媒體類型。

FilePrompt(String, SynthesisMediaType)

來源:
FilePrompt.cs
來源:
FilePrompt.cs
來源:
FilePrompt.cs
來源:
FilePrompt.cs

建立 FilePrompt 類別的新執行個體,並指定檔案的路徑及其媒體類型。

public:
 FilePrompt(System::String ^ path, System::Speech::Synthesis::SynthesisMediaType media);
public FilePrompt (string path, System.Speech.Synthesis.SynthesisMediaType media);
new System.Speech.Synthesis.FilePrompt : string * System.Speech.Synthesis.SynthesisMediaType -> System.Speech.Synthesis.FilePrompt
Public Sub New (path As String, media As SynthesisMediaType)

參數

path
String

包含提示內容的檔案路徑。

media
SynthesisMediaType

檔案的媒體類型。

範例

下列範例會 FilePrompt 建立 物件,指定 SSML 提示字元的路徑。 為了說出提示的內容,此範例接著會提供 FilePrompt 物件做為 方法的 Speak 引數。

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 FilePrompt object that references an SSML prompt.  
                FilePrompt ssmlFile = new FilePrompt("c:\\test\\Weather.ssml", SynthesisMediaType.Ssml);  

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

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

以下是上述範例所參考的 SSML 檔案。

<?xml version="1.0" encoding="ISO-8859-1"?>  
<speak version="1.0"  
 xmlns="http://www.w3.org/2001/10/synthesis"  
 xml:lang="en-US">  

  <s> The weather forecast for today is partly cloudy with some sun breaks. </s>  

</speak>  

備註

您可以使用這個類別,從現有的語音合成標記語言建立物件, (SSML) 檔案 SpeechSynthesizer ,以產生語音。

適用於

FilePrompt(Uri, SynthesisMediaType)

來源:
FilePrompt.cs
來源:
FilePrompt.cs
來源:
FilePrompt.cs
來源:
FilePrompt.cs

建立 FilePrompt 類別的新執行個體,並指定檔案的位置及其媒體類型。

public:
 FilePrompt(Uri ^ promptFile, System::Speech::Synthesis::SynthesisMediaType media);
public FilePrompt (Uri promptFile, System.Speech.Synthesis.SynthesisMediaType media);
new System.Speech.Synthesis.FilePrompt : Uri * System.Speech.Synthesis.SynthesisMediaType -> System.Speech.Synthesis.FilePrompt
Public Sub New (promptFile As Uri, media As SynthesisMediaType)

參數

promptFile
Uri

包含提示內容之檔案的 URI。

media
SynthesisMediaType

檔案的媒體類型。

適用於