Class OverlapUtil
java.lang.Object
net.paulhertz.pixelaudio.granular.OverlapUtil
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.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic OverlapUtil.SlicecomputeBlockSlice(long blockStart, int blockSize, long spanStart, long spanEnd) Compute overlap slice into the current block for a span [spanStart, spanEnd).
-
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.
-