Beispiel #1
0
        public double[] Process(int sampleCount)
        {
            if (stepsizeDirty)
            {
                UpdateStepsize();
            }

            if (wavetable == null)
            {
                for (var i = 0; i < sampleCount; i++)
                {
                    OutputBuffer[i] = 0.0;
                }

                return(OutputBuffer);
            }

            for (var i = 0; i < sampleCount; i++)
            {
                double waveA  = WavetableContext.Interpolate(wavetable[tableA][waveNumber], accumulator);
                double waveB  = WavetableContext.Interpolate(wavetable[tableB][waveNumber], accumulator);
                var    output = waveA * (1 - tableMix) + waveB * tableMix;
                accumulator += stepsize;
                if (accumulator > 1)
                {
                    accumulator -= 1;
                }

                OutputBuffer[i] = output;
            }

            return(OutputBuffer);
        }
Beispiel #2
0
        public double[] Process(int sampleCount)
        {
            if (incrementsDirty)
            {
                UpdateIncrements();
            }

            for (var i = 0; i < sampleCount; i++)
            {
                var sum = 0.0;
                for (var j = 0; j < iterators.Length; j++)
                {
                    var it     = iterators[j];
                    var sample = WavetableContext.Interpolate(wavetable[waveNumber], it);
                    sum += sample;

                    it += increments[j];
                    if (it >= 1.0)
                    {
                        it -= 1.0;
                    }

                    iterators[j] = it;
                }

                output          = (alpha - 1) * sum - alpha * output;
                OutputBuffer[i] = output * 0.33;
            }

            return(OutputBuffer);
        }