Package net.paulhertz.pixelaudio.sampler
Interface PAPlayable
- All Known Subinterfaces:
PASamplerPlayable
- All Known Implementing Classes:
PASamplerInstrument,PASamplerInstrumentPool,PASamplerInstrumentPoolMulti
public interface PAPlayable
Generic interface for anything that can be "played."
Provides a minimal playback API plus backward-compatible overloads
for sampler instruments and other PAPlayable classes.
Used for Sampler audio synthesis engine.
-
Method Summary
Modifier and TypeMethodDescriptiondefault intplay()Simple play call using default amplitude, pitch, and pan.default intplay(float amplitude) Play with amplitude only.default intplay(float amplitude, float pitch) Play with amplitude and pitch.intplay(float amplitude, float pitch, float pan) Minimal play signature for generic playables.default intplay(float amplitude, float pitch, float pan, boolean unused) Play with amplitude, pitch, and pan.default intplay(float amplitude, ADSRParams env, float pitch, float pan) Optional interface for playables that support envelopes.voidstop()Stop playback immediately (implementation-defined).
-
Method Details
-
play
int play(float amplitude, float pitch, float pan) Minimal play signature for generic playables. Implementations may ignore parameters they don't need.- Parameters:
amplitude- gain multiplier (0..1+)pitch- playback rate or pitch factor (implementation-defined)pan- stereo pan (-1 left .. +1 right)- Returns:
- non-zero if a voice/event was triggered
-
stop
void stop()Stop playback immediately (implementation-defined). -
play
default int play()Simple play call using default amplitude, pitch, and pan.- Returns:
- non-zero if a voice/event was triggered
-
play
default int play(float amplitude) Play with amplitude only.- Parameters:
amplitude- gain multiplier- Returns:
- non-zero if a voice/event was triggered
-
play
default int play(float amplitude, float pitch) Play with amplitude and pitch.- Parameters:
amplitude- gain multiplierpitch- playback rate or pitch factor- Returns:
- non-zero if a voice/event was triggered
-
play
default int play(float amplitude, float pitch, float pan, boolean unused) Play with amplitude, pitch, and pan.- Parameters:
amplitude- gain multiplierpitch- playback rate or pitch factorpan- stereo panunused- legacy compatibility parameter- Returns:
- non-zero if a voice/event was triggered
-
play
Optional interface for playables that support envelopes. Implementations that don't use ADSR can ignore this overload.- Parameters:
amplitude- gain multiplierenv- optional ADSR envelopepitch- playback rate or pitch factorpan- stereo pan- Returns:
- non-zero if a voice/event was triggered
-