예제 #1
0
        /// <summary>
        /// Enqueues an utterance to be spoken using a specific voice object
        /// </summary>
        /// <param name="speechString">The text to be spoken in the utterance.</param>
        /// <param name="voice">The voice used to speak the utterance.</param>
        public static void Speak(string speechString, ISpeechSynthesisVoice voice)
        {
            var speechUtteranceSettings = new SpeechUtteranceParameters
            {
                PitchMultiplier    = DefaultParameters.PitchMultiplier,
                PreUtteranceDelay  = DefaultParameters.PreUtteranceDelay,
                PostUtteranceDelay = DefaultParameters.PostUtteranceDelay,
                SpeechRate         = DefaultParameters.SpeechRate,
                Voice  = voice,
                Volume = DefaultParameters.Volume
            };

            Speak(speechString, speechUtteranceSettings);
        }
예제 #2
0
        private ReadOnlyCollection <ISpeechSynthesisVoice> InitializeVoices()
        {
            var availableVoicesCount = TTS_iOS.GetNumberOfAvailableVoices();
            var availableVoices      = new ISpeechSynthesisVoice[availableVoicesCount];

            for (var voiceIndex = 0; voiceIndex < availableVoicesCount; voiceIndex++)
            {
                var identifier = TTS_iOS.GetVoiceIdentifier(voiceIndex);
                var name       = TTS_iOS.GetVoiceName(voiceIndex);
                var language   = TTS_iOS.GetVoiceLanguage(voiceIndex);
                var quality    = TTS_iOS.GetVoiceQuality(voiceIndex);
                availableVoices[voiceIndex] =
                    new SpeechSynthesisVoice(identifier, name, language, (VoiceQuality)quality);
            }

            return(new ReadOnlyCollection <ISpeechSynthesisVoice>(availableVoices));
        }