public synchronized void setParameters(FDNParameters params) { int n = params.numberOfLines(); int sr = reader.getSampleRate(); parameters = params; lineIndices = new int[n]; delayLines = new float[n][]; inBuffer = new float[n]; outBuffer = new float[n]; for (int i = 0; i < n; i++) { delayLines[i] = new float[(int) (params.delayTime(i) * sr + .5)]; } }
public synchronized int read(float[] buffer, int i0, int samples) { int nRead = reader.read(buffer, i0, samples); int n = parameters.numberOfLines(); for (int i = 0; i < nRead; i++) { float v = 0; for (int j = 0; j < n; j++) { v += (outBuffer[j] = getValue(j)); } parameters.map(inBuffer, outBuffer); for (int j = 0; j < n; j++) { setValue(j, buffer[i0] + inBuffer[j]); advanceIndex(j); } buffer[i0++] = v / n; } return nRead; }