Class GestureEventParams.Builder
java.lang.Object
net.paulhertz.pixelaudio.granular.GestureEventParams.Builder
- Enclosing class:
- GestureEventParams
A builder for creating instances of GestureEventParams.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate float[]private final intprivate float[]private float[]private intprivate int[]private int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Validates the configured arrays and creates an immutable parameter set.gain(float[] v) Sets optional per-event gain values.noCopy()Disables defensive array copies whenbuild()creates the parameter set.pan(float[] v) Sets optional per-event pan values.pitchRatio(float[] v) Sets optional per-event pitch ratios.private static voidrequireLen(String name, int got, int expect) scheduleId(int v) Sets a caller-defined identifier for the associated gesture schedule.startIndices(int[] v) Sets the required per-event start indices.version(int v) Sets a caller-defined version tag for cache invalidation or debugging.
-
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
Disables defensive array copies whenbuild()creates the parameter set.Call this only when the supplied arrays will be treated as immutable after building.
- Returns:
- this builder
-
startIndices
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- ifvis null
-
pan
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
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
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
Sets a caller-defined version tag for cache invalidation or debugging.- Parameters:
v- caller-defined version value- Returns:
- this builder
-
scheduleId
Sets a caller-defined identifier for the associated gesture schedule.- Parameters:
v- caller-defined schedule identifier- Returns:
- this builder
-
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 suppliedIllegalArgumentException- if any supplied array length differs from the builder event count
-
requireLen
-