Exemplo n.º 1
0
        //ncrunch: no coverage end

        #region VAD subscribers
        public void Subscribe([NotNull] IVoiceActivationListener listener)
        {
            if (listener == null)
            {
                throw new ArgumentNullException("listener", "Cannot subscribe with a null listener");
            }

            _activationListeners.Add(listener);

            if (_preprocessor != null)
            {
                _preprocessor.Subscribe(listener);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Unsubsribes from automatic voice detection.
        /// </summary>
        /// <param name="listener"></param>
        public void UnsubscribeFromVoiceActivation(IVoiceActivationListener listener)
        {
            if (listener == null)
            {
                throw new ArgumentNullException("listener", "Cannot unsubscribe with a null listener");
            }

            _activationListeners.Remove(listener);

            if (MicCapture != null)
            {
                MicCapture.Unsubscribe(listener);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        ///     Subscribes to automatic voice detection.
        /// </summary>
        /// <param name="listener">
        ///     The listener which is to receive notification when the player starts and stops speaking via
        ///     automatic voice detection.
        /// </param>
        public void SubcribeToVoiceActivation(IVoiceActivationListener listener)
        {
            if (listener == null)
            {
                throw new ArgumentNullException("listener", "Cannot subscribe with a null listener");
            }

            if (MicCapture == null)
            {
                _activationListeners.Add(listener);
            }
            else
            {
                MicCapture.Subscribe(listener);
            }
        }
Exemplo n.º 4
0
        public virtual void Subscribe([NotNull] IVoiceActivationListener listener)
        {
            if (listener == null)
            {
                throw new ArgumentNullException("listener");
            }

            using (var subs = _vadSubscriptions.Lock())
            {
                subs.Value.Add(listener);
                Interlocked.Increment(ref _vadSubscriptionCount);

                if (VadIsSpeechDetected)
                {
                    SendStartedTalking(listener);
                }
            }
        }
Exemplo n.º 5
0
        public virtual bool Unsubscribe([NotNull] IVoiceActivationListener listener)
        {
            if (listener == null)
            {
                throw new ArgumentNullException("listener");
            }

            using (var subs = _vadSubscriptions.Lock())
            {
                var removed = subs.Value.Remove(listener);
                if (removed)
                {
                    Interlocked.Decrement(ref _vadSubscriptionCount);

                    if (VadIsSpeechDetected)
                    {
                        SendStoppedTalking(listener);
                    }
                }
                return(removed);
            }
        }
Exemplo n.º 6
0
 /// <summary>
 ///     Unsubsribes from automatic voice detection.
 /// </summary>
 /// <param name="listener"></param>
 public void UnsubscribeFromVoiceActivation([NotNull] IVoiceActivationListener listener)
 {
     _capture.Unsubscribe(listener);
 }
Exemplo n.º 7
0
 /// <summary>
 ///     Subscribes to automatic voice detection.
 /// </summary>
 /// <param name="listener">
 ///     The listener which is to receive notification when the player starts and stops speaking via
 ///     automatic voice detection.
 /// </param>
 public void SubcribeToVoiceActivation([NotNull] IVoiceActivationListener listener)
 {
     _capture.Subscribe(listener);
 }
Exemplo n.º 8
0
 public bool Unsubscribe(IVoiceActivationListener listener)
 {
     return(_preprocessing.Unsubscribe(listener));
 }
Exemplo n.º 9
0
 public void Subscribe(IVoiceActivationListener listener)
 {
     _preprocessing.Subscribe(listener);
 }