FilePrompt Constructors
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Creates a new instance of the FilePrompt class.
Overloads
FilePrompt(String, SynthesisMediaType) |
Creates a new instance of the FilePrompt class, and specifies the path to the file and its media type. |
FilePrompt(Uri, SynthesisMediaType) |
Creates a new instance of the FilePrompt class, and specifies the location of the file and its media type. |
FilePrompt(String, SynthesisMediaType)
- Source:
- FilePrompt.cs
- Source:
- FilePrompt.cs
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)
Parameters
- path
- String
The path of the file containing the prompt content.
- media
- SynthesisMediaType
The media type of the file.
Examples
The example that follows creates a FilePrompt object that specifies a path to an SSML prompt. 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();
}
}
}
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>
Remarks
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.
Applies to
FilePrompt(Uri, SynthesisMediaType)
- Source:
- FilePrompt.cs
- Source:
- FilePrompt.cs
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)
Parameters
- promptFile
- Uri
The URI of the file containing the prompt content.
- media
- SynthesisMediaType
The media type of the file.