ardupilot/Tools/ArdupilotMegaPlanner/Speech.cs
Michael Oborne 8b93f0d77e APM Planner 1.1.44
mod antenna tracker code
add extra ch 6 options
cleanup message dialogs better
fix auto fill ch6 and ch7 mode options
add progress to upload and dl wp's
fix disconnect bug on mono
2012-02-29 21:19:54 +08:00

70 lines
1.4 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Speech.Synthesis;
namespace ArdupilotMega
{
public class Speech
{
SpeechSynthesizer _speechwindows;
System.Diagnostics.Process _speechlinux;
bool MONO = false;
public SynthesizerState State {
get {
if (MONO)
{
return SynthesizerState.Ready;
}
else
{
return _speechwindows.State;
}
}
private set { }
}
public Speech()
{
var t = Type.GetType("Mono.Runtime");
MONO = (t != null);
if (MONO)
{
_speechlinux = new System.Diagnostics.Process();
_speechlinux.StartInfo.FileName = "festival";
}
else
{
_speechwindows = new SpeechSynthesizer();
}
}
public void SpeakAsync(string text)
{
if (MONO)
{
}
else
{
_speechwindows.SpeakAsync(text);
}
}
public void SpeakAsyncCancelAll()
{
if (MONO)
{
}
else
{
_speechwindows.SpeakAsyncCancelAll();
}
}
}
}