Пример #1
0
        public LookaheadLimiter(WaveProvider32 input, float limit, int bufferSize) : base(input)
        {
            _multiplierL = _multiplierR = 1;

            _limit = limit;

            _bufferL = new float[bufferSize];
            _bufferR = new float[bufferSize];
        }
Пример #2
0
        public void AddInput(WaveProvider32 waveProvider)
        {
            if (!waveProvider.WaveFormat.Equals(WaveFormat))
            {
                throw new ArgumentException("All incoming channels must have the same format", "waveProvider.WaveFormat");
            }

            _toAdd.Add(waveProvider);
        }
        public LowPassFeedBackCombFilter(WaveProvider32 input, int delay, float f, float d, int stereoSpread) : base(input)
        {
            _left = true;

            _stereoSpread = stereoSpread;
            Feedback      = f;
            Damping       = d;

            _xl = new float[delay];
            _xr = new float[delay + stereoSpread];
            _yl = new float[delay];
            _yr = new float[delay + stereoSpread];
        }
Пример #4
0
 public AllPassFilter(WaveProvider32 input, int delay, float gain) : base(input)
 {
     left = true;
     g    = gain;
     xl   = new float[delay];
     xr   = new float[delay];
     yl   = new float[delay];
     yr   = new float[delay];
     for (int i = 0; i < delay; ++i)
     {
         xl[i] = xr[i] = yl[i] = yr[i] = 0;
     }
     posl = posr = 0;
 }
Пример #5
0
        public BiQuadFilter(WaveProvider32 input) : base(input)
        {
            _a = new double[3];
            _b = new double[3];

            _xl = new double[2];
            _yl = new double[2];

            _xr = new double[2];
            _yr = new double[2];

            _left = true;

            _cutoff = 1000;
            _q      = (float)(Math.Sqrt(2) / 2);
            _mode   = FilterMode.LowPass;

            UpdateCoefsLowPass();
        }
Пример #6
0
        // input x4 -> _lbcf[0-4] -> _mixer[0] \
        //                                      > _mixer[2] -> _ap[0] -> _ap[1] -> _ap[2] -> _ap[3] -> output
        // input x4 -> _lbcf[5-7] -> _mixer[1] /
        public Freeverb(WaveProvider32 input, float roomSize, float damping) : base(input)
        {
            _inputCopy = new DummyWaveProvider32(input.WaveFormat.SampleRate, input.WaveFormat.Channels);

            _lbcf = new[]
            {
                new LowPassFeedBackCombFilter(_inputCopy, 1557 * WaveFormat.SampleRate / 44100, roomSize, damping, 23),
                new LowPassFeedBackCombFilter(_inputCopy, 1617 * WaveFormat.SampleRate / 44100, roomSize, damping, 23),
                new LowPassFeedBackCombFilter(_inputCopy, 1491 * WaveFormat.SampleRate / 44100, roomSize, damping, 23),
                new LowPassFeedBackCombFilter(_inputCopy, 1422 * WaveFormat.SampleRate / 44100, roomSize, damping, 23),
                new LowPassFeedBackCombFilter(_inputCopy, 1277 * WaveFormat.SampleRate / 44100, roomSize, damping, 23),
                new LowPassFeedBackCombFilter(_inputCopy, 1356 * WaveFormat.SampleRate / 44100, roomSize, damping, 23),
                new LowPassFeedBackCombFilter(_inputCopy, 1188 * WaveFormat.SampleRate / 44100, roomSize, damping, 23),
                new LowPassFeedBackCombFilter(_inputCopy, 1116 * WaveFormat.SampleRate / 44100, roomSize, damping, 23)
            };

            var mixers = new[]
            {
                new WaveMixer32(input.WaveFormat.SampleRate, input.WaveFormat.Channels)
                {
                    Mode = MixerMode.Averaging
                },
                new WaveMixer32(input.WaveFormat.SampleRate, input.WaveFormat.Channels)
                {
                    Mode = MixerMode.Averaging
                },
                new WaveMixer32(input.WaveFormat.SampleRate, input.WaveFormat.Channels)
                {
                    Mode = MixerMode.Averaging
                }
            };

            mixers[0].AddInputs(new[] { _lbcf[0], _lbcf[1], _lbcf[2], _lbcf[3] });
            mixers[1].AddInputs(new[] { _lbcf[4], _lbcf[5], _lbcf[6], _lbcf[7] });
            mixers[2].AddInputs(new[] { mixers[0], mixers[1] });

            _ap = new AllPassFilterAprox[4];

            _ap[0] = new AllPassFilterAprox(mixers[2], 225 * WaveFormat.SampleRate / 44100, .5f, 23);
            _ap[1] = new AllPassFilterAprox(_ap[0], 556 * WaveFormat.SampleRate / 44100, .5f, 23);
            _ap[2] = new AllPassFilterAprox(_ap[1], 441 * WaveFormat.SampleRate / 44100, .5f, 23);
            _ap[3] = new AllPassFilterAprox(_ap[2], 341 * WaveFormat.SampleRate / 44100, .5f, 23);
        }
Пример #7
0
        public AllPassFilterAprox(WaveProvider32 input, int delay, float gain, int stereoSpread) : base(input)
        {
            _left = true;

            Gain = gain;

            _xl = new float[delay];
            _xr = new float[delay + stereoSpread];
            _yl = new float[delay];
            _yr = new float[delay + stereoSpread];

            for (var i = 0; i < delay; ++i)
            {
                _xl[i] = _xr[i] = _yl[i] = _yr[i] = 0;
            }
            for (var i = delay; i < delay + stereoSpread; ++i)
            {
                _xr[i] = _yr[i] = 0;
            }

            _posl = _posr = 0;
        }
Пример #8
0
 public void RemoveInput(WaveProvider32 waveProvider)
 {
     _toRemove.Add(waveProvider);
 }
Пример #9
0
 public WaveMixer32(WaveProvider32 firstInput) : this(firstInput.WaveFormat.SampleRate, firstInput.WaveFormat.Channels)
 {
     _inputs.Add(firstInput);
 }
Пример #10
0
 protected WaveEffect32(WaveProvider32 input) : base(input.WaveFormat.SampleRate, input.WaveFormat.Channels)
 {
     Input = input;
     Wet   = 1;
 }