ActionVisualizer.SineWaveProvider32.Read C# (CSharp) Method

Read() public method

public Read ( float buffer, int offset, int sampleCount ) : int
buffer float
offset int
sampleCount int
return int
        public override int Read(float[] buffer, int offset, int sampleCount)
        {
            int sampleRate = WaveFormat.SampleRate;
            for (int n = 0; n < sampleCount; n++)
            {
                buffer[n + offset] = (float)(Amplitude * Math.Sin((2 * Math.PI * sample * Frequency) / sampleRate));
                sample++;
                if (sample >= sampleRate) sample = 0;
            }
            return sampleCount;
        }
SineWaveProvider32