Beispiel #1
0
  @Override
  public boolean process(AudioEvent audioEvent) {
    float[] audioFloatBuffer = audioEvent.getFloatBuffer();
    int overlap = audioEvent.getOverlap();

    for (int i = overlap; i < audioFloatBuffer.length; i++) {
      if (position >= echoBuffer.length) {
        position = 0;
      }

      // output is the input added with the decayed echo
      audioFloatBuffer[i] = audioFloatBuffer[i] + echoBuffer[position] * decay;
      // store the sample in the buffer;
      echoBuffer[position] = audioFloatBuffer[i];

      position++;
    }

    applyNewEchoLength();

    return true;
  }