Exemplo n.º 1
0
        public void Update(AudioSource source, AudioEngineCaptureOptions options)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            lock (captures)
            {
                AudioCaptureEntity c;
                if (!captures.TryGetValue(source, out c))
                {
                    throw new ArgumentException("source is not attached", "source");
                }

                if (c.Talking && c.Options.Mode != options.Mode)
                {
                    AudioSender.EndSending(source);
                }

                var newc = new AudioCaptureEntity(c.AudioCapture, source, options);
                newc.TargetType     = c.TargetType;
                newc.CurrentTargets = c.CurrentTargets;

                captures[source] = newc;
            }
        }
Exemplo n.º 2
0
        public void Attach(IAudioCaptureProvider audioCapture, AudioSource source, AudioEngineCaptureOptions options)
        {
            if (audioCapture == null)
            {
                throw new ArgumentNullException("audioCapture");
            }
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            if (audioCapture.Device == null)
            {
                audioCapture.Device = audioCapture.DefaultDevice;
            }

            lock (captures)
            {
                audioCapture.SamplesAvailable += OnSamplesAvailable;
                audioCapture.BeginCapture(source.CodecSettings, source.CodecSettings.FrameSize);
                captures[source] = new AudioCaptureEntity(audioCapture, source, options);
                captureToSourceLookup[audioCapture] = source;

                if (this.captureMuted || mutedCaptures.Contains(audioCapture))
                {
                    captures[source].Muted = true;
                }
            }
        }
Exemplo n.º 3
0
        public AudioCaptureEntity(IAudioCaptureProvider audioCapture, AudioSource source, AudioEngineCaptureOptions options)
        {
            this.audioCapture = audioCapture;
            this.source = source;
            this.options = options;

            this.frameLength = (this.source.CodecSettings.FrameSize / source.CodecSettings.SampleRate) * 1000;

            if (options.Mode == AudioEngineCaptureMode.Activated)
            {
                activation = new VoiceActivation (source.CodecSettings, source.CodecSettings.FrameSize, options.StartVolume, options.ContinuationVolume, options.ContinueThreshold);
                //preprocessor = new SpeexPreprocessor (this.source.FrameSize, this.source.Frequency);
            }
        }
Exemplo n.º 4
0
        public void Update(AudioSource source, AudioEngineCaptureOptions options)
        {
            if (source == null)
                throw new ArgumentNullException ("source");
            if (options == null)
                throw new ArgumentNullException ("options");

            lock (captures)
            {
                AudioCaptureEntity c;
                if (!captures.TryGetValue (source, out c))
                    throw new ArgumentException ("source is not attached", "source");

                if (c.Talking && c.Options.Mode != options.Mode)
                    AudioSender.EndSending (source);

                var newc = new AudioCaptureEntity (c.AudioCapture, source, options);
                newc.TargetType = c.TargetType;
                newc.CurrentTargets = c.CurrentTargets;

                captures[source] = newc;
            }
        }
Exemplo n.º 5
0
        public void Attach(IAudioCaptureProvider audioCapture, AudioSource source, AudioEngineCaptureOptions options)
        {
            if (audioCapture == null)
                throw new ArgumentNullException ("audioCapture");
            if (source == null)
                throw new ArgumentNullException ("source");
            if (options == null)
                throw new ArgumentNullException ("options");

            if (audioCapture.Device == null)
                audioCapture.Device = audioCapture.DefaultDevice;

            lock (captures)
            {
                audioCapture.SamplesAvailable += OnSamplesAvailable;
                audioCapture.BeginCapture (source.CodecSettings, source.CodecSettings.FrameSize);
                captures[source] = new AudioCaptureEntity (audioCapture, source, options);
                captureToSourceLookup[audioCapture] = source;

                if (this.captureMuted || mutedCaptures.Contains (audioCapture))
                    captures[source].Muted = true;
            }
        }
Exemplo n.º 6
0
        public AudioCaptureEntity(IAudioCaptureProvider audioCapture, AudioSource source, AudioEngineCaptureOptions options)
        {
            this.audioCapture = audioCapture;
            this.source       = source;
            this.options      = options;

            this.frameLength = (this.source.CodecSettings.FrameSize / source.CodecSettings.SampleRate) * 1000;

            if (options.Mode == AudioEngineCaptureMode.Activated)
            {
                activation = new VoiceActivation(source.CodecSettings, source.CodecSettings.FrameSize, options.StartVolume, options.ContinuationVolume, options.ContinueThreshold);
                //preprocessor = new SpeexPreprocessor (this.source.FrameSize, this.source.Frequency);
            }
        }