getLoopedFrame method

int getLoopedFrame(
  1. int frame
)

For internal use only. Maps a frame beyond the end of the loop range to where it would be inside the loop range.

Implementation

int getLoopedFrame(int frame) {
  final loopStartFrame = beatToFrames(loopStartBeat);
  final loopLengthFrames = getLoopLengthFrames();

  if (frame <= loopStartFrame || loopLengthFrames == 0) return frame;

  return ((frame - loopStartFrame) % loopLengthFrames) + loopStartFrame;
}