Package net.paulhertz.pixelaudio.voices
Interface PASampler
- All Known Implementing Classes:
PASharedBufferSampler
public interface PASampler
Backend engine contract for sampler implementations.
Allows swapping implementations without changing higher layers.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns true if any currently active voice is looping.intplay(int samplePos, int sampleLen, float amplitude, ADSRParams env, float pitch, float pan) Play command with all the useful arguments in standard order.voidsetBuffer(float[] buffer) voidsetBuffer(float[] buffer, float playbackSampleRate) voidsetSampleRate(float newRate) voidstopAll()Stops all voices immediately.
-
Method Details
-
play
Play command with all the useful arguments in standard order.- Parameters:
samplePos- index into the buffer to start samplingsampleLen- expected duration of the audio event, which is expected to return its actual durationamplitude- maximum amplitude of signal generated by the samplerenv- ADSR style envelope for the entire eventpitch- pitch multiplier, where 1.0f implies pitch is unchanged and all samples are readpan- location of audio event in stereo field, -1.0f = left, 0.0f = center, 1.0f = right- Returns:
- actual duration of event in samples, typically sampleLen + envelope release time
-
isLooping
boolean isLooping()Returns true if any currently active voice is looping. -
stopAll
void stopAll()Stops all voices immediately. -
setSampleRate
void setSampleRate(float newRate) -
setBuffer
void setBuffer(float[] buffer) -
setBuffer
void setBuffer(float[] buffer, float playbackSampleRate)
-