Exemple #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;
            }
        }
Exemple #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;
                }
            }
        }
Exemple #3
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;
            }
        }
Exemple #4
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;
            }
        }