Class GestureGranularConfig.Builder

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

public static final class GestureGranularConfig.Builder extends Object
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 Details

    • pathMode

      Strategy for choosing gesture points for the schedule.
    • rdpEpsilon

      public float rdpEpsilon
      Simplification tolerance used by reduced and curve path modes.
    • curveSteps

      public int curveSteps
      Number of divisions used when constructing a curve-point schedule.
    • curveBias

      public float curveBias
      Reserved curve-shaping value.
    • hopMode

      Event timing mode for scheduled gesture events.
    • hopLengthSamples

      public int hopLengthSamples
      Fixed hop length in samples when hopMode is GestureGranularConfig.HopMode.FIXED.
    • timingMode

      User-facing timing mode for GUI state and presets.
    • basePointCount

      public int basePointCount
      Original point count recorded from a schedule for GUI reference.
    • baseDurationMs

      public int baseDurationMs
      Original duration in milliseconds recorded from a schedule for GUI reference.
    • resampleCount

      public int resampleCount
      Target event count for resampling; 0 means no override.
    • targetDurationMs

      public int targetDurationMs
      Target gesture duration in milliseconds; 0 means no override.
    • warpShape

      Timing warp shape. GestureGranularConfig.WarpShape.LINEAR disables warping.
    • warpExponent

      public float warpExponent
      Exponent used by exponential and square-root warp shapes.
    • grainLengthSamples

      public int grainLengthSamples
      Length of each granular grain in samples.
    • env

      public ADSRParams env
      Envelope applied to granular or sampler playback.
    • gainDb

      public float gainDb
      Playback gain in decibels.
    • pitchSemitones

      public float pitchSemitones
      Pitch offset in semitones.
    • burstGrains

      public int burstGrains
      Number of grains generated for each scheduled gesture event.
    • autoBurstGainComp

      public boolean autoBurstGainComp
      True to compensate gain automatically when one event produces multiple burst grains.
    • useArcLengthTime

      public boolean useArcLengthTime
      True to derive curve timing from arc length rather than point index.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • gainDb

      public GestureGranularConfig.Builder gainDb(float gainDb)
      Sets the playback gain in decibels.
      Parameters:
      gainDb - desired gain in dB
      Returns:
      reference to this Builder
    • granularEnvelope

      public GestureGranularConfig.Builder granularEnvelope(ADSRParams env)
      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

      public GestureGranularConfig.Builder samplerEnvelope(ADSRParams env)
      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

      public GestureGranularConfig 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

      public void setBaselinesFromSchedule(GestureSchedule s)
      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 - if s is 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

      public void copyFrom(GestureGranularConfig.Builder src)
      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 - if src is null