Package net.paulhertz.pixelaudio.granular

# Class OverlapUtil

java.lang.Object
net.paulhertz.pixelaudio.granular.OverlapUtil

public final class OverlapUtil extends Object
OverlapUtil Small helper for computing overlap between a span [spanStart, spanEnd) and a block [blockStart, blockStart+blockSize). Useful for granular streaming and any span-based scheduling at audio rate. Critical use in `PABurstGranularSource`, as part of PixelAudio's granular synthesis processing chain.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static final class`
  `OverlapUtil.Slice`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `private`
  `OverlapUtil()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static OverlapUtil.Slice`
  `computeBlockSlice(long blockStart, int blockSize, long spanStart, long spanEnd)`
  Compute overlap slice into the current block for a span [spanStart, spanEnd).

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### OverlapUtil

    private OverlapUtil()

- ## Method Details

  - ### computeBlockSlice

    public static OverlapUtil.Slice computeBlockSlice(long blockStart, int blockSize, long spanStart, long spanEnd)
    Compute overlap slice into the current block for a span [spanStart, spanEnd).
    Parameters:
      `blockStart` - absolute sample index of the first sample in the block.
      `blockSize` - number of samples in this block.
      `spanStart` - absolute start of the span (inclusive).
      `spanEnd` - absolute end of the span (exclusive).
    Returns:
      a Slice indicating [startIndex, endIndex) within the block, or hasOverlap=false if none.