Пример #1
0
        public void CancelDestination(TTSDestination destination)
        {
            ReadOnlyCollection <TTSMessage> destCol = GetMessagesFromDestination(destination);

            if (destCol.Count == 0)
            {
                return;
            }

            _client.TTSInitialize();

            vx_tts_status status = VivoxCoreInstance.vx_tts_cancel_all_in_dest(TTSManagerId, (vx_tts_destination)destination);

            if (IsNotTTSError(status))
            {
                foreach (TTSMessage message in destCol)
                {
                    _ttsMessages.Cleanup(message);
                }
            }
            else
            {
                throw new VivoxApiException((int)status);
            }
        }
Пример #2
0
 private bool Equals(TTSMessage other)
 {
     return(ITTSVoice.Equals(Voice, other.Voice) && string.Equals(Text, other.Text) &&
            TTSDestination.Equals(Destination, other.Destination) &&
            TTSMessageState.Equals(State, other.State) && uint.Equals(NumConsumers, other.NumConsumers) &&
            double.Equals(Duration, other.Duration) && uint.Equals(Key, other.Key) &&
            ITextToSpeech.Equals(TTS, other.TTS));
 }
Пример #3
0
        /// <summary>
        /// Creates a new TTS message in the NotEnqueued state.
        /// </summary>
        /// <param name="text">The text to be synthesized into speech.</param>
        /// <param name="name">The destination for this message.</param>
        /// <remarks>
        /// To synthesize this text into speech and inject it into the destination,
        /// use ILoginSession.TTS.Speak(), or ILoginSession.TTS.Messages.Enqueue().
        /// </remarks>
        public TTSMessage(string text, TTSDestination destination)
        {
            if (text.Length > VivoxCoreInstance.VX_TTS_CHARACTER_COUNT_LIMIT)
            {
                throw new ArgumentOutOfRangeException($"{GetType().Name}: {text.Length} exceeds the " +
                                                      $"{VivoxCoreInstance.VX_TTS_CHARACTER_COUNT_LIMIT} maximum characters allowed for input text");
            }

            _text         = text;
            _destination  = destination;
            _voice        = null;
            _state        = TTSMessageState.NotEnqueued;
            _numConsumers = 0;
            _duration     = 0.0;
            _key          = 0;
            _ttsSubSystem = null;
        }
Пример #4
0
 public ReadOnlyCollection <TTSMessage> GetMessagesFromDestination(TTSDestination destination)
 {
     return(_ttsMessages.Where(m => m.Destination == destination).ToList().AsReadOnly());
 }