Ejemplo n.º 1
0
        protected override void ProcessImpl(float[] buffer, int offset, int count)
        {
            int numSamples = count / 2;

            for (int i = 0; i < numSamples; i++)
            {
                float f = MathL.Abs(2.0f * ((float)m_currentSample / m_length) - 1.0f);
                f = easing.Sample(f);
                float freq = fmin + (fmax - fmin) * f;
                filter.SetLowPass(q, freq);

                float[] s = { buffer[i * 2], buffer[i * 2 + 1] };
                filter.Process(s, 0, 2);

                // Apply slight mixing
                float addMix = 0.85f;
                //buffer[i * 2 + 0] = buffer[i * 2 + 0] * addMix + s[0] * (1.0f - addMix);
                //buffer[i * 2 + 1] = buffer[i * 2 + 1] * addMix + s[1] * (1.0f - addMix);

                buffer[i * 2 + 0] = MathL.Lerp(buffer[i * 2 + 0], s[0], Mix * addMix);
                buffer[i * 2 + 1] = MathL.Lerp(buffer[i * 2 + 1], s[1], Mix * addMix);

                m_currentSample++;
                m_currentSample %= m_length;
            }
        }
Ejemplo n.º 2
0
        protected override void ProcessImpl(Span <float> buffer)
        {
            int numSamples = buffer.Length / 2;

            for (int i = 0; i < numSamples; i++)
            {
                float f = MathL.Abs(2.0f * ((float)m_currentSample / m_length) - 1.0f);
                f = easing.Sample(f);
                float freq = fmin + (fmax - fmin) * f;
                filter.SetLowPass(q, freq);

                float[] s = { buffer[i * 2], buffer[i * 2 + 1] };
                filter.Process(s);

                float addMix = 0.85f;
                buffer[i * 2 + 0] = MathL.Lerp(buffer[i * 2 + 0], s[0], Mix * addMix);
                buffer[i * 2 + 1] = MathL.Lerp(buffer[i * 2 + 1], s[1], Mix * addMix);

                m_currentSample++;
                m_currentSample %= m_length;
            }
        }