Interface PAFloatSource

All Known Subinterfaces:
PASource
All Known Implementing Classes:
PABurstGranularSource

public interface PAFloatSource
Minimal, library-agnostic audio source abstraction for PixelAudio voices.

PAFloatSource deals only with floating-point audio buffers and sample indices. It deliberately avoids Minim and Processing types so sources can be rendered by PixelAudio's voice classes without depending on a particular audio backend.

Implementations are expected to be safe for audio-thread use:

  • mix into output buffers rather than clearing them;
  • avoid allocation and blocking work in renderBlock(long, int, float[], float[]);
  • treat blockStart as an absolute sample position in the source's playback domain.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Returns the source duration in samples.
    void
    renderBlock(long blockStart, int blockSize, float[] outL, float[] outR)
    Renders audio into the supplied block buffers.
  • Method Details

    • renderBlock

      void renderBlock(long blockStart, int blockSize, float[] outL, float[] outR)
      Renders audio into the supplied block buffers.

      Implementations should assume that outL and outR have at least blockSize elements. Samples should be added to the buffers, not assigned over existing contents, so multiple voices can accumulate into the same output block.

      Parameters:
      blockStart - absolute sample index in the source's playback domain
      blockSize - number of samples to render
      outL - left channel buffer to mix into
      outR - right channel buffer to mix into; may be the same array as outL for mono
    • lengthSamples

      long lengthSamples()
      Returns the source duration in samples.
      Returns:
      duration in samples, or Long.MAX_VALUE for an effectively infinite or streaming source