Class GestureGranularRenderer.DefaultMapping
java.lang.Object
net.paulhertz.pixelaudio.granular.GestureGranularRenderer.DefaultMapping
- All Implemented Interfaces:
GestureGranularRenderer.GestureMapping
- Enclosing class:
- GestureGranularRenderer
public static final class GestureGranularRenderer.DefaultMapping
extends Object
implements GestureGranularRenderer.GestureMapping
Default mapping for PixelAudio:
- sample index from PixelAudioMapper.lookupSample(x,y)
- optional mapping offset (totalShift) and modulo mapSize
- soft pan range mapped from x across screenWidth
Designed to be stateful: totalShift and panRange can change over time
(e.g., sliding window through a larger buffer).
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final PixelAudioMapperprivate final intprivate floatprivate intprivate int -
Constructor Summary
ConstructorsConstructorDescriptionDefaultMapping(PixelAudioMapper mapper, int totalShift, int mapSize, int screenWidth, float panRange) -
Method Summary
Modifier and TypeMethodDescriptionprivate static floatclamp01(float v) floatintfloatpan(processing.core.PVector p) Convert a gesture point into stereo pan (-1..+1).intsampleIndex(processing.core.PVector p) Convert a gesture point into a source sample index (0..sourceLen-1).voidsetPanRange(float r) voidsetScreenWidth(int w) voidsetTotalShift(int newShift)
-
Field Details
-
mapper
-
totalShift
private int totalShift -
mapSize
private final int mapSize -
screenWidth
private int screenWidth -
panRange
private float panRange
-
-
Constructor Details
-
DefaultMapping
public DefaultMapping(PixelAudioMapper mapper, int totalShift, int mapSize, int screenWidth, float panRange)
-
-
Method Details
-
setTotalShift
public void setTotalShift(int newShift) -
getTotalShift
public int getTotalShift() -
setScreenWidth
public void setScreenWidth(int w) -
setPanRange
public void setPanRange(float r) -
getPanRange
public float getPanRange() -
sampleIndex
public int sampleIndex(processing.core.PVector p) Description copied from interface:GestureGranularRenderer.GestureMappingConvert a gesture point into a source sample index (0..sourceLen-1).- Specified by:
sampleIndexin interfaceGestureGranularRenderer.GestureMapping
-
pan
public float pan(processing.core.PVector p) Description copied from interface:GestureGranularRenderer.GestureMappingConvert a gesture point into stereo pan (-1..+1).- Specified by:
panin interfaceGestureGranularRenderer.GestureMapping
-
clamp01
private static float clamp01(float v)
-