Пример #1
0
        /// <summary>
        /// Enqueues an utterance to be spoken with using specific parameters
        /// </summary>
        /// <param name="speechUtterance">A chunk of text to be spoken, along with parameters that affect its speech.</param>
        public static void Speak(SpeechUtterance speechUtterance)
        {
            var voiceIdentifier = speechUtterance.Voice == null ? string.Empty : speechUtterance.Voice.Identifier;

            TTS_iOS.Speak(speechUtterance.SpeechString, speechUtterance.PitchMultiplier,
                          speechUtterance.PreUtteranceDelay, speechUtterance.PostUtteranceDelay, speechUtterance.SpeechRate,
                          voiceIdentifier, speechUtterance.Volume);
        }
Пример #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));
        }
Пример #3
0
 private void SetupCallbacks()
 {
     TTS_iOS.SetupCallbacks(OnSpeechCancelledCallback, OnSpeechContinuedCallback,
                            OnSpeechFinishedCallback, OnSpeechPausedCallback, OnSpeechStartedCallback, OnWillSpeakCallback);
 }
Пример #4
0
        /// <summary>
        /// Returns a voice object for the specified language and locale.
        /// </summary>
        /// <param name="language">A BCP 47 code specifying language and locale for a voice.</param>
        /// <returns>Returns null if no voice available for the specified language</returns>
        public static ISpeechSynthesisVoice GetVoiceForLanguage(string language)
        {
            var voiceId = TTS_iOS.GetVoiceIdentifierFromLanguageCode(language);

            return(AllAvailableVoices.FirstOrDefault(voice => voice.Identifier == voiceId));
        }
Пример #5
0
 /// <summary>
 /// Stops all speech at the specified boundary constraint.
 /// </summary>
 /// <param name="speechBoundary">A constant describing whether speech should stop immediately or only after finishing the word currently being spoken.</param>
 /// <returns>true if speech has stopped, or false otherwise.</returns>
 public static bool Stop(SpeechBoundary speechBoundary)
 {
     return(TTS_iOS.StopSpeaking(speechBoundary));
 }
Пример #6
0
 /// <summary>
 ///  Stops all speech at default boundary constraints.
 /// </summary>
 /// <returns>true if speech has stopped, or false otherwise.</returns>
 public static bool Stop()
 {
     return(TTS_iOS.StopSpeaking(DefaultSpeechBoundaryForStop));
 }
Пример #7
0
 /// <summary>
 /// Pauses speech at the specified boundary constraint.
 /// </summary>
 /// <param name="speechBoundary">A constant describing whether speech should pause immediately or only after finishing the word currently being spoken.</param>
 /// <returns>true if speech has paused, or false otherwise.</returns>
 public static bool Pause(SpeechBoundary speechBoundary)
 {
     return(TTS_iOS.PauseSpeaking(speechBoundary));
 }
Пример #8
0
 /// <summary>
 ///  Pauses speech at default boundary constraints.
 /// </summary>
 /// <returns>true if speech has paused, or false otherwise.</returns>
 public static bool Pause()
 {
     return(TTS_iOS.PauseSpeaking(DefaultSpeechBoundaryForPause));
 }
Пример #9
0
 /// <summary>
 /// Continues speech from the point at which it left off.
 /// </summary>
 /// <returns>true if speech has continued, or false otherwise.</returns>
 public static bool Continue()
 {
     return(TTS_iOS.ContinueSpeaking());
 }