public int Read(float[] buffer, int offset, int count) { if (input != null) { var inputSamples = count * InputChannels / outputChannels; if (inputBuffer == null || inputBuffer.Length != inputSamples) { inputBuffer = new float[inputSamples]; } input.Read(inputBuffer, offset, inputSamples); } else { inputBuffer = null; } if (oversampling <= 1) { LoopNormal(buffer, count); } else { LoopOversampling(buffer, count); } return(count); }
public int Read(float[] buffer, int offset, int count) { if (Input != null) { var l = Input.Read(buffer, offset, count); for (int i = 0; i < l; i += Input.WaveFormat.Channels) { Add(buffer[offset + i]); } return(l); } Spread = null; return(count); }
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)); }