00001 using System;
00002 using System.Collections.Generic;
00003 using System.Diagnostics;
00004 using System.Runtime.InteropServices;
00005 using System.Text;
00006
00007 namespace OpenTK.Platform.MacOS.Carbon
00008 {
00009
00010 internal class SpeechChannel
00011 {
00012
00013 private IntPtr _id;
00014
00015 protected const string appServicesPath = "/System/Library/Frameworks/ApplicationServices.framework/Versions/Current/ApplicationServices";
00016
00017 [DllImport(appServicesPath)]
00018 private static extern short NewSpeechChannel(IntPtr voice, ref IntPtr result);
00019
00020
00021 [DllImport(appServicesPath)]
00022 private static extern short SpeakText(IntPtr channel, String text, long length);
00023
00024 public SpeechChannel()
00025 {
00026 short rc = NewSpeechChannel((IntPtr)null, ref _id);
00027 Debug.WriteLine(rc);
00028 }
00029
00030 public bool Speak(String text)
00031 {
00032 short rc = SpeakText(_id, text, (long)text.Length);
00033 return (rc == 0);
00034 }
00035
00036 }
00037 }