ISynthesizer.SpeakCompleted Event
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
Occurs when the playing of a prompt is complete.
Namespace: Microsoft.SpeechServer.Synthesis
Assembly: Microsoft.SpeechServer (in microsoft.speechserver.dll)
Syntax
'Declaration
Event SpeakCompleted As EventHandler(Of SpeakCompletedEventArgs)
event EventHandler<SpeakCompletedEventArgs> SpeakCompleted
Example
using System;
using System.Collections.Generic;
using System.Text;
using System.Workflow.Activities;
using System.Workflow.ComponentModel;
using Microsoft.SpeechServer.Dialog;
using Microsoft.SpeechServer.Recognition;
using Microsoft.SpeechServer.Synthesis;
namespace YourSpeechApplicationNamespace
{
/// <summary>
/// Activity deriving from SpeechCompositeActivity.
/// </summary>
public class ISynthesizer_SpeakAsync2 : SpeechCompositeActivity
{
/// <summary>
/// Prompt played by the activity.
/// </summary>
public const string pt = "This is the prompt text. ";
/// <summary>
/// Creates a new instance.
/// </summary>
public ISynthesizer_SpeakAsync2()
{
}
/// <summary>
/// Executes the activity.
/// </summary>
/// <param name="executionContext">The execution context</param>
protected override void ExecuteCore(ActivityExecutionContext executionContext)
{
// Specify the event-handler and play the prompt
Workflow.Synthesizer.SpeakCompleted += Synthesizer_SpeakCompleted;
Workflow.Synthesizer.SpeakAsync(pt,SynthesisTextFormat.PlainText);
}
/// <summary>
/// Closes the activity.
/// </summary>
/// <param name="sender">The synthesizer</param>
/// <param name="e">The result of SpeakAsync</param>
private void Synthesizer_SpeakCompleted(object sender, SpeakCompletedEventArgs e)
{
// Remove this event-handler
Workflow.Synthesizer.SpeakCompleted -= Synthesizer_SpeakCompleted;
// End the custom activity
Close(e.Error);
}
}
}
Remarks
The event handler for SpeakCompleted returns a SpeakCompletedEventArgs object.
Platforms
Development Platforms
Windows XP Professional with Service Pack 2 (SP2), Windows Server 2003, Windows Vista Ultimate Edition, Windows Vista Business Edition, Windows Vista Enterprise Edition
Target Platforms
Windows Server 2003
See Also
Reference
ISynthesizer Interface
ISynthesizer Members
Microsoft.SpeechServer.Synthesis Namespace