Class SamplerBrushEvent

java.lang.Object
net.paulhertz.pixelaudio.sampler.SamplerBrushEvent
All Implemented Interfaces:
Comparable<SamplerBrushEvent>

public class SamplerBrushEvent extends Object implements Comparable<SamplerBrushEvent>
Stores values used for SamplerBrush event staging, used in tutorial examples such as TutorialOne_03_Drawing. SamplerBrush objects implement AudioBrush and address the Sampler synthesis engine. A SamplerBrushEvent is a discrete audio synthesis process, complete with ADSR envelope.

There is no corresponding "GranularBrushEvent". Grains, which allow similar parametric control with the grain window equivalent to the ADSR envelope, are embedded in the audio synthesis process and hence are not discrete events.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final int
    event duration
    ADSR envelope for the sampler event.
    final int
    time of event, typically a milliseconds offset from a trigger event
    final float
    Linear gain multiplier for playback.
    boolean
    True when this event should be ignored by consumers.
    final float
    Stereo pan position, from -1.0 left to 1.0 right.
    final float
    Pitch ratio for playback, where 1.0 leaves pitch unchanged.
    final int
    audio buffer index, typically derived from event coordinates
    final int
    x-coordinate associated with SamplerBrushEvent
    final int
    y-coordinate associated with SamplerBrushEvent
  • Constructor Summary

    Constructors
    Constructor
    Description
    SamplerBrushEvent(int x, int y, int eventTimeMs, int samplePos, int sampleLen, float gain, float pitchRatio, ADSRParams env, float pan)
    Creates a sampler brush event.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    int
     
    int
     
    int
     
    int
     
    boolean
     
    void
    setStale(boolean stale)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • x

      public final int x
      x-coordinate associated with SamplerBrushEvent
    • y

      public final int y
      y-coordinate associated with SamplerBrushEvent
    • eventTimeMs

      public final int eventTimeMs
      time of event, typically a milliseconds offset from a trigger event
    • samplePos

      public final int samplePos
      audio buffer index, typically derived from event coordinates
    • durationMs

      public final int durationMs
      event duration
    • gain

      public final float gain
      Linear gain multiplier for playback.
    • pitchRatio

      public final float pitchRatio
      Pitch ratio for playback, where 1.0 leaves pitch unchanged.
    • pan

      public final float pan
      Stereo pan position, from -1.0 left to 1.0 right.
    • env

      public final ADSRParams env
      ADSR envelope for the sampler event.
    • isStale

      public boolean isStale
      True when this event should be ignored by consumers.
  • Constructor Details

    • SamplerBrushEvent

      public SamplerBrushEvent(int x, int y, int eventTimeMs, int samplePos, int sampleLen, float gain, float pitchRatio, ADSRParams env, float pan)
      Creates a sampler brush event.
      Parameters:
      x - x-coordinate associated with the event
      y - y-coordinate associated with the event
      eventTimeMs - event time in milliseconds
      samplePos - audio buffer index to start playback
      sampleLen - event duration in milliseconds
      gain - linear gain multiplier
      pitchRatio - pitch ratio, where 1.0 leaves pitch unchanged
      env - ADSR envelope for the event
      pan - stereo pan position
  • Method Details

    • getX

      public int getX()
      Returns:
      x-coordinate associated with the event
    • getY

      public int getY()
      Returns:
      y-coordinate associated with the event
    • eventTimeMs

      public int eventTimeMs()
      Returns:
      event time in milliseconds
    • isStale

      public boolean isStale()
      Returns:
      true when this event should be ignored by consumers
    • setStale

      public void setStale(boolean stale)
      Parameters:
      stale - true to mark this event stale
    • getDurationMs

      public int getDurationMs()
      Returns:
      event duration in milliseconds
    • compareTo

      public int compareTo(SamplerBrushEvent tl)
      Specified by:
      compareTo in interface Comparable<SamplerBrushEvent>