Ejemplo n.º 1
0
        public static void Initialize(ref IntPtr data, IntPtr rm)
        {
            data = GCHandle.ToIntPtr(GCHandle.Alloc(new Measure()));
            Rainmeter.API api = (Rainmeter.API)rm;

            Measure measure = (Measure)data;

            measure.synth  = new SpeechSynthesizer();
            measure.prompt = new Prompt("");

            measure.voices     = measure.synth.GetInstalledVoices();
            measure.voiceCount = measure.voices.Count;

            measure.synth.SetOutputToDefaultAudioDevice();

            int debug = api.ReadInt("Debug", 0);

            if (debug == 1)
            {
                api.Log(API.LogType.Notice, "------------------------------");
                api.Log(API.LogType.Notice, "* Speech.dll - GetInstalledVoices() API");

                int index = 1;
                foreach (InstalledVoice voice in measure.voices)
                {
                    VoiceInfo info = voice.VoiceInfo;

                    api.LogF(API.LogType.Notice, "Index: {0}", index);
                    api.LogF(API.LogType.Notice, "  Name          : {0}", info.Name);
                    api.LogF(API.LogType.Notice, "  Gender        : {0}", info.Gender);
                    api.LogF(API.LogType.Notice, "  Culture       : {0}", info.Culture);
                    api.LogF(API.LogType.Notice, "  Age           : {0}", info.Age);
                    api.LogF(API.LogType.Notice, "  Description   : {0}", info.Description);
                    api.LogF(API.LogType.Notice, "  ID            : {0}", info.Id);
                    api.LogF(API.LogType.Notice, "  Enabled       : {0}", voice.Enabled);

                    ++index;
                }

                api.Log(API.LogType.Notice, "------------------------------");
            }
        }