Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AudioCapture"/> class.
 /// </summary>
 /// <param name="pipeline">The pipeline to add the component to.</param>
 /// <param name="configuration">The component configuration.</param>
 /// <param name="name">An optional name for this component.</param>
 public AudioCapture(Pipeline pipeline, AudioCaptureConfiguration configuration, string name = nameof(AudioCapture))
 {
     this.pipeline      = pipeline;
     this.name          = name;
     this.configuration = configuration;
     this.audioBuffers  = pipeline.CreateEmitter <AudioBuffer>(this, "AudioBuffers");
 }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AudioCapture"/> class.
 /// </summary>
 /// <param name="pipeline">The pipeline to add the component to.</param>
 /// <param name="configuration">The component configuration.</param>
 public AudioCapture(Pipeline pipeline, AudioCaptureConfiguration configuration)
 {
     pipeline.RegisterPipelineStartHandler(this, this.OnPipelineStart);
     pipeline.RegisterPipelineStopHandler(this, this.OnPipelineStop);
     this.pipeline      = pipeline;
     this.configuration = configuration;
     this.audioBuffers  = pipeline.CreateEmitter <AudioBuffer>(this, "AudioBuffers");
 }
Exemple #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AudioCapture"/> class.
        /// </summary>
        /// <param name="pipeline">The pipeline to add the component to.</param>
        /// <param name="configuration">The component configuration.</param>
        public AudioCapture(Pipeline pipeline, AudioCaptureConfiguration configuration)
        {
            this.pipeline        = pipeline;
            this.configuration   = configuration;
            this.audioBuffers    = pipeline.CreateEmitter <AudioBuffer>(this, "AudioBuffers");
            this.AudioLevelInput = pipeline.CreateReceiver <double>(this, this.SetAudioLevel, nameof(this.AudioLevelInput), true);
            this.AudioLevel      = pipeline.CreateEmitter <double>(this, nameof(this.AudioLevel));

            this.wasapiCapture = new WasapiCapture();
            this.wasapiCapture.Initialize(this.Configuration.DeviceName);

            if (this.Configuration.AudioLevel >= 0)
            {
                this.wasapiCapture.AudioLevel = this.Configuration.AudioLevel;
            }
        }