FilePrompt 建構函式

定義

建立 FilePrompt 類別的新執行個體。Creates a new instance of the FilePrompt class.

多載

FilePrompt(String, SynthesisMediaType)

建立 FilePrompt 類別的新執行個體,並指定檔案的路徑及其媒體類型。Creates a new instance of the FilePrompt class, and specifies the path to the file and its media type.

FilePrompt(Uri, SynthesisMediaType)

建立 FilePrompt 類別的新執行個體,並指定檔案的位置及其媒體類型。Creates a new instance of the FilePrompt class, and specifies the location of the file and its media type.

FilePrompt(String, SynthesisMediaType)

建立 FilePrompt 類別的新執行個體,並指定檔案的路徑及其媒體類型。Creates a new instance of the FilePrompt class, and specifies the path to the file and its media type.

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

包含提示內容的檔案路徑。The path of the file containing the prompt content.

media
SynthesisMediaType

檔案的媒體類型。The media type of the file.

範例

接下來的範例會建立FilePrompt物件, 指定 SSML 提示字元的路徑。The example that follows creates a FilePrompt object that specifies a path to an SSML prompt. 為了說出提示的內容, 此範例會提供FilePrompt物件做為Speak方法的引數。To speak the contents of the prompt, the example then provides the FilePrompt object as the argument to the Speak method.

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 檔案。The following is the SSML file that the preceding example references.

<?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>  

備註

您可以使用這個類別, 從現有的SpeechSynthesizer語音合成標記語言 (SSML) 檔案中建立物件, 該檔案可供用來產生語音。You can use this class to create an object from an existing Speech Synthesis Markup Language (SSML) file that the SpeechSynthesizer can consume to generate speech.

FilePrompt(Uri, SynthesisMediaType)

建立 FilePrompt 類別的新執行個體,並指定檔案的位置及其媒體類型。Creates a new instance of the FilePrompt class, and specifies the location of the file and its media type.

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。The URI of the file containing the prompt content.

media
SynthesisMediaType

檔案的媒體類型。The media type of the file.

適用於