Class GestureGranularConfig.Builder
java.lang.Object
net.paulhertz.pixelaudio.granular.GestureGranularConfig.Builder
- Enclosing class:
- GestureGranularConfig
Mutable builder for
GestureGranularConfig.
The builder intentionally exposes public fields so interactive examples can bind GUI
controls directly to configuration state. Use build() when you need an immutable
snapshot for scheduling or playback.
-
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanTrue to compensate gain automatically when one event produces multiple burst grains.intOriginal duration in milliseconds recorded from a schedule for GUI reference.intOriginal point count recorded from a schedule for GUI reference.intNumber of grains generated for each scheduled gesture event.floatReserved curve-shaping value.intNumber of divisions used when constructing a curve-point schedule.Envelope applied to granular or sampler playback.floatPlayback gain in decibels.intLength of each granular grain in samples.intFixed hop length in samples whenhopModeisGestureGranularConfig.HopMode.FIXED.Event timing mode for scheduled gesture events.Strategy for choosing gesture points for the schedule.floatPitch offset in semitones.floatSimplification tolerance used by reduced and curve path modes.intTarget event count for resampling; 0 means no override.intTarget gesture duration in milliseconds; 0 means no override.User-facing timing mode for GUI state and presets.booleanTrue to derive curve timing from arc length rather than point index.floatExponent used by exponential and square-root warp shapes.Timing warp shape. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds an immutable snapshot safe to pass into scheduling and rendering code.copy()Returns a new builder initialized from this builder.voidReplaces this builder's fields with values from another builder.gainDb(float gainDb) Sets the playback gain in decibels.Makes explicit to the caller that the envelope is being set for GRANULAR synthesis.Makes explicit to the caller that the envelope is being set for SAMPLER synthesis.voidStores GUI baseline values from a gesture schedule.voidvalidate()Throws early if the builder contains values that cannot produce a valid schedule or render.
-
Field Details
-
pathMode
Strategy for choosing gesture points for the schedule. -
rdpEpsilon
public float rdpEpsilonSimplification tolerance used by reduced and curve path modes. -
curveSteps
public int curveStepsNumber of divisions used when constructing a curve-point schedule. -
curveBias
public float curveBiasReserved curve-shaping value. -
hopMode
Event timing mode for scheduled gesture events. -
hopLengthSamples
public int hopLengthSamplesFixed hop length in samples whenhopModeisGestureGranularConfig.HopMode.FIXED. -
timingMode
User-facing timing mode for GUI state and presets. -
basePointCount
public int basePointCountOriginal point count recorded from a schedule for GUI reference. -
baseDurationMs
public int baseDurationMsOriginal duration in milliseconds recorded from a schedule for GUI reference. -
resampleCount
public int resampleCountTarget event count for resampling; 0 means no override. -
targetDurationMs
public int targetDurationMsTarget gesture duration in milliseconds; 0 means no override. -
warpShape
Timing warp shape.GestureGranularConfig.WarpShape.LINEARdisables warping. -
warpExponent
public float warpExponentExponent used by exponential and square-root warp shapes. -
grainLengthSamples
public int grainLengthSamplesLength of each granular grain in samples. -
env
Envelope applied to granular or sampler playback. -
gainDb
public float gainDbPlayback gain in decibels. -
pitchSemitones
public float pitchSemitonesPitch offset in semitones. -
burstGrains
public int burstGrainsNumber of grains generated for each scheduled gesture event. -
autoBurstGainComp
public boolean autoBurstGainCompTrue to compensate gain automatically when one event produces multiple burst grains. -
useArcLengthTime
public boolean useArcLengthTimeTrue to derive curve timing from arc length rather than point index.
-
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
gainDb
Sets the playback gain in decibels.- Parameters:
gainDb- desired gain in dB- Returns:
- reference to this Builder
-
granularEnvelope
Makes explicit to the caller that the envelope is being set for GRANULAR synthesis.- Parameters:
env- an ADSRParams instance to set the envelope- Returns:
- this builder
-
samplerEnvelope
Makes explicit to the caller that the envelope is being set for SAMPLER synthesis.- Parameters:
env- an ADSRParams instance to set the envelope, nominally for sampler synthesis- Returns:
- this builder
-
build
Builds an immutable snapshot safe to pass into scheduling and rendering code.This method currently trusts the builder state. Call
validate()first when you want early exceptions for impossible GUI or preset values.- Returns:
- an immutable configuration snapshot
- Throws:
NullPointerException- if any required enum or envelope field is null
-
setBaselinesFromSchedule
Stores GUI baseline values from a gesture schedule.The baseline point count and duration are informational and are not used directly by DSP rendering.
- Parameters:
s- schedule whose size and duration should be recorded- Throws:
NullPointerException- ifsis null
-
validate
public void validate()Throws early if the builder contains values that cannot produce a valid schedule or render.- Throws:
IllegalArgumentException- if numeric values are outside their supported ranges
-
copy
Returns a new builder initialized from this builder.The envelope reference is shared with the original builder.
- Returns:
- a copy of this builder
-
copyFrom
Replaces this builder's fields with values from another builder.The envelope reference is shared with the source builder.
- Parameters:
src- source builder to copy- Throws:
NullPointerException- ifsrcis null
-