RPE Chart Utils
    Preparing search index...

    Function copyEvents

    • Duplicate events from one beat range into another beat range.

      Only events whose startBeat and endBeat both fall within [sourceStart, sourceEnd] are copied. The copies are shifted so that sourceStart maps to targetStart.

      Parameters

      • events: Event[]

        Source events (not mutated).

      • sourceStart: number

        Start beat of the source range (inclusive).

      • sourceEnd: number

        End beat of the source range (inclusive).

      • targetStart: number

        Start beat of the target range.

      Returns Event[]

      New array of cloned and relocated events.

      // Copy beats 0-8 to start at beat 16
      const copies = copyEvents(layer.moveXEvents ?? [], 0, 8, 16);
      layer.moveXEvents = [...(layer.moveXEvents ?? []), ...copies];