detectLoop
detectLoop(
buffer):object
Defined in: packages/pleco-xa/src/core/loopHelpers.js:39
Detect loop points and return a real sample-range descriptor.
This is the SYNCHRONOUS play-layer entry point. It runs the same
beat-tracked precise / bar-aligned pipeline as loop.detect()’s ‘fast’
strategy (src/loop/fast.js): beat tracking for tempo, an onset-pair precise
search, then a within-strategy bar-aligned search, and finally the same
documented first-half heuristic. It returns a genuine { startSample, endSample } sub-range — it does NOT return the whole buffer for detectable
material (that is what the old stub did, and what fullBufferLoop is for).
It stays synchronous (rather than awaiting the async loop.detect())
because the play layer needs a mutable descriptor it can assign into
(loop.endSample = …); it therefore drives the same synchronous detection
primitives directly.
Parameters
Section titled “Parameters”buffer
Section titled “buffer”getChannelData
Section titled “getChannelData”Function
length
Section titled “length”number
sampleRate
Section titled “sampleRate”number
Returns
Section titled “Returns”object
endSample
Section titled “endSample”endSample:
number
startSample
Section titled “startSample”startSample:
number