SpeechSequentialWorkflowActivity.ApplicationHost 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 application host.
Namespace: Microsoft.SpeechServer.Dialog
Assembly: Microsoft.SpeechServer (in microsoft.speechserver.dll)
Syntax
'Declaration
<DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)> _
<BrowsableAttribute(False)> _
Public Property ApplicationHost As IApplicationHost
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)]
[BrowsableAttribute(false)]
public IApplicationHost ApplicationHost { get; }
Property Value
The IApplicationHost for this speech application.
Example
The following example shows the implementation of installTTSVoice, a method that installs a text-to-speech (TTS) voice that matches the target culture and desired gender, if available. This method loops through the installed voices in the synthesizer, searching for a voice in the target culture. After finding a voice in the target culture, it searches for a voice of the target gender. The highlighted line of code shows how this method uses ApplicationHost to set DefaultVoice to the voice that was found.
/// <summary>
/// installTTSVoice - Sets the TelephonySession's Synthesizer members default voice to an
/// installed voice matching at least the target culture.</summary>
/// <param name="targetCulture">CultureInfo object naming the culture to match.</param>
/// <param name="targetGender">VoiceGender object naming the desired voice gender.</param>
/// <remarks>
///<para>The method will install voice matching on culture and gender if available. If a
///voice matching only the culture is available that voice is installed. If a voice
///matching the culture isn't available the current voice is not changed.</para>
/// </remarks>
private Boolean installTTSVoice(CultureInfo targetCulture, VoiceGender targetGender)
{
VoiceInfo candidate = null;
foreach (VoiceInfo vi in this.Synthesizer.InstalledVoices)
{
if (vi.Culture.Equals(targetCulture))
{
if (vi.Gender.Equals(targetGender))
{
candidate = vi;
break;
}
else
{
candidate = vi;
continue;
}
}
}
if (candidate != null)
{
this.ApplicationHost.TelephonySession.Synthesizer.DefaultVoice = candidate;
return true;
}
return false;
}
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
SpeechSequentialWorkflowActivity Class
SpeechSequentialWorkflowActivity Members
Microsoft.SpeechServer.Dialog Namespace
DefaultVoice