Пример #1
0
        /// <summary>
        /// Get the list of available installed voices.
        /// </summary>
        /// <returns></returns>
        internal Dictionary <string, AvailableVoice> GetVoices()
        {
            Dictionary <string, AvailableVoice> names = new Dictionary <string, AvailableVoice>();

            NSArray insVoices = NSSpeechSynthesizer.AvailableVoices;

            foreach (NSString name in insVoices)
            {
                bool skip = false;

                // Check for additional information about this voice
                if (voiceProperties != null)
                {
                    string propString = voiceProperties[name].AsString();
                    if (propString != null)
                    {
                        // Properties are a series of blank-separated keywords
                        string[] props = propString.Split(' ');

                        foreach (string key in props)
                        {
                            switch (key)
                            {
                            case "ignore":
                                skip = true;
                                break;
                            }
                        }
                    }
                }

                // If this voice is not blocked add it to the list.
                if (!skip)
                {
                    names[name] = new MacAvailableVoice(name);
                }
            }

            return(names);
        }
Пример #2
0
        /// <summary>
        /// Get the list of available installed voices.
        /// </summary>
        /// <returns></returns>
        internal Dictionary<string, AvailableVoice> GetVoices()
        {
            Dictionary<string, AvailableVoice> names = new Dictionary<string, AvailableVoice>();

            NSArray insVoices = NSSpeechSynthesizer.AvailableVoices;
            foreach (NSString name in insVoices)
            {
                bool skip = false;

                // Check for additional information about this voice
                if (voiceProperties != null)
                {
                    string propString = voiceProperties[name].AsString();
                    if (propString != null)
                    {
                        // Properties are a series of blank-separated keywords
                        string[] props = propString.Split(' ');

                        foreach (string key in props)
                        {
                            switch (key)
                            {
                                case "ignore":
                                    skip = true;
                                    break;
                            }
                        }
                    }
                }

                // If this voice is not blocked add it to the list.
                if (!skip)
                {
                    names[name] = new MacAvailableVoice(name);
                }
            }

            return names;
        }