예제 #1
0
        public override float ReadNextSample()
        {
            if (HasMoreSamples())
            {
                double effectivePos = position++ / (0.5f * Samples) - 1.0f;
                return((float)GeneralMath.Tanh(effectivePos * tanhLimit));
            }

            return(0f);
        }
예제 #2
0
        public override int Read(float[] data, int offset, int count)
        {
            int samplesToReturn = Math.Min(count, Samples - position);

            for (int i = 0; i < samplesToReturn; i++)
            {
                double effectivePos = (position + i) / (0.5 * Samples) - 1.0;

                data[offset + i] = (float)GeneralMath.Tanh(effectivePos * tanhLimit);
            }

            position += samplesToReturn;

            return(samplesToReturn);
        }