Example #1
0
        public int Read(float[] buffer, int offset, int count)
        {
            int num = 0;

            if (circularBuffer != null)
            {
                num = circularBuffer.Read(buffer, offset, count);
            }
            if (num < count)
            {
                Array.Clear(buffer, offset + num, count - num);
                UnderRuns++;
            }

            return(count);
        }
Example #2
0
            public int Read(float[] b, int offset, int count)
            {
                var samplesToRead = count / channels;

                while (buffer.Count < samplesToRead * channels)
                {
                    if (tempBuffer.Length < samplesToRead * inputChannels)
                    {
                        tempBuffer = new float[samplesToRead * inputChannels];
                    }

                    var dataRead    = input.Read(tempBuffer, offset, samplesToRead * inputChannels);
                    int outputIndex = 0;
                    for (int j = 0; j < dataRead; j++)
                    {
                        buffersMapped[outputIndex].Add(tempBuffer[j]);
                        outputIndex++;
                        outputIndex %= outputChannels;
                    }
                }

                return(buffer.Read(b, offset, count));
            }