ISynthesizer.Volume Property
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.
Gets the volume of the Synthesizer.
Namespace: Microsoft.SpeechServer.Synthesis
Assembly: Microsoft.SpeechServer (in microsoft.speechserver.dll)
Syntax
'Declaration
ReadOnly Property Volume As Single
float Volume { get; }
Property Value
The volume of the Synthesizer.
Remarks
The Volume property is read-only. Use the ChangeVolume method to change the value of Volume.
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.Synthesis;
namespace YourSpeechApplicationNamespace
{
/// <summary>
/// Activity deriving from SpeechCompositeActivity.
/// </summary>
public class ISynthesizer_Volume : SpeechCompositeActivity
{
/// <summary>
/// Prompt played by the activity.
/// </summary>
const string Prompt1 = "This is a prompt with increased volume. ";
const string Prompt2 = "This is a prompt with normal volume. ";
Single value;
/// <summary>
/// Creates a new instance.
/// </summary>
public ISynthesizer_Volume()
{
}
/// <summary>
/// Plays the second prompt.
/// </summary>
/// <param name="executionContext">The execution context</param>
protected override void ExecuteCore(ActivityExecutionContext executionContext)
{
// Increase volume for the first prompt
value = Workflow.Synthesizer.Volume;
Workflow.Synthesizer.ChangeVolume(value + 2);
// Specify event-handler and play first prompt
Workflow.Synthesizer.SpeakCompleted += Synthesizer_SpeakCompleted1;
Workflow.Synthesizer.SpeakAsync(Prompt1, SynthesisTextFormat.PlainText);
}
/// <summary>
/// Closes the activity.
/// </summary>
/// <param name="sender">The synthesizer</param>
/// <param name="e">The result of SpeakAsync</param>
private void Synthesizer_SpeakCompleted1(object sender, SpeakCompletedEventArgs e)
{
// Remove this event-handler
Workflow.Synthesizer.SpeakCompleted -= Synthesizer_SpeakCompleted1;
// Restore default volume for the second prompt
Workflow.Synthesizer.ChangeVolume(value);
// Specify event-handler and play second prompt
Workflow.Synthesizer.SpeakCompleted += Synthesizer_SpeakCompleted2;
Workflow.Synthesizer.SpeakAsync(Prompt2, SynthesisTextFormat.PlainText);
}
/// <summary>
/// Closes the activity.
/// </summary>
/// <param name="sender">The synthesizer</param>
/// <param name="e">The result of SpeakAsync</param>
private void Synthesizer_SpeakCompleted2(object sender, SpeakCompletedEventArgs e)
{
// Remove this event-handler
Workflow.Synthesizer.SpeakCompleted -= Synthesizer_SpeakCompleted2;
// End the custom activity
Close(e.Error);
}
}
}
Thread Safety
All public static (Shared in Visual Basic) members of this type are thread-safe. Instance members are not guaranteed to be thread-safe.
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