Пример #1
0
        public MultiChannelMixer()
        {
            // Mix all inputs together
            _inputs = new MixingSampleProvider(MixingFormat)
            {
                ReadFully = true
            };

            // Apply pipeline and eventually convert to the required output format
            _output = _inputs
                      .ToMono()
                      .AutoGainControl()
                      .Resample(OutputFormat.SampleRate)
                      .SoftClip()
                      .ToStereo()
                      .ToWaveProvider16();
        }
Пример #2
0
        public MultichannelAudioPlayer([NotNull] IVoiceChannel voiceChannel, [NotNull] IEnumerable <IChannel> sources)
        {
            _voiceChannel = voiceChannel;
            _threadEvent  = new AutoResetEvent(true);
            _thread       = Task.Run(ThreadEntry);

            //Sample provider which mixes together several sample providers
            _mixerInput = new MixingSampleProvider(MixingFormat)
            {
                ReadFully = true
            };

            //Soft clip using opus
            var clipper = new SoftClipSampleProvider(_mixerInput.ToMono());

            //resample mix format to output format
            _mixerOutput = new WdlResamplingSampleProvider(clipper, OutputFormat.SampleRate).ToStereo().ToWaveProvider16();

            //Add all initial channels to the mixer
            foreach (var source in sources)
            {
                Add(source);
            }
        }
Пример #3
0
 public TrackSampleProvider()
 {
     mix    = new MixingSampleProvider(WaveFormat.CreateIeeeFloatWaveFormat(44100, 2));
     pan    = new PanningSampleProvider(mix.ToMono());
     volume = new VolumeSampleProvider(pan);
 }