Class GestureEventParams
java.lang.Object
net.paulhertz.pixelaudio.granular.GestureEventParams
Immutable, schedule-aligned per-event parameters for Model-A gesture playback.
All arrays (when present) are parallel arrays with the same cardinality n
matching the GestureSchedule.size() used to
generate them.
Design intent:
startIndicesis the primary "mapping result" (typically from PixelAudioMapper).- Optional arrays (pan/gain/pitchRatio) override
GestureGranularTexturedefaults per event. - Persist and reuse this object across re-triggers; refresh only the fields that depend on buffer/mapping.
Immutability note: By default, this class defensively copies arrays in GestureEventParams.Builder.build().
If you want to avoid copying for performance, call GestureEventParams.Builder.noCopy() and treat the provided
arrays as immutable thereafter.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal float[]Optional: per-event linear gain scalar; length == n, or null => use texture.gainLinear.final intNumber of events (must match schedule.size()).final float[]Optional: per-event pan in [-1..1]; length == n, or null => use texture.pan.final float[]Optional: per-event pitch ratio (>0); length == n, or null => use texture.pitchRatio.final intOptional: a free-form identity marker for debugging/caching.final int[]Required: per-event start indices into mono buffer; length == n.final intOptional user-managed version tag. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic GestureEventParams.Builderbuilder(int n) private static floatclampPan(float p) floatgainAt(int i, float defaultGain) Returns per-event gain if present; otherwise returns defaultGain.static GestureEventParamsofStartIndices(int[] startIndices) Create a params object with required indices only.floatpanAt(int i, float defaultPan) Returns per-event pan if present; otherwise returns defaultPan.floatpitchAt(int i, float defaultPitch) Returns per-event pitch ratio if present; otherwise returns defaultPitch.toString()withGain(float[] newGain) Return a copy with updated gain array (other fields preserved).withPan(float[] newPan) Return a copy with updated pan array (other fields preserved).withPitchRatio(float[] newPitchRatio) Return a copy with updated pitchRatio array (other fields preserved).withStartIndices(int[] newStartIndices) Return a copy with updated startIndices (other fields preserved).
-
Field Details
-
n
public final int nNumber of events (must match schedule.size()). -
startIndices
public final int[] startIndicesRequired: per-event start indices into mono buffer; length == n. -
pan
public final float[] panOptional: per-event pan in [-1..1]; length == n, or null => use texture.pan. -
gain
public final float[] gainOptional: per-event linear gain scalar; length == n, or null => use texture.gainLinear. -
pitchRatio
public final float[] pitchRatioOptional: per-event pitch ratio (>0); length == n, or null => use texture.pitchRatio. -
version
public final int versionOptional user-managed version tag. Handy for invalidation/caching in app code. (e.g., mapperVersion, bufferRotationVersion, etc.) -
scheduleId
public final int scheduleIdOptional: a free-form identity marker for debugging/caching. Example: System.identityHashCode(schedule), or a stable schedule id in your app.
-
-
Constructor Details
-
GestureEventParams
-
-
Method Details
-
builder
-
ofStartIndices
Create a params object with required indices only. -
withStartIndices
Return a copy with updated startIndices (other fields preserved). -
withPan
Return a copy with updated pan array (other fields preserved). -
withGain
Return a copy with updated gain array (other fields preserved). -
withPitchRatio
Return a copy with updated pitchRatio array (other fields preserved). -
panAt
public float panAt(int i, float defaultPan) Returns per-event pan if present; otherwise returns defaultPan. -
gainAt
public float gainAt(int i, float defaultGain) Returns per-event gain if present; otherwise returns defaultGain. -
pitchAt
public float pitchAt(int i, float defaultPitch) Returns per-event pitch ratio if present; otherwise returns defaultPitch. -
toString
-
clampPan
private static float clampPan(float p)
-