コード例 #1
0
        /// <summary>
        /// Retrieves all supported voices of the current engine.
        /// </summary>
        /// <since_tizen> 3 </since_tizen>
        /// <returns>
        /// The list of SupportedVoice.
        /// </returns>
        /// <feature>
        /// http://tizen.org/feature/speech.synthesis
        /// </feature>
        /// <exception cref="InvalidOperationException">
        /// This exception can be due to the following reasons:
        /// 1. Engine Not Found
        /// 2. Operation Failed
        /// </exception>
        /// <exception cref="NotSupportedException">This exception can be due to TTS not supported.</exception>
        public IEnumerable <SupportedVoice> GetSupportedVoices()
        {
            List <SupportedVoice> voicesList = new List <SupportedVoice>();

            _supportedvoiceDelegate = (IntPtr handle, IntPtr language, int voiceType, IntPtr userData) =>
            {
                string         lang  = Marshal.PtrToStringAnsi(language);
                SupportedVoice voice = new SupportedVoice(lang, voiceType);
                voicesList.Add(voice);
                return(true);
            };
            TtsError error = TtsForeachSupportedVoices(_handle, _supportedvoiceDelegate, IntPtr.Zero);

            if (error != TtsError.None)
            {
                Log.Error(LogTag, "GetSupportedVoices Failed with error " + error);
                throw ExceptionFactory.CreateException(error);
            }

            return(voicesList);
        }
コード例 #2
0
 internal static extern TtsError TtsForeachSupportedVoices(IntPtr handle, TtsSupportedVoiceCB callback, IntPtr userData);