public class OptimizedGranulator extends java.lang.Object implements AudioProcessor
Modifier and Type | Field and Description |
---|---|
static float |
ADAPTIVE_INTERP_HIGH_THRESH |
static float |
ADAPTIVE_INTERP_LOW_THRESH |
Constructor and Description |
---|
OptimizedGranulator(float sampleRate,
int bufferSize)
Instantiates a new GranularSamplePlayer.
|
Modifier and Type | Method and Description |
---|---|
float |
getFrameCubic(double posInMS)
Retrieves a frame of audio using cubic interpolation.
|
double |
getFrameLinear(double posInMS)
Retrieves a frame of audio using linear interpolation.
|
float |
getFrameNoInterp(double posInMS)
Retrieves a frame of audio using no interpolation.
|
float |
getValueFraction(float fraction)
Returns the value of the buffer at the given fraction along its length (0 = start, 1 = end).
|
boolean |
process(AudioEvent audioEvent)
Process the audio event.
|
void |
processingFinished()
Notify the AudioProcessor that no more data is available and processing
has finished.
|
void |
setGrainInterval(int grainInterval) |
void |
setGrainRandomness(float grainRandomness) |
void |
setGrainSize(int grainSize) |
void |
setPitchShiftFactor(float currentFactor) |
void |
setPosition(float position) |
void |
setTimestretchFactor(float currentFactor) |
void |
start() |
public static final float ADAPTIVE_INTERP_LOW_THRESH
public static final float ADAPTIVE_INTERP_HIGH_THRESH
public OptimizedGranulator(float sampleRate, int bufferSize)
sampleRate
- the sample rate.bufferSize
- the size of an output buffer.public void start()
public boolean process(AudioEvent audioEvent)
AudioProcessor
process
in interface AudioProcessor
audioEvent
- The audio event that contains audio data.public double getFrameLinear(double posInMS)
posInMS
- The frame to read -- can be fractional (e.g., 4.4).result
- The framedata to fill.public float getFrameNoInterp(double posInMS)
posInMS
- The frame to read -- will take the last frame before this one.public float getFrameCubic(double posInMS)
posInMS
- The frame to read -- can be fractional (e.g., 4.4).public void processingFinished()
AudioProcessor
processingFinished
in interface AudioProcessor
public float getValueFraction(float fraction)
fraction
- the point along the buffer to inspect.public void setTimestretchFactor(float currentFactor)
public void setPitchShiftFactor(float currentFactor)
public void setGrainInterval(int grainInterval)
public void setGrainSize(int grainSize)
public void setGrainRandomness(float grainRandomness)
public void setPosition(float position)
position
- in seconds