/// <summary>
        /// Reads samples from this sample provider
        /// </summary>
        /// <param name="buffer">Sample buffer</param>
        /// <param name="offset">Offset into sample buffer</param>
        /// <param name="sampleCount">Number of samples desired</param>
        /// <returns>Number of samples read</returns>
        public int Read(float[] buffer, int offset, int sampleCount)
        {
            int samplesRead = source.Read(buffer, offset, sampleCount);

            if (Volume != 1f)
            {
                rampGain.CalculateGainStepDelta(sampleCount);
                for (int n = 0; n < sampleCount; n++)
                {
                    buffer[offset + n] *= (float)rampGain.CurrentGain;
                    rampGain.CalculateNextGain();
                }
            }
            return(samplesRead);
        }
        /// <summary>
        /// Reads samples from this provider
        /// </summary>
        /// <param name="buffer">Sample buffer</param>
        /// <param name="offset">Offset into sample buffer</param>
        /// <param name="count">Number of samples required</param>
        /// <returns>Number of samples read</returns>
        public int Read(float[] buffer, int offset, int count)
        {
            var sourceSamplesRequired = count / 2;
            var outIndex = offset;

            EnsureSourceBuffer(sourceSamplesRequired);
            var sourceSamplesRead = source.Read(sourceBuffer, 0, sourceSamplesRequired);

            leftRampGain.CalculateGainStepDelta(sourceSamplesRequired);
            rightRampGain.CalculateGainStepDelta(sourceSamplesRequired);
            for (var n = 0; n < sourceSamplesRead; n++)
            {
                buffer[outIndex++] = sourceBuffer[n] * (float)leftRampGain.CurrentGain;
                buffer[outIndex++] = sourceBuffer[n] * (float)rightRampGain.CurrentGain;
                leftRampGain.CalculateNextGain();
                rightRampGain.CalculateNextGain();
            }

            return(sourceSamplesRead * 2);
        }