Class GestureEventParams.Builder

java.lang.Object
net.paulhertz.pixelaudio.granular.GestureEventParams.Builder
Enclosing class:
GestureEventParams

public static final class GestureEventParams.Builder extends Object
A builder for creating instances of GestureEventParams.
  • Field Details

    • n

      private final int n
    • startIndices

      private int[] startIndices
    • pan

      private float[] pan
    • gain

      private float[] gain
    • pitchRatio

      private float[] pitchRatio
    • version

      private int version
    • scheduleId

      private int scheduleId
    • copyArrays

      private boolean copyArrays
  • Constructor Details

    • Builder

      private Builder(int n)
  • Method Details

    • noCopy

      public GestureEventParams.Builder noCopy()
      Disables defensive array copies when build() creates the parameter set.

      Call this only when the supplied arrays will be treated as immutable after building.

      Returns:
      this builder
    • startIndices

      public GestureEventParams.Builder startIndices(int[] v)
      Sets the required per-event start indices.
      Parameters:
      v - per-event start indices into the mono source buffer; length must equal the builder event count
      Returns:
      this builder
      Throws:
      NullPointerException - if v is null
    • pan

      public GestureEventParams.Builder pan(float[] v)
      Sets optional per-event pan values.
      Parameters:
      v - per-event pan values; null is allowed, otherwise length must equal the builder event count
      Returns:
      this builder
    • gain

      public GestureEventParams.Builder gain(float[] v)
      Sets optional per-event gain values.
      Parameters:
      v - per-event linear gain values; null is allowed, otherwise length must equal the builder event count
      Returns:
      this builder
    • pitchRatio

      public GestureEventParams.Builder pitchRatio(float[] v)
      Sets optional per-event pitch ratios.
      Parameters:
      v - per-event pitch ratios; null is allowed, otherwise length must equal the builder event count
      Returns:
      this builder
    • version

      public GestureEventParams.Builder version(int v)
      Sets a caller-defined version tag for cache invalidation or debugging.
      Parameters:
      v - caller-defined version value
      Returns:
      this builder
    • scheduleId

      public GestureEventParams.Builder scheduleId(int v)
      Sets a caller-defined identifier for the associated gesture schedule.
      Parameters:
      v - caller-defined schedule identifier
      Returns:
      this builder
    • build

      public GestureEventParams build()
      Validates the configured arrays and creates an immutable parameter set.
      Returns:
      a new gesture event parameter set
      Throws:
      IllegalStateException - if required start indices have not been supplied
      IllegalArgumentException - if any supplied array length differs from the builder event count
    • requireLen

      private static void requireLen(String name, int got, int expect)