예제 #1
0
        /// <summary>Reads `count` samples from the input and writes them into `buffer`. Will block as long as it takes for the input to buffer the requested number of samples.</summary>
        /// <param name="buffer">The output array to write the read samples to.</param>
        /// <param name="count">The number of samples to read.</param>
        /// <returns>The number of samples that have been read. Will always equal `count` except when `StopWaiting()` has been called,in which case `Read()` returns `0`.</returns>
        public int Read(float[] buffer, int count)
        {
            while (source.WaitForSamples(count))
            {
                if (stopRequested)
                {
                    return(0);
                }
            }

            return(samples.Read(buffer, 0, count));
        }