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. TODO use in Granular engine too?

- ## Method Summary

  Modifier and Type
  Method
  Description
  `default int`
  `play()`
  Simple play call using default amplitude, pitch, and pan.
  `default int`
  `play(float amplitude)`
  Play with amplitude only.
  `default int`
  `play(float amplitude, float pitch)`
  Play with amplitude and pitch.
  `int`
  `play(float amplitude, float pitch, float pan)`
  Minimal play signature for generic playables.
  `default int`
  `play(float amplitude, float pitch, float pan, boolean unused)`
  Play with amplitude, pitch, and pan.
  `default int`
  `play(float amplitude, ADSRParams env, float pitch, float pan)`
  Optional interface for playables that support envelopes.
  `void`
  `stop()`
  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.

  - ### play

    default int play(float amplitude)
    Play with amplitude only.

  - ### play

    default int play(float amplitude, float pitch)
    Play with amplitude and pitch.

  - ### play

    default int play(float amplitude, float pitch, float pan, boolean unused)
    Play with amplitude, pitch, and pan.

  - ### play

    default int play(float amplitude, ADSRParams env, float pitch, float pan)
    Optional interface for playables that support envelopes. Implementations that don't use ADSR can ignore this overload.