Package net.paulhertz.pixelaudio.sampler
Class SamplerBrushEvent
java.lang.Object
net.paulhertz.pixelaudio.sampler.SamplerBrushEvent
- All Implemented Interfaces:
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
FieldsModifier and TypeFieldDescriptionfinal intevent durationfinal ADSRParamsADSR envelope for the sampler event.final inttime of event, typically a milliseconds offset from a trigger eventfinal floatLinear gain multiplier for playback.booleanTrue when this event should be ignored by consumers.final floatStereo pan position, from -1.0 left to 1.0 right.final floatPitch ratio for playback, where 1.0 leaves pitch unchanged.final intaudio buffer index, typically derived from event coordinatesfinal intx-coordinate associated with SamplerBrushEventfinal inty-coordinate associated with SamplerBrushEvent -
Constructor Summary
ConstructorsConstructorDescriptionSamplerBrushEvent(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
-
Field Details
-
x
public final int xx-coordinate associated with SamplerBrushEvent -
y
public final int yy-coordinate associated with SamplerBrushEvent -
eventTimeMs
public final int eventTimeMstime of event, typically a milliseconds offset from a trigger event -
samplePos
public final int samplePosaudio buffer index, typically derived from event coordinates -
durationMs
public final int durationMsevent duration -
gain
public final float gainLinear gain multiplier for playback. -
pitchRatio
public final float pitchRatioPitch ratio for playback, where 1.0 leaves pitch unchanged. -
pan
public final float panStereo pan position, from -1.0 left to 1.0 right. -
env
ADSR envelope for the sampler event. -
isStale
public boolean isStaleTrue 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 eventy- y-coordinate associated with the eventeventTimeMs- event time in millisecondssamplePos- audio buffer index to start playbacksampleLen- event duration in millisecondsgain- linear gain multiplierpitchRatio- pitch ratio, where 1.0 leaves pitch unchangedenv- ADSR envelope for the eventpan- 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
- Specified by:
compareToin interfaceComparable<SamplerBrushEvent>
-