Opentk/Source/OpenTK/Platform/MacOS/CarbonBindings/SpeechChannel.cs
the_fiddler 783c38446b Marked platform-specific APIs as internal.
Added ObsoleteAttribute to obsolete functionality.
2009-06-04 11:21:33 +00:00

38 lines
954 B
C#

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text;
namespace OpenTK.Platform.MacOS.Carbon
{
internal class SpeechChannel
{
private IntPtr _id;
protected const string appServicesPath = "/System/Library/Frameworks/ApplicationServices.framework/Versions/Current/ApplicationServices";
[DllImport(appServicesPath)]
private static extern short NewSpeechChannel(IntPtr voice, ref IntPtr result);
[DllImport(appServicesPath)]
private static extern short SpeakText(IntPtr channel, String text, long length);
public SpeechChannel()
{
short rc = NewSpeechChannel((IntPtr)null, ref _id);
Debug.WriteLine(rc);
}
public bool Speak(String text)
{
short rc = SpeakText(_id, text, (long)text.Length);
return (rc == 0);
}
}
}